From 61364efc0524a28d5ba3bf4798fc9aaec33e7896 Mon Sep 17 00:00:00 2001 From: Toshaan Bharvani Date: Fri, 7 Oct 2022 18:08:47 +0200 Subject: [PATCH] initial package creation Signed-off-by: Toshaan Bharvani --- SOURCES/x265-arm-cflags.patch | 63 +++++ SOURCES/x265-detect_cpu_armhfp.patch | 15 ++ SOURCES/x265-high-bit-depth-soname.patch | 31 +++ SOURCES/x265-pic.patch | 11 + SOURCES/x265-pkgconfig_path_fix.patch | 11 + SPECS/x265.spec | 318 +++++++++++++++++++++++ 6 files changed, 449 insertions(+) create mode 100644 SOURCES/x265-arm-cflags.patch create mode 100644 SOURCES/x265-detect_cpu_armhfp.patch create mode 100644 SOURCES/x265-high-bit-depth-soname.patch create mode 100644 SOURCES/x265-pic.patch create mode 100644 SOURCES/x265-pkgconfig_path_fix.patch create mode 100644 SPECS/x265.spec diff --git a/SOURCES/x265-arm-cflags.patch b/SOURCES/x265-arm-cflags.patch new file mode 100644 index 0000000..8cd5c86 --- /dev/null +++ b/SOURCES/x265-arm-cflags.patch @@ -0,0 +1,63 @@ +--- x265_3.4/source/CMakeLists.txt.cflags ++++ x265_3.4/source/CMakeLists.txt +@@ -238,28 +238,6 @@ + endif() + endif() + endif() +- if(ARM AND CROSS_COMPILE_ARM) +- if(ARM64) +- set(ARM_ARGS -fPIC) +- else() +- set(ARM_ARGS -march=armv6 -mfloat-abi=soft -mfpu=vfp -marm -fPIC) +- endif() +- message(STATUS "cross compile arm") +- elseif(ARM) +- if(ARM64) +- set(ARM_ARGS -fPIC) +- add_definitions(-DHAVE_NEON) +- else() +- find_package(Neon) +- if(CPU_HAS_NEON) +- set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=neon -marm -fPIC) +- add_definitions(-DHAVE_NEON) +- else() +- set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=vfp -marm) +- endif() +- endif() +- endif() +- add_definitions(${ARM_ARGS}) + if(FPROFILE_GENERATE) + if(INTEL_CXX) + add_definitions(-prof-gen -prof-dir="${CMAKE_CURRENT_BINARY_DIR}") +@@ -546,7 +524,7 @@ + add_custom_command( + OUTPUT ${ASM}.${SUFFIX} + COMMAND ${CMAKE_CXX_COMPILER} +- ARGS ${ARM_ARGS} -c ${ASM_SRC} -o ${ASM}.${SUFFIX} ++ ARGS ${CFLAGS} -c ${ASM_SRC} -o ${ASM}.${SUFFIX} + DEPENDS ${ASM_SRC}) + endforeach() + elseif(X86) + +--- x265_3.4/source/dynamicHDR10/CMakeLists.txt.cflags ++++ x265_3.4/source/dynamicHDR10/CMakeLists.txt +@@ -42,18 +42,6 @@ + endif() + endif() + endif() +- if(ARM AND CROSS_COMPILE_ARM) +- set(ARM_ARGS -march=armv6 -mfloat-abi=soft -mfpu=vfp -marm -fPIC) +- elseif(ARM) +- find_package(Neon) +- if(CPU_HAS_NEON) +- set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=neon -marm -fPIC) +- add_definitions(-DHAVE_NEON) +- else() +- set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=vfp -marm) +- endif() +- endif() +- add_definitions(${ARM_ARGS}) + if(FPROFILE_GENERATE) + if(INTEL_CXX) + add_definitions(-prof-gen -prof-dir="${CMAKE_CURRENT_BINARY_DIR}") + diff --git a/SOURCES/x265-detect_cpu_armhfp.patch b/SOURCES/x265-detect_cpu_armhfp.patch new file mode 100644 index 0000000..797ad04 --- /dev/null +++ b/SOURCES/x265-detect_cpu_armhfp.patch @@ -0,0 +1,15 @@ +--- x265_v2.6/source/test/testharness.h.orig 2017-12-30 22:27:49.827620181 +0000 ++++ x265_v2.6/source/test/testharness.h 2017-12-30 22:30:53.239500941 +0000 +@@ -70,9 +70,10 @@ protected: + #include + #elif (!defined(__APPLE__) && (defined (__GNUC__) && (defined(__x86_64__) || defined(__i386__)))) + #include +-#elif ( !defined(__APPLE__) && defined (__GNUC__) && defined(__ARM_NEON__)) +-#include + #elif defined(__GNUC__) && (!defined(__clang__) || __clang_major__ < 4) ++#if ( !defined(__APPLE__) && defined(__ARM_NEON__)) ++#include ++#endif + /* fallback for older GCC/MinGW */ + static inline uint32_t __rdtsc(void) + { diff --git a/SOURCES/x265-high-bit-depth-soname.patch b/SOURCES/x265-high-bit-depth-soname.patch new file mode 100644 index 0000000..5b1e5ed --- /dev/null +++ b/SOURCES/x265-high-bit-depth-soname.patch @@ -0,0 +1,31 @@ +--- a/source/CMakeLists.txt ++++ b/source/CMakeLists.txt +@@ -611,7 +611,15 @@ + if(MSVC) + set_target_properties(x265-shared PROPERTIES OUTPUT_NAME libx265) + else() +- set_target_properties(x265-shared PROPERTIES OUTPUT_NAME x265) ++ if(HIGH_BIT_DEPTH) ++ if(MAIN12) ++ set_target_properties(x265-shared PROPERTIES OUTPUT_NAME x265_main12) ++ else() ++ set_target_properties(x265-shared PROPERTIES OUTPUT_NAME x265_main10) ++ endif() ++ else() ++ set_target_properties(x265-shared PROPERTIES OUTPUT_NAME x265) ++ endif(HIGH_BIT_DEPTH) + endif() + if(UNIX) + set_target_properties(x265-shared PROPERTIES VERSION ${X265_BUILD}) +--- a/source/encoder/api.cpp ++++ b/source/encoder/api.cpp +@@ -704,7 +704,7 @@ + #define ext ".dylib" + #else + #include +-#define ext ".so" ++#define ext ".so." xstr(X265_BUILD) + #endif + #if defined(__GNUC__) && __GNUC__ >= 8 + #pragma GCC diagnostic ignored "-Wcast-function-type" + diff --git a/SOURCES/x265-pic.patch b/SOURCES/x265-pic.patch new file mode 100644 index 0000000..a047ad1 --- /dev/null +++ b/SOURCES/x265-pic.patch @@ -0,0 +1,11 @@ +--- a/source/CMakeLists.txt ++++ b/source/CMakeLists.txt +@@ -212,7 +212,7 @@ + add_definitions(-std=gnu++98) + endif() + if(ENABLE_PIC) +- add_definitions(-fPIC) ++ add_definitions(-fPIC -DPIC) + endif(ENABLE_PIC) + if(NATIVE_BUILD) + if(INTEL_CXX) diff --git a/SOURCES/x265-pkgconfig_path_fix.patch b/SOURCES/x265-pkgconfig_path_fix.patch new file mode 100644 index 0000000..5d958f3 --- /dev/null +++ b/SOURCES/x265-pkgconfig_path_fix.patch @@ -0,0 +1,11 @@ +--- a/source/x265.pc.in ++++ b/source/x265.pc.in +@@ -1,6 +1,6 @@ + prefix=@CMAKE_INSTALL_PREFIX@ + exec_prefix=${prefix} +-libdir=${exec_prefix}/@LIB_INSTALL_DIR@ ++libdir=@LIB_INSTALL_DIR@ + includedir=${prefix}/include + + Name: @CMAKE_PROJECT_NAME@ + diff --git a/SPECS/x265.spec b/SPECS/x265.spec new file mode 100644 index 0000000..426dc22 --- /dev/null +++ b/SPECS/x265.spec @@ -0,0 +1,318 @@ +# Use old cmake macro +%global __cmake_in_source_build 1 + +%global _so_version 199 + +Summary: H.265/HEVC encoder +Name: x265 +Version: 3.5 +Release: 3%{?dist} +URL: http://x265.org/ +# source/Lib/TLibCommon - BSD +# source/Lib/TLibEncoder - BSD +# everything else - GPLv2+ +License: GPLv2+ and BSD +Source0: https://bitbucket.org/multicoreware/%{name}_git/downloads/%{name}_%{version}.tar.gz + +# fix building as PIC +Patch0: x265-pic.patch +Patch1: x265-high-bit-depth-soname.patch +Patch2: x265-detect_cpu_armhfp.patch +Patch3: x265-arm-cflags.patch +Patch4: x265-pkgconfig_path_fix.patch + +BuildRequires: gcc-c++ +BuildRequires: git +BuildRequires: cmake3 +%{?el7:BuildRequires: epel-rpm-macros} +BuildRequires: nasm +BuildRequires: ninja-build + +%ifnarch armv7hl armv7hnl s390 s390x +BuildRequires: numactl-devel +%endif + +%description +The primary objective of x265 is to become the best H.265/HEVC encoder +available anywhere, offering the highest compression efficiency and the highest +performance on a wide variety of hardware platforms. + +This package contains the command line encoder. + +%package libs +Summary: H.265/HEVC encoder library + +%description libs +The primary objective of x265 is to become the best H.265/HEVC encoder +available anywhere, offering the highest compression efficiency and the +highest performance on a wide variety of hardware platforms. + +This package contains the shared library. + +%package devel +Summary: H.265/HEVC encoder library development files +Requires: %{name}-libs%{?_isa} = %{version}-%{release} + +%description devel +The primary objective of x265 is to become the best H.265/HEVC encoder +available anywhere, offering the highest compression efficiency and the highest +performance on a wide variety of hardware platforms. + +This package contains the shared library development files. + +%prep +%autosetup -p1 -n %{name}_%{version} + +%build +# High depth libraries (from source/h265.h): +# If the requested bitDepth is not supported by the linked libx265, +# it will attempt to dynamically bind x265_api_get() from a shared +# library with an appropriate name: +# 8bit: libx265_main.so +# 10bit: libx265_main10.so + +build() { +%cmake3 -Wno-dev -G "Ninja" \ + -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON \ + -DCMAKE_SKIP_RPATH:BOOL=YES \ + -DENABLE_PIC:BOOL=ON \ + -DENABLE_SHARED=ON \ + -DENABLE_TESTS:BOOL=ON \ + -DCMAKE_ASM_NASM_FLAGS=-w-macro-params-legacy \ + $* \ + ../source +%cmake3_build +} + +# High depth 10/12 bit libraries are supported only on 64 bit. They require +# disabled AltiVec instructions for building on ppc64/ppc64le. +%ifarch x86_64 aarch64 ppc64 ppc64le +mkdir 10bit; pushd 10bit + build \ + -DENABLE_CLI=OFF \ + -DENABLE_ALTIVEC=OFF \ + -DHIGH_BIT_DEPTH=ON +popd + +mkdir 12bit; pushd 12bit + build \ + -DENABLE_CLI=OFF \ + -DENABLE_ALTIVEC=OFF \ + -DHIGH_BIT_DEPTH=ON \ + -DMAIN12=ON +popd +%endif + +# 8 bit base library + encoder +mkdir 8bit; pushd 8bit + build -DENABLE_HDR10_PLUS=YES +popd + +%install +for i in 8 10 12; do + if [ -d ${i}bit ]; then + pushd ${i}bit + %cmake3_install + # Remove unversioned library, should not be linked to + rm -f %{buildroot}%{_libdir}/libx265_main${i}.so + popd + fi +done + +find %{buildroot} -name "*.a" -delete + +%check +for i in 8 10 12; do + if [ -d ${i}bit ]; then + pushd ${i}bit + test/TestBench || : + popd + fi +done + +%ldconfig_scriptlets libs + +%files +%{_bindir}/x265 + +%files libs +%license COPYING +%{_libdir}/libhdr10plus.so +%{_libdir}/libx265.so.%{_so_version} +%ifarch x86_64 aarch64 ppc64 ppc64le +%{_libdir}/libx265_main10.so.%{_so_version} +%{_libdir}/libx265_main12.so.%{_so_version} +%endif + +%files devel +%doc doc/* +%{_includedir}/hdr10plus.h +%{_includedir}/x265.h +%{_includedir}/x265_config.h +%{_libdir}/libx265.so +%{_libdir}/pkgconfig/x265.pc + +%changelog +* Wed Feb 09 2022 RPM Fusion Release Engineering - 3.5-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Tue Aug 03 2021 RPM Fusion Release Engineering - 3.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Tue Apr 13 2021 Leigh Scott - 3.5-1 +- Update to 3.5 + +* Tue Mar 16 2021 Leigh Scott - 3.4-5 +- Enable HDR10+. + +* Thu Feb 04 2021 RPM Fusion Release Engineering - 3.4-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Wed Aug 19 2020 RPM Fusion Release Engineering - 3.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Thu Jul 23 2020 Leigh Scott - 3.4-2 +- Use old cmake macro + +* Sun May 31 2020 Leigh Scott - 3.4-1 +- Update to 3.4 + +* Wed Mar 11 2020 Nicolas Chauvet - 3.3-2 +- Rebuilt for i686 + +* Sun Feb 23 2020 Leigh Scott - 3.3-1 +- Update to 3.3 + +* Wed Feb 05 2020 RPM Fusion Release Engineering - 3.2.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Thu Nov 28 2019 Leigh Scott - 3.2.1-1 +- Update to 3.2.1 +- Switch upstream source url + +* Fri Aug 09 2019 RPM Fusion Release Engineering - 3.1.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Sun Aug 04 2019 Leigh Scott - 3.1.2-1 +- Update to 3.1.2 + +* Fri Jun 28 2019 Nicolas Chauvet - 3.1-1 +- Update to 3.1 +- Switch to github mirror + +* Tue Mar 05 2019 RPM Fusion Release Engineering - 3.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Thu Feb 28 2019 Leigh Scott - 3.0-1 +- Update to 3.0 + +* Sun Dec 30 2018 Leigh Scott - 2.9-3 +- Rebuild against newer nasm on el7 (rfbz #5128) + +* Wed Nov 21 2018 Antonio Trande - 2.9-2 +- Rebuild for ffmpeg-3.* on el7 + +* Sun Nov 18 2018 Leigh Scott - 2.9-1 +- Update to 2.9 + +* Thu Oct 04 2018 Sérgio Basto - 2.8-1 +- Update to 2.8 more 2 patches to fix builds on non-x86 and arm + https://bitbucket.org/multicoreware/x265/issues/404/28-fails-to-build-on-ppc64le-gnu-linux + https://bitbucket.org/multicoreware/x265/issues/406/arm-assembly-fail-to-compile-on-18 + +* Sun Aug 19 2018 Leigh Scott - 2.7-5 +- Rebuilt for Fedora 29 Mass Rebuild binutils issue + +* Fri Jul 27 2018 RPM Fusion Release Engineering - 2.7-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Sun Apr 08 2018 Leigh Scott - 2.7-3 +- Fix pkgconfig file (rfbz #4853) + +* Tue Feb 27 2018 Nicolas Chauvet - 2.7-2 +- Fix CFLAGS on ARM + +* Tue Feb 27 2018 Leigh Scott - 2.7-1 +- update to 2.7 +- Drop shared test patch as it causes nasm build to fail +- Fix scriptlets +- Use ninja to build + +* Sat Dec 30 2017 Sérgio Basto - 2.6-1 +- Update x265 to 2.6 + +* Mon Oct 16 2017 Leigh Scott - 2.5-1 +- update to 2.5 + +* Thu Aug 31 2017 RPM Fusion Release Engineering - 2.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Apr 29 2017 Leigh Scott - 2.4-1 +- update to 2.4 + +* Mon Apr 10 2017 Simone Caronni - 2.2-3 +- Use source from multicoreware website. +- Clean up SPEC file a bit (formatting, 80 char wide descriptions). +- Enable shared 10/12 bit libraries on 64 bit architectures. + +* Mon Mar 20 2017 RPM Fusion Release Engineering - 2.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Tue Jan 03 2017 Dominik Mierzejewski - 2.2-1 +- update to 2.2 +- spell out SO version in file list +- fix typo in patch + +* Mon Nov 07 2016 Sérgio Basto - 2.1-1 +- Update to 2.1 + +* Thu Aug 18 2016 Sérgio Basto - 1.9-3 +- Clean spec, Vascom patches series, rfbz #4199, add license tag + +* Tue Jul 19 2016 Dominik Mierzejewski - 1.9-2 +- use https for source URL +- enable NUMA support +- make sure Fedora compiler flags are used on ARM + +* Fri Apr 08 2016 Adrian Reber - 1.9-1 +- Update to 1.9 + +* Sun Oct 25 2015 Dominik Mierzejewski 1.8-2 +- fix building as PIC +- update SO version in file list + +* Sat Oct 24 2015 Nicolas Chauvet - 1.8-1 +- Update to 1.8 +- Avoid tests for now + +* Wed Apr 15 2015 Dominik Mierzejewski 1.6-1 +- update to 1.6 (ABI bump, rfbz#3593) +- release tarballs are now hosted on videolan.org +- drop obsolete patches + +* Thu Dec 18 2014 Dominik Mierzejewski 1.2-6 +- fix build on armv7l arch (partially fix rfbz#3361, patch by Nicolas Chauvet) +- don't run tests on ARM for now (rfbz#3361) + +* Sun Aug 17 2014 Dominik Mierzejewski 1.2-5 +- don't include contributor agreement in doc +- make sure /usr/share/doc/x265 is owned +- add a comment noting which files are BSD-licenced + +* Fri Aug 08 2014 Dominik Mierzejewski 1.2-4 +- don't create bogus soname (patch by Xavier) + +* Thu Jul 17 2014 Dominik Mierzejewski 1.2-3 +- fix tr call to remove DOS EOL +- build the library with -fPIC on arm and i686, too + +* Sun Jul 13 2014 Dominik Mierzejewski 1.2-2 +- use version in source URL +- update License tag +- fix EOL in drag-uncrustify.bat +- don't link test binaries with shared binary on x86 (segfault) + +* Thu Jul 10 2014 Dominik Mierzejewski 1.2-1 +- initial build +- fix pkgconfig file install location +- link test binaries with shared library