x264/x264.spec
Chenxi Mao 310c7c36b8 x264: fix build error because of incorrect macro definition.
Fix x264 package as we did in 21.09, the original macro definition
is incorrect and lead to build fail.

The root cause is we cannot provide gpac* devel package in our
build env, so we need to set correct macro to disable it.

On the other hand, X264 is set to disable/exclude status on
OpenEuler 2109 official OBS build server.

Change-Id: I6a3fb1b705a8b6f9b5400cb74c51be9d4276735a
Signed-off-by: Chenxi Mao <chenxi.mao@suse.com>
(cherry picked from commit d2fba62c52f9fd17ec5400fb573d5124483dde5f)
2023-03-06 22:03:33 +08:00

219 lines
5.0 KiB
RPMSpec

# 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
# The marco defination logic as below:
# _with_bootstrap to 1
# ==> set _without_* to 1
# ==> Don't require gpac/zlib/*-devel
%define _with_bootstrap 1
%if %{_with_bootstrap}
%define _without_gpac 1
%define _without_libavformat 1
%define _without_libswscale 1
%endif
#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: 13%{?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
* Tue Dec 21 2021 - Chenxi Mao <chenxi.mao@suse.com> - 0.157-13
- x264: fix build error
* Fri May 07 2021 weidong <weidong@uniontech.com> - 0.157-12.20190717git34c06d1
- Initial package.