!1 Initial package.
From: @weidongkl Reviewed-by: @yeqinglong01 Signed-off-by: @yeqinglong01
This commit is contained in:
commit
912182a395
BIN
x264-0.157-20190717-34c06d1.tar.bz2
Normal file
BIN
x264-0.157-20190717-34c06d1.tar.bz2
Normal file
Binary file not shown.
37
x264-10b.patch
Normal file
37
x264-10b.patch
Normal file
@ -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
|
||||
@@ -1473,6 +1473,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 'CC_O=-Fo$@' >> config.mak
|
||||
else
|
||||
@@ -1512,7 +1518,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
|
||||
@@ -398,7 +398,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
|
||||
|
||||
13
x264-gpac.patch
Normal file
13
x264-gpac.patch
Normal file
@ -0,0 +1,13 @@
|
||||
--- ./configure.orig 2019-03-12 00:41:42.000000000 +0000
|
||||
+++ ./configure 2019-03-12 01:10:12.603640526 +0000
|
||||
@@ -1207,7 +1207,9 @@ fi
|
||||
if [ "$gpac" = "auto" -a "$lsmash" != "yes" ] ; then
|
||||
gpac="no"
|
||||
GPAC_LIBS="-lgpac_static"
|
||||
- cc_check "" -lz && GPAC_LIBS="$GPAC_LIBS -lz"
|
||||
+ for lib in -lz -lssl -lcrypto -lpng -ljpeg; do
|
||||
+ cc_check "" $lib && GPAC_LIBS="$GPAC_LIBS $lib"
|
||||
+ done
|
||||
if [ "$SYS" = "WINDOWS" ] ; then
|
||||
cc_check "" -lws2_32 && GPAC_LIBS="$GPAC_LIBS -lws2_32"
|
||||
cc_check "" -lwinmm && GPAC_LIBS="$GPAC_LIBS -lwinmm"
|
||||
11
x264-nover.patch
Normal file
11
x264-nover.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- ./configure.orig 2015-10-21 19:24:34.933238254 +0100
|
||||
+++ ./configure 2015-10-21 19:25:53.907124640 +0100
|
||||
@@ -1236,7 +1236,7 @@ cat > x264_config.h << EOF
|
||||
#define X264_CHROMA_FORMAT $config_chroma_format
|
||||
EOF
|
||||
|
||||
-${SRCPATH}/version.sh >> x264_config.h
|
||||
+cat ${SRCPATH}/version.h >> ${SRCPATH}/x264_config.h
|
||||
|
||||
if [ "$cli_libx264" = "system" ] ; then
|
||||
if [ "$shared" = "yes" ]; then
|
||||
11
x264-opencl.patch
Normal file
11
x264-opencl.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- a/common/opencl.c 2019-03-12 00:41:42.000000000 +0000
|
||||
+++ b/common/opencl.c 2019-04-28 22:39:02.672147762 +0100
|
||||
@@ -36,7 +36,7 @@
|
||||
#if SYS_MACOSX
|
||||
#define ocl_open dlopen( "/System/Library/Frameworks/OpenCL.framework/OpenCL", RTLD_NOW )
|
||||
#else
|
||||
-#define ocl_open dlopen( "libOpenCL.so", RTLD_NOW )
|
||||
+#define ocl_open dlopen( "libOpenCL.so.1", RTLD_NOW )
|
||||
#endif
|
||||
#define ocl_close dlclose
|
||||
#define ocl_address dlsym
|
||||
37
x264-snapshot.sh
Normal file
37
x264-snapshot.sh
Normal file
@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
tmp=$(mktemp -d)
|
||||
|
||||
trap cleanup EXIT
|
||||
cleanup() {
|
||||
set +e
|
||||
[ -z "$tmp" -o ! -d "$tmp" ] || rm -rf "$tmp"
|
||||
}
|
||||
|
||||
unset CDPATH
|
||||
pwd=$(pwd)
|
||||
package=x264
|
||||
branch=stable
|
||||
commit=HEAD
|
||||
|
||||
pushd "$tmp"
|
||||
git clone https://code.videolan.org/videolan/x264.git -b ${branch}
|
||||
|
||||
cd ${package}
|
||||
tag=$(git rev-list HEAD -n 1 | cut -c 1-7)
|
||||
git checkout ${commit}
|
||||
git checkout -b rpmfusion
|
||||
./version.sh > version.h
|
||||
API="$(grep '#define X264_BUILD' < x264.h | sed 's/^.* \([1-9][0-9]*\).*$/\1/')"
|
||||
date=$(git log -1 --format=%cd --date=short | tr -d \-)
|
||||
git add version.h
|
||||
git commit -m "generated version.h" version.h
|
||||
git archive --prefix="${package}-0.$API-${date}-${tag}/" --format=tar rpmfusion | bzip2 > "$pwd"/${package}-0.$API-${date}-${tag}.tar.bz2
|
||||
popd >/dev/null
|
||||
|
||||
echo \# globals for x264-0.$API-$date-$tag.tar.bz2
|
||||
echo %global api $API
|
||||
echo %global gitdate ${date}
|
||||
echo %global gitversion ${tag}
|
||||
211
x264.spec
Normal file
211
x264.spec
Normal file
@ -0,0 +1,211 @@
|
||||
# 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.
|
||||
Loading…
x
Reference in New Issue
Block a user