diff --git a/.ci/build-wheels.sh b/.ci/build-wheels.sh index fef148c..e999bc9 100755 --- a/.ci/build-wheels.sh +++ b/.ci/build-wheels.sh @@ -84,7 +84,11 @@ make install cd ~/ffmpeg_sources curl -sLO "https://bitbucket.org/multicoreware/x265_git/downloads/x265_$X265_VERSION.tar.gz" tar xzf "x265_$X265_VERSION.tar.gz" -cd x265_*/build/linux +cd x265_*/ +# Backport patches to fix build on cmake >4.0.0 +patch -p1 < /io/.ci/x265_b354c009a60bcd6d7fc04014e200a1ee9c45c167.patch +patch -p1 < /io/.ci/x265_51ae8e922bcc4586ad4710812072289af91492a8.patch +cd build/linux cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$BUILD_DIR" -DENABLE_SHARED:bool=on ../../source make make install diff --git a/.ci/build_wheels_osx.sh b/.ci/build_wheels_osx.sh index 7002f7a..83bd15e 100644 --- a/.ci/build_wheels_osx.sh +++ b/.ci/build_wheels_osx.sh @@ -82,7 +82,7 @@ tar xzf "v$BROTLI_VERSION.tar.gz" cd "brotli-$BROTLI_VERSION" mkdir out cd out -cmake -DCMAKE_INSTALL_PREFIX="$BUILD_PATH" -DCMAKE_OSX_ARCHITECTURES="$ARCH" -DCMAKE_BUILD_TYPE=Release .. +cmake -DCMAKE_INSTALL_PREFIX="$BUILD_PATH" -DCMAKE_OSX_ARCHITECTURES="$ARCH" -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM=3.5 .. cmake --build . --config Release --target install @@ -197,6 +197,9 @@ make install cd "$SRC_PATH" git clone https://bitbucket.org/multicoreware/x265_git.git --depth 1 --branch "Release_$X265_VERSION" cd x265_git +# Backport patches to fix build on cmake >4.0.0 +patch -p1 < "$base_dir/.ci/x265_b354c009a60bcd6d7fc04014e200a1ee9c45c167.patch" +patch -p1 < "$base_dir/.ci/x265_51ae8e922bcc4586ad4710812072289af91492a8.patch" if [ "$ARCH" = "arm64" ]; then patch -p1 < "$base_dir/.ci/apple_arm64_x265.patch" cd source @@ -257,11 +260,8 @@ tar xzvf "libtheora-$LIBTHEORA_VERSION.tar.gz" cd "libtheora-$LIBTHEORA_VERSION" # https://bugs.gentoo.org/465450 sed -i "" 's/png_\(sizeof\)/\1/g' examples/png2theora.c -THEORA_ARCH=$ARCH -if [ "$ARCH" = "arm64" ]; then - THEORA_ARCH=arm -fi -./configure --prefix="$BUILD_PATH" --enable-shared --host=$THEORA_ARCH-darwin +THEORA_ARCH=$ARCH2 +./configure --prefix="$BUILD_PATH" --enable-shared --host=$THEORA_ARCH-apple-darwin make make install diff --git a/.ci/dep_versions.sh b/.ci/dep_versions.sh index 9c281b0..e7cb613 100644 --- a/.ci/dep_versions.sh +++ b/.ci/dep_versions.sh @@ -13,7 +13,7 @@ export X265_VERSION=3.5 # https://bitbucket.org/multicoreware/x265_git/download export FDK_VERSION=2.0.2 # https://github.com/mstorsjo/fdk-aac export OPUS_VERSION=1.3.1 # https://archive.mozilla.org/pub/opus/ export LIBOGG_VERSION=1.3.5 # http://downloads.xiph.org/releases/ogg/ -export LIBTHEORA_VERSION=1.1.1 # https://ftp.osuosl.org/pub/xiph/releases/theora/ +export LIBTHEORA_VERSION=1.2.0 # https://ftp.osuosl.org/pub/xiph/releases/theora/ export LIBVORBIS_VERSION=1.3.7 # http://downloads.xiph.org/releases/vorbis export LIBVPX_VERSION=1.14.1 # https://chromium.googlesource.com/webm/libvpx export XZ_VERSION=5.4.1 # https://tukaani.org/xz/ diff --git a/.ci/x265_51ae8e922bcc4586ad4710812072289af91492a8.patch b/.ci/x265_51ae8e922bcc4586ad4710812072289af91492a8.patch new file mode 100644 index 0000000..8d21b0a --- /dev/null +++ b/.ci/x265_51ae8e922bcc4586ad4710812072289af91492a8.patch @@ -0,0 +1,57 @@ +From 51ae8e922bcc4586ad4710812072289af91492a8 Mon Sep 17 00:00:00 2001 +From: yaswanthsastry +Date: Mon, 7 Apr 2025 11:27:36 +0530 +Subject: [PATCH] Fix for CMake Build Errors in MacOS + +--- + source/CMakeLists.txt | 15 +++++++-------- + 1 file changed, 7 insertions(+), 8 deletions(-) + +diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt +index 4f5b3ed82..7183fd3ce 100755 +--- a/source/CMakeLists.txt ++++ b/source/CMakeLists.txt +@@ -6,18 +6,14 @@ if(NOT CMAKE_BUILD_TYPE) + FORCE) + endif() + message(STATUS "cmake version ${CMAKE_VERSION}") +-if(POLICY CMP0025) +- cmake_policy(SET CMP0025 NEW) # report Apple's Clang as just Clang +-endif() ++ + if(POLICY CMP0042) + cmake_policy(SET CMP0042 NEW) # MACOSX_RPATH + endif() +-if(POLICY CMP0054) +- cmake_policy(SET CMP0054 NEW) # Only interpret if() arguments as variables or keywords when unquoted +-endif() ++ + + project (x265) +-cmake_minimum_required (VERSION 2.8.8) # OBJECT libraries require 2.8.8 ++cmake_minimum_required (VERSION 2.8.8...3.10) # OBJECT libraries require 2.8.8 + include(CheckIncludeFiles) + include(CheckFunctionExists) + include(CheckSymbolExists) +@@ -168,7 +164,7 @@ if(APPLE) + add_definitions(-DMACOS=1) + endif() + +-if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") ++if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang") + set(CLANG 1) + endif() + if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel") +@@ -740,6 +736,9 @@ if((MSVC_IDE OR XCODE OR GCC) AND ENABLE_ASSEMBLY) + if(ARM OR CROSS_COMPILE_ARM) + # compile ARM arch asm files here + enable_language(ASM) ++ if(APPLE) ++ set(ARM_ARGS ${ARM_ARGS} -arch ${CMAKE_OSX_ARCHITECTURES}) ++ endif() + foreach(ASM ${ARM_ASMS}) + set(ASM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/common/arm/${ASM}) + list(APPEND ASM_SRCS ${ASM_SRC}) +-- +2.49.0 + diff --git a/.ci/x265_b354c009a60bcd6d7fc04014e200a1ee9c45c167.patch b/.ci/x265_b354c009a60bcd6d7fc04014e200a1ee9c45c167.patch new file mode 100644 index 0000000..a46fe97 --- /dev/null +++ b/.ci/x265_b354c009a60bcd6d7fc04014e200a1ee9c45c167.patch @@ -0,0 +1,32 @@ +From b354c009a60bcd6d7fc04014e200a1ee9c45c167 Mon Sep 17 00:00:00 2001 +From: yaswanthsastry +Date: Mon, 24 Feb 2025 17:07:03 +0530 +Subject: [PATCH] Fix CMake build error with latest CMake 4.0 release + +--- + source/CMakeLists.txt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt +index 37dbe1a87..4f5b3ed82 100755 +--- a/source/CMakeLists.txt ++++ b/source/CMakeLists.txt +@@ -7,13 +7,13 @@ if(NOT CMAKE_BUILD_TYPE) + endif() + message(STATUS "cmake version ${CMAKE_VERSION}") + if(POLICY CMP0025) +- cmake_policy(SET CMP0025 OLD) # report Apple's Clang as just Clang ++ cmake_policy(SET CMP0025 NEW) # report Apple's Clang as just Clang + endif() + if(POLICY CMP0042) + cmake_policy(SET CMP0042 NEW) # MACOSX_RPATH + endif() + if(POLICY CMP0054) +- cmake_policy(SET CMP0054 OLD) # Only interpret if() arguments as variables or keywords when unquoted ++ cmake_policy(SET CMP0054 NEW) # Only interpret if() arguments as variables or keywords when unquoted + endif() + + project (x265) +-- +2.49.0 + diff --git a/.ci/yum_deps.sh b/.ci/yum_deps.sh index e0e5673..788d833 100644 --- a/.ci/yum_deps.sh +++ b/.ci/yum_deps.sh @@ -8,4 +8,4 @@ pkgconfig zlib-devel enca-devel fontconfig-devel openssl openssl-devel wget open libpng libpng-devel libtiff libtiff-devel libwebp libwebp-devel dbus-devel dbus ibus-devel ibus libsamplerate-devel \ libsamplerate libmodplug-devel libmodplug flac-devel flac \ libjpeg-turbo-devel libjpeg-turbo pulseaudio pulseaudio-libs-devel alsa-lib alsa-lib-devel ca-certificates perl-devel \ -perl perl-IPC-Cmd +perl perl-IPC-Cmd patch diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 2183640..e9b659b 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -121,7 +121,12 @@ jobs: } linux_test_src: - runs-on: ubuntu-latest + strategy: + matrix: + include: + - os: ubuntu-latest + - os: ubuntu-24.04-arm + runs-on: ${{ matrix.os }} needs: windows_wheels_tests steps: - uses: actions/checkout@v4.2.2 @@ -156,7 +161,12 @@ jobs: pytest "$name/tests" linux_test_wheel: - runs-on: ubuntu-latest + strategy: + matrix: + include: + - os: ubuntu-latest + - os: ubuntu-24.04-arm + runs-on: ${{ matrix.os }} needs: linux_wheels steps: - uses: actions/checkout@v4.2.2 @@ -194,21 +204,22 @@ jobs: CIBW_BEFORE_ALL_LINUX: > cp -r `pwd`/ffmpeg_build $HOME/ffmpeg_build && source .ci/yum_deps.sh - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-latest ] - cibw_archs: [ x86_64 ] - cibw_build: [ 'cp39-manylinux_x86_64 cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64 cp313-manylinux_x86_64' ] + include: + - os: ubuntu-latest + cibw_archs: 'x86_64' + cibw_build: 'cp39-manylinux_x86_64 cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64 cp313-manylinux_x86_64' + - os: ubuntu-24.04-arm + cibw_archs: 'aarch64' + cibw_build: 'cp39-manylinux_aarch64 cp310-manylinux_aarch64 cp311-manylinux_aarch64 cp312-manylinux_aarch64 cp313-manylinux_aarch64' steps: - uses: actions/checkout@v4.2.2 - name: Set up Python 3.x uses: actions/setup-python@v5.4.0 with: python-version: 3.x - - name: Set up QEMU - if: ${{ matrix.cibw_archs == 'aarch64' }} - uses: docker/setup-qemu-action@v3.6.0 - uses: actions/cache@v4.2.3 id: deps-cache with: @@ -221,7 +232,7 @@ jobs: docker run --rm -v `pwd`:/io:rw quay.io/pypa/manylinux2014_${{ matrix.cibw_archs }} /io/.ci/build-wheels.sh - name: Install cibuildwheel run: | - python -m pip install cibuildwheel~=2.20.0 + python -m pip install cibuildwheel~=2.23.3 - name: Make wheels run: | python -m cibuildwheel --output-dir dist @@ -279,7 +290,7 @@ jobs: - name: Install cibuildwheel run: | - python -m pip install cibuildwheel~=2.20.0 + python -m pip install cibuildwheel~=2.23.3 - name: Build wheels run: | export REPAIR_LIBRARY_PATH="$HOME/${{ env.FFMPEG_BUILD_PATH }}_${{ matrix.arch }}/lib"