diff --git a/.github/workflows/wheels-dependencies.sh b/.github/workflows/wheels-dependencies.sh index ff8780aa5e9..8b69535b322 100755 --- a/.github/workflows/wheels-dependencies.sh +++ b/.github/workflows/wheels-dependencies.sh @@ -106,13 +106,43 @@ function build_libavif { python3 -m pip install meson ninja - curl https://sh.rustup.rs -sSf | sh -s -- -y - . "$HOME/.cargo/env" + if [[ -z "$IS_MACOS" ]] && [[ "$MB_ML_VER" == 2014 ]]; then + # This can be removed once Amazon 2 is EOL on 30 June 2025 + if [[ "$PLAT" == "aarch64" ]]; then + suffix="aarch64" + else + suffix="generic" + fi + + curl -sLo - \ + https://github.com/xiph/rav1e/releases/download/v$RAV1E_VERSION/librav1e-$RAV1E_VERSION-linux-$suffix.tar.gz \ + | tar -C $BUILD_PREFIX --exclude LICENSE --exclude '*.so' --exclude '*.dylib' -zxf - + + if [ -z "$IS_MACOS" ]; then + sed -i 's/-lgcc_s/-lgcc_eh/g' "${BUILD_PREFIX}/lib/pkgconfig/rav1e.pc" + fi + + # Force libavif to treat system rav1e as if it were local + mkdir -p /tmp/cmake/Modules + cat < /tmp/cmake/Modules/Findrav1e.cmake + add_library(rav1e::rav1e STATIC IMPORTED GLOBAL) + set_target_properties(rav1e::rav1e PROPERTIES + IMPORTED_LOCATION "$BUILD_PREFIX/lib/librav1e.a" + AVIF_LOCAL ON + INTERFACE_INCLUDE_DIRECTORIES "$BUILD_PREFIX/include/rav1e" + ) +EOF + + rav1e=SYSTEM + else + curl https://sh.rustup.rs -sSf | sh -s -- -y + . "$HOME/.cargo/env" + + if [ -z "$IS_ALPINE" ] && [ -z "$IS_MACOS" ]; then + yum install -y perl + fi - if [ -n "$IS_ALPINE" ]; then - apk add perl - elif [ -z "$IS_MACOS" ]; then - yum install -y perl + rav1e=LOCAL fi local out_dir=$(fetch_unpack https://github.com/AOMediaCodec/libavif/archive/refs/tags/v$LIBAVIF_VERSION.tar.gz libavif-$LIBAVIF_VERSION.tar.gz) @@ -124,7 +154,7 @@ function build_libavif { -DBUILD_SHARED_LIBS=OFF \ -DAVIF_LIBSHARPYUV=LOCAL \ -DAVIF_LIBYUV=LOCAL \ - -DAVIF_CODEC_RAV1E=LOCAL \ + -DAVIF_CODEC_RAV1E=$rav1e \ -DAVIF_CODEC_AOM=LOCAL \ -DAVIF_CODEC_DAV1D=LOCAL \ -DAVIF_CODEC_SVT=LOCAL \