x264/x264.spec

212 lines
4.7 KiB
RPMSpec
Raw Normal View History

2021-05-08 10:06:46 +08:00
# globals for x264-0.157-20190717-34c06d1.tar.bz2
%global api 157
%global gitdate 20190717
%global gitversion 34c06d1
%global snapshot %{gitdate}-%{gitversion}
%global gver .%{gitdate}git%{gitversion}
%global branch stable
%global _with_bootstrap 1
%{?_with_bootstrap:
%global _without_gpac 1
%global _without_libavformat 1
%global _without_libswscale 1
}
#Whitelist of arches with dedicated ASM code
%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: 12%{?gver}%{?_with_bootstrap:_bootstrap}
License: GPLv2+
URL: https://www.videolan.org/developers/x264.html
Source0: %{name}-0.%{api}-%{snapshot}.tar.bz2
Source1: x264-snapshot.sh
# 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
Patch11: x264-opencl.patch
BuildRequires: gcc
%{!?_without_gpac:BuildRequires: gpac-devel-static zlib-devel openssl-devel libpng-devel libjpeg-devel}
%{!?_without_libavformat:BuildRequires: ffmpeg-devel}
%{?_with_ffmpegsource:BuildRequires: ffmpegsource-devel}
# https://bugzilla.rpmfusion.org/show_bug.cgi?id=3975
%ifarch armv7hl armv7hnl
BuildRequires: execstack
%endif
%ifarch %{asmarch} %{simdarch}
BuildRequires: nasm
%endif
# we need to enforce the exact EVR for an ISA - not only the same ABI
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%description
x264 is a free library for encoding H264/AVC video streams, written from
scratch.
This package contains the frontend.
%package libs
Summary: Library for encoding H264/AVC video streams
Recommends: %{_libdir}/libOpenCL.so.1
%description libs
x264 is a free library for encoding H264/AVC video streams, written from
scratch.
%package devel
Summary: Development files for the x264 library
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires: pkgconfig
%description devel
x264 is a free library for encoding H264/AVC video streams, written from
scratch.
This package contains the development files.
%global x_configure \
%configure \\\
%{?_without_libavformat:--disable-lavf} \\\
%{?_without_libswscale:--disable-swscale} \\\
%{!?_with_ffmpegsource:--disable-ffms} \\\
--enable-debug \\\
--enable-shared \\\
--system-libx264 \\\
--enable-pic
%prep
%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
%patch11 -p1 -b .opencl
popd
variants="generic generic10"
%ifarch %{simdarch}
variants="$variants simd simd10"
%endif
for variant in $variants ; do
rm -rf ${variant}
cp -pr %{name}-0.%{api}-%{snapshot} ${variant}
done
%build
pushd generic
%{x_configure}\
%{?_without_asm:--disable-asm}
%{__make} %{?_smp_mflags}
popd
pushd generic10
%{x_configure}\
%{?_without_asm:--disable-asm}\
--disable-cli\
--disable-opencl \
--bit-depth=10
%{__make} %{?_smp_mflags}
popd
%ifarch %{simdarch}
pushd simd
%{x_configure}\
--libdir=%{slibdir}
%{__make} %{?_smp_mflags}
popd
pushd simd10
%{x_configure}\
--disable-cli\
--libdir=%{slibdir}\
--disable-opencl \
--bit-depth=10
%{__make} %{?_smp_mflags}
popd
%endif
%install
# NOTE: the order is important here! We want the generic devel stuff
for variant in generic10 generic ; do
pushd ${variant}
%make_install
popd
done
%ifarch %{simdarch}
for variant in simd10 simd ; do
pushd ${variant}
%make_install
rm %{buildroot}%{slibdir}/pkgconfig/x264.pc
popd
done
%endif
#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
%{_bindir}/x264
%files libs
%dir %{_pkgdocdir}
%{_pkgdocdir}/AUTHORS
%license %{_pkgdocdir}/COPYING
%{_libdir}/libx264.so.%{api}
%{_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 %{simdarch}
%{slibdir}/libx264.so
%{slibdir}/libx26410b.so
%endif
%changelog
* Fri May 07 2021 weidong <weidong@uniontech.com> - 0.157-12.20190717git34c06d1
- Initial package.