[x264] rework asm treatment on i686 and ppc64

Dominik Mierzejewski rathann at rpmfusion.org
Sun Aug 28 00:39:08 CEST 2016


commit 24485358687e458200b9512625c5dc33131dc410
Author: Dominik 'Rathann' Mierzejewski <rpm at greysector.net>
Date:   Sun Aug 28 00:38:52 2016 +0200

    rework asm treatment on i686 and ppc64
    
    - fix adding the 10b suffix to the library name
    - correct the list of ASM-enabled arches:
      * ppc64 can be Power5, which doesn't have AltiVec
      * ppc64le always has it
      * no implementation for sparc
    - force non-executable stack on armv7 (#3975)
    - explicitly disable OpenCL support, it's dlopened at the moment
      and not working without ocl-icd-devel
    - drop doc and license from main package, libs already contain it
    - update URL

 x264-10b.patch |  37 ++++++++++++++++++
 x264.spec      | 116 ++++++++++++++++++++++++++++++++++++++-------------------
 2 files changed, 114 insertions(+), 39 deletions(-)
---
diff --git a/x264-10b.patch b/x264-10b.patch
new file mode 100644
index 0000000..6c58b9f
--- /dev/null
+++ b/x264-10b.patch
@@ -0,0 +1,37 @@
+diff -up generic10/configure.10b generic10/configure
+--- generic10/configure.10b	2016-08-26 19:48:41.447839506 +0200
++++ generic10/configure	2016-08-26 19:49:26.902033893 +0200
+@@ -1372,6 +1374,12 @@ PROF_USE_LD=$PROF_USE_LD
+ HAVE_OPENCL=$opencl
+ EOF
+ 
++if [ "$bit_depth" -gt "8" ]; then
++    echo "LIBNAME=libx264${bit_depth}b" >> config.mak
++else
++    echo "LIBNAME=libx264" >> config.mak
++fi
++
+ if [ $compiler_style = MS ]; then
+     echo '%.o: %.c' >> config.mak
+     echo '	$(CC) $(CFLAGS) -c -Fo$@ $<' >> config.mak
+@@ -1410,7 +1418,7 @@ if [ "$shared" = "yes" ]; then
+         echo "SOFLAGS=-shared -Wl,-h,\$(SONAME) $SOFLAGS" >> config.mak
+     else
+         echo "SOSUFFIX=so" >> config.mak
+-        echo "SONAME=libx264.so.$API" >> config.mak
++        echo "SONAME=\$(LIBNAME).so.$API" >> config.mak
+         echo "SOFLAGS=-shared -Wl,-soname,\$(SONAME) $SOFLAGS" >> config.mak
+     fi
+     echo 'default: lib-shared' >> config.mak
+diff -up generic10/Makefile.10b generic10/Makefile
+--- generic10/Makefile.10b	2016-06-14 14:04:37.000000000 +0200
++++ generic10/Makefile	2016-08-26 19:48:41.449839514 +0200
+@@ -302,7 +302,7 @@ ifneq ($(IMPLIBNAME),)
+ 	$(INSTALL) -m 755 $(SONAME) $(DESTDIR)$(bindir)
+ 	$(INSTALL) -m 644 $(IMPLIBNAME) $(DESTDIR)$(libdir)
+ else ifneq ($(SONAME),)
+-	ln -f -s $(SONAME) $(DESTDIR)$(libdir)/libx264.$(SOSUFFIX)
++	ln -f -s $(SONAME) $(DESTDIR)$(libdir)/$(LIBNAME).$(SOSUFFIX)
+ 	$(INSTALL) -m 755 $(SONAME) $(DESTDIR)$(libdir)
+ endif
+ 
diff --git a/x264.spec b/x264.spec
index 25a44f4..3f60dfa 100644
--- a/x264.spec
+++ b/x264.spec
@@ -14,31 +14,42 @@
 %global _without_libswscale  1
 }
 #Whitelist of arches with dedicated ASM code
-#i686 is disabled on purpose - re-enabled with sse2 build
-%ifnarch x86_64 armv7hl armv7hnl ppc ppc64 %{sparc} aarch64
+%global asmarch x86_64 armv7hl armv7hnl ppc64le aarch64
+# list of arches where ASM must be optional
+%global simdarch i686 ppc64
+%ifnarch %{asmarch}
 %global _without_asm 1
 %endif
+%ifarch i686
+%global slibdir %{_libdir}/sse2
+%endif
+%ifarch ppc64
+%global slibdir %{_libdir}/altivec
+%endif
 
 Summary: H264/AVC video streams encoder
 Name: x264
 Version: 0.%{api}
-Release: 10%{?gver}%{?_with_bootstrap:_bootstrap}%{?dist}
+Release: 11%{?gver}%{?_with_bootstrap:_bootstrap}%{?dist}
 License: GPLv2+
-URL: http://developers.videolan.org/x264.html
+URL: https://www.videolan.org/developers/x264.html
 Source0: %{name}-0.%{api}-%{snapshot}.tar.bz2
 Source1: x264-snapshot.sh
-BuildRequires: perl-Digest-MD5
 
 # don't remove config.h and don't re-run version.sh
 Patch0: x264-nover.patch
+# add 10b suffix to high bit depth build
+Patch1: x264-10b.patch
 Patch10: x264-gpac.patch
 
 %{!?_without_gpac:BuildRequires: gpac-devel-static zlib-devel openssl-devel libpng-devel libjpeg-devel}
 %{!?_without_libavformat:BuildRequires: ffmpeg-devel}
 %{?_with_ffmpegsource:BuildRequires: ffmpegsource-devel}
-%{!?_without_asm:BuildRequires: yasm >= 1.0.0}
-# for sse2 build
-%ifarch i686
+# https://bugzilla.rpmfusion.org/show_bug.cgi?id=3975
+%ifarch armv7hl armv7hnl
+BuildRequires: execstack
+%endif
+%ifarch %{asmarch} %{simdarch}
 BuildRequires: yasm >= 1.0.0
 %endif
 # we need to enforce the exact EVR for an ISA - not only the same ABI
@@ -73,6 +84,7 @@ This package contains the development files.
 	%{?_without_libavformat:--disable-lavf} \\\
 	%{?_without_libswscale:--disable-swscale} \\\
 	%{!?_with_ffmpegsource:--disable-ffms} \\\
+	--disable-opencl \\\
 	--enable-debug \\\
 	--enable-shared \\\
 	--system-libx264 \\\
@@ -82,12 +94,13 @@ This package contains the development files.
 %setup -q -c -n %{name}-0.%{api}-%{snapshot}
 pushd %{name}-0.%{api}-%{snapshot}
 %patch0 -p1 -b .nover
+%patch1 -p1 -b .10b
 %patch10 -p1 -b .gpac
 popd
 
 variants="generic generic10"
-%ifarch i686
-variants="$variants simd"
+%ifarch %{simdarch}
+variants="$variants simd simd10"
 %endif
 for variant in $variants ; do
   rm -rf ${variant}
@@ -103,78 +116,103 @@ pushd generic
 %{__make} %{?_smp_mflags}
 popd
 
-%ifarch i686
+pushd generic10
+%{x_configure}\
+	%{?_without_asm:--disable-asm}\
+	--disable-cli\
+	--bit-depth=10
+
+%{__make} %{?_smp_mflags}
+popd
+
+%ifarch %{simdarch}
 pushd simd
 %{x_configure}\
-	--libdir=%{_libdir}/sse2
+	--libdir=%{slibdir}
 
 %{__make} %{?_smp_mflags}
 popd
-%endif
 
-pushd generic10
+pushd simd10
 %{x_configure}\
-%ifnarch i686
-	%{?_without_asm:--disable-asm}\
-%endif
+	--disable-cli\
+	--libdir=%{slibdir}\
 	--bit-depth=10
 
-sed -i -e "s/SONAME=libx264.so./SONAME=libx26410b.so./" config.mak
-
 %{__make} %{?_smp_mflags}
 popd
+%endif
 
 %install
-pushd generic
+for variant in generic generic10 ; do
+pushd ${variant}
 %make_install
 popd
-%ifarch i686
-pushd simd
+done
+%ifarch %{simdarch}
+for variant in simd simd10 ; do
+pushd ${variant}
 %make_install
-rm %{buildroot}%{_libdir}/*/pkgconfig/x264.pc
+rm %{buildroot}%{slibdir}/pkgconfig/x264.pc
 popd
+done
 %endif
-pushd generic10
-SONAME=`grep "^SONAME=" config.mak`
-export $SONAME
-install -m 755 ${SONAME} %{buildroot}%{_libdir}
-ln -fs ${SONAME} %{buildroot}%{_libdir}/libx26410b.so
-popd
 
 #Fix timestamp on x264 generated headers
 touch -r generic/version.h %{buildroot}%{_includedir}/x264.h %{buildroot}%{_includedir}/x264_config.h
 
+# https://bugzilla.rpmfusion.org/show_bug.cgi?id=3975
+%ifarch armv7hl armv7hnl
+execstack -c %{buildroot}%{_libdir}/libx264{,10b}.so.%{api}
+%endif
+
+install -dm755 %{buildroot}%{_pkgdocdir}
+install -pm644 generic/{AUTHORS,COPYING} %{buildroot}%{_pkgdocdir}/
 
 %post libs -p /sbin/ldconfig
 
 %postun libs -p /sbin/ldconfig
 
 %files
-%doc generic/AUTHORS
-%license generic/COPYING
 %{_bindir}/x264
 
 %files libs
-%doc generic/AUTHORS
-%license generic/COPYING
+%dir %{_pkgdocdir}
+%{_pkgdocdir}/AUTHORS
+%license %{_pkgdocdir}/COPYING
 %{_libdir}/libx264.so.%{api}
-%ifarch i686
-%{_libdir}/sse2/libx264.so.%{api}
-%endif
 %{_libdir}/libx26410b.so.%{api}
+%ifarch %{simdarch}
+%{slibdir}/libx264.so.%{api}
+%{slibdir}/libx26410b.so.%{api}
+%endif
 
 %files devel
 %doc generic/doc/*
 %{_includedir}/x264.h
 %{_includedir}/x264_config.h
 %{_libdir}/libx264.so
+%{_libdir}/libx26410b.so
 %{_libdir}/pkgconfig/%{name}.pc
-%ifarch i686
-%{_libdir}/sse2/libx264.so
+%ifarch %{simdarch}
+%{slibdir}/libx264.so
+%{slibdir}/libx26410b.so
 %endif
-%{_libdir}/libx26410b.so
 
 %changelog
+* Fri Aug 26 2016 Dominik Mierzejewski <rpm at greysector.net> - 0.148-11.20160614gita5e06b9
+- rework asm treatment on i686 and ppc64
+- fix adding the 10b suffix to the library name
+- correct the list of ASM-enabled arches:
+  * ppc64 can be Power5, which doesn't have AltiVec
+  * ppc64le always has it
+  * no implementation for sparc
+- force non-executable stack on armv7 (#3975)
+- explicitly disable OpenCL support, it's dlopened at the moment
+  and not working without ocl-icd-devel
+- drop doc and license from main package, libs already contain it
+- update URL
+
 * Thu Aug 18 2016 Sérgio Basto <sergio at serjux.com> - 0.148-10.20160614gita5e06b9
 - Add license tag also to x264-libs
 


More information about the rpmfusion-commits mailing list