Skip to content

Commit

Permalink
fixup2
Browse files Browse the repository at this point in the history
  • Loading branch information
fdintino committed Aug 14, 2024
1 parent 50645c4 commit 5f11402
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/wheels-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ EOF

function build_libavif {
install_rav1e
$PYTHON_EXE -m pip install meson
python -m pip install meson ninja

if [[ "$CIBW_ARCHS" != "arm64" ]]; then
build_simple nasm 2.15.05 https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/
Expand Down
48 changes: 15 additions & 33 deletions depends/install_libavif.sh
Original file line number Diff line number Diff line change
@@ -1,77 +1,59 @@
#!/usr/bin/env bash
set -eo pipefail

LIBAVIF_VERSION=${LIBAVIF_VERSION:-12e066686892df1c8201cfb0d8d6c68ad248c872}
version=1.1.1

LIBAVIF_CMAKE_FLAGS=()
./download-and-extract.sh libavif-$version https://github.com/AOMediaCodec/libavif/archive/refs/tags/v$version.tar.gz

pushd libavif-$version

if uname -s | grep -q Darwin; then
PREFIX=/usr/local
PREFIX=$(brew --prefix)
else
PREFIX=/usr
fi

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

PKGCONFIG=${PKGCONFIG:-pkg-config}

mkdir -p libavif-$LIBAVIF_VERSION
curl -sLo - \
https://github.com/AOMediaCodec/libavif/archive/$LIBAVIF_VERSION.tar.gz \
| tar --strip-components=1 -C libavif-$LIBAVIF_VERSION -zxf -
pushd libavif-$LIBAVIF_VERSION

LIBAVIF_CMAKE_FLAGS=()
HAS_DECODER=0
HAS_ENCODER=0

if $PKGCONFIG --exists dav1d; then
LIBAVIF_CMAKE_FLAGS+=(-DAVIF_CODEC_DAV1D=ON)
LIBAVIF_CMAKE_FLAGS+=(-DAVIF_CODEC_DAV1D=SYSTEM)
HAS_DECODER=1
fi

if $PKGCONFIG --exists rav1e; then
LIBAVIF_CMAKE_FLAGS+=(-DAVIF_CODEC_RAV1E=ON)
LIBAVIF_CMAKE_FLAGS+=(-DAVIF_CODEC_RAV1E=SYSTEM)
HAS_ENCODER=1
fi

if $PKGCONFIG --exists SvtAv1Enc; then
LIBAVIF_CMAKE_FLAGS+=(-DAVIF_CODEC_SVT=ON)
LIBAVIF_CMAKE_FLAGS+=(-DAVIF_CODEC_SVT=SYSTEM)
HAS_ENCODER=1
fi

if $PKGCONFIG --exists libgav1; then
LIBAVIF_CMAKE_FLAGS+=(-DAVIF_CODEC_LIBGAV1=ON)
LIBAVIF_CMAKE_FLAGS+=(-DAVIF_CODEC_LIBGAV1=SYSTEM)
HAS_DECODER=1
fi

if $PKGCONFIG --exists aom; then
LIBAVIF_CMAKE_FLAGS+=(-DAVIF_CODEC_AOM=ON)
LIBAVIF_CMAKE_FLAGS+=(-DAVIF_CODEC_AOM=SYSTEM)
HAS_ENCODER=1
HAS_DECODER=1
fi

if [ "$HAS_ENCODER" != 1 ] || [ "$HAS_DECODER" != 1 ]; then
pushd ext > /dev/null
bash aom.cmd
popd > /dev/null
LIBAVIF_CMAKE_FLAGS+=(-DAVIF_CODEC_AOM=ON -DAVIF_LOCAL_AOM=ON)
LIBAVIF_CMAKE_FLAGS+=(-DAVIF_CODEC_AOM=LOCAL)
fi

if uname -s | grep -q Darwin; then
# Prevent cmake from using @rpath in install id, so that delocate can
# find and bundle the libavif dylib
LIBAVIF_CMAKE_FLAGS+=("-DCMAKE_INSTALL_NAME_DIR=$PREFIX/lib" -DCMAKE_MACOSX_RPATH=OFF)
fi

mkdir build
pushd build
cmake .. \
cmake -S . -B build \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_INSTALL_NAME_DIR=$PREFIX/lib \
-DCMAKE_MACOSX_RPATH=OFF \
"${LIBAVIF_CMAKE_FLAGS[@]}"
make
make install || sudo make install
popd

popd

0 comments on commit 5f11402

Please sign in to comment.