x264/x264.spec

187 lines
4.7 KiB
RPMSpec
Raw Normal View History

2023-10-18 14:45:26 +08:00
# globals for x264-0.164-20231001git31e19f92.tar.bz2
%global api 164
%global gitdate 20231001
%global gitversion 31e19f92
2021-05-08 10:06:46 +08:00
2023-10-18 14:45:26 +08:00
%global snapshot %{gitdate}git%{gitversion}
2021-05-08 10:06:46 +08:00
%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
2021-05-08 10:06:46 +08:00
#Whitelist of arches with dedicated ASM code
2023-10-18 14:45:26 +08:00
%global asmarch x86_64 armv7hl armv7hnl ppc64le aarch64 i686 ppc64
2021-05-08 10:06:46 +08:00
%ifnarch %{asmarch}
%global _without_asm 1
%endif
Summary: H264/AVC video streams encoder
Name: x264
Version: 0.%{api}
2023-10-18 14:45:26 +08:00
Release: 1%{?gver}%{?_with_bootstrap:_bootstrap}
2021-05-08 10:06:46 +08:00
License: GPLv2+
URL: https://www.videolan.org/developers/x264.html
Source0: %{name}-0.%{api}-%{snapshot}.tar.bz2
Source1: x264-snapshot.sh
2023-10-18 14:45:26 +08:00
Source2: version.h
2021-05-08 10:06:46 +08:00
# 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
Patch11: x264-opencl.patch
BuildRequires: gcc
2023-10-18 14:45:26 +08:00
%{!?_without_gpac:BuildRequires: gpac-devel-static zlib-devel openssl-devel libpng-devel libjpeg-devel xz-devel libglvnd-devel mesa-libGLU-devel faad2-devel libmad-devel xvidcore-devel a52dec-devel libvorbis-devel libtheora-devel openjpeg2-devel}
2021-05-08 10:06:46 +08:00
%{!?_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
2023-10-18 14:45:26 +08:00
%ifarch %{asmarch}
2021-05-08 10:06:46 +08:00
BuildRequires: nasm
%endif
2023-10-18 14:45:26 +08:00
BuildRequires: bash-completion
2021-05-08 10:06:46 +08:00
# 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 \\\
2023-10-18 14:45:26 +08:00
--host=%{_host} \\\
--prefix=%{_prefix} \\\
--exec-prefix=%{_exec_prefix} \\\
--bindir=%{_bindir} \\\
--includedir=%{_includedir} \\\
--libdir=%{_libdir} \\\
2021-05-08 10:06:46 +08:00
%{?_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}
2023-10-18 14:45:26 +08:00
cp %{SOURCE2} .
2021-05-08 10:06:46 +08:00
%patch0 -p1 -b .nover
%patch1 -p1 -b .10b
%patch11 -p1 -b .opencl
popd
variants="generic generic10"
2023-10-18 14:45:26 +08:00
2021-05-08 10:06:46 +08:00
for variant in $variants ; do
rm -rf ${variant}
cp -pr %{name}-0.%{api}-%{snapshot} ${variant}
done
%build
2023-10-18 14:45:26 +08:00
%set_build_flags
2021-05-08 10:06:46 +08:00
pushd generic
%{x_configure}\
%{?_without_asm:--disable-asm}
2023-10-18 14:45:26 +08:00
%make_build
2021-05-08 10:06:46 +08:00
popd
pushd generic10
%{x_configure}\
%{?_without_asm:--disable-asm}\
--disable-cli\
--disable-opencl \
--bit-depth=10
2023-10-18 14:45:26 +08:00
%make_build
2021-05-08 10:06:46 +08:00
popd
%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
#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}/
2023-10-18 14:45:26 +08:00
%ldconfig_scriptlets libs
2021-05-08 10:06:46 +08:00
%files
%{_bindir}/x264
2023-10-18 14:45:26 +08:00
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/x264
2021-05-08 10:06:46 +08:00
%files libs
%dir %{_pkgdocdir}
%{_pkgdocdir}/AUTHORS
%license %{_pkgdocdir}/COPYING
%{_libdir}/libx264.so.%{api}
%{_libdir}/libx26410b.so.%{api}
%files devel
%doc generic/doc/*
%{_includedir}/x264.h
%{_includedir}/x264_config.h
%{_libdir}/libx264.so
%{_libdir}/libx26410b.so
%{_libdir}/pkgconfig/%{name}.pc
%changelog
2023-10-18 14:45:26 +08:00
* Wed Oct 18 2023 li weigang <weigangli99@gmail.com> - 0.164-1
- update to version 0.164
* Tue Dec 21 2021 Chenxi Mao <chenxi.mao@suse.com> - 0.157-13
- x264: fix build error
2021-05-08 10:06:46 +08:00
* Fri May 07 2021 weidong <weidong@uniontech.com> - 0.157-12.20190717git34c06d1
- Initial package.