2022-11-11 18:15:45 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
SCRIPT_REPO="https://github.com/xiph/opus.git"
|
2026-05-28 10:55:08 +08:00
|
|
|
SCRIPT_COMMIT="788cc89ce4f2c42025d8c70ec1b4457dc89cd50f"
|
2022-11-11 18:15:45 +08:00
|
|
|
|
|
|
|
|
ffbuild_enabled() {
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ffbuild_dockerbuild() {
|
|
|
|
|
git-mini-clone "$SCRIPT_REPO" "$SCRIPT_COMMIT" opus
|
|
|
|
|
cd opus
|
|
|
|
|
|
|
|
|
|
./autogen.sh
|
|
|
|
|
|
|
|
|
|
local myconf=(
|
|
|
|
|
--prefix="$FFBUILD_PREFIX"
|
|
|
|
|
--disable-shared
|
|
|
|
|
--enable-static
|
|
|
|
|
--disable-extra-programs
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if [[ $TARGET == win* || $TARGET == linux* ]]; then
|
|
|
|
|
myconf+=(
|
|
|
|
|
--host="$FFBUILD_TOOLCHAIN"
|
|
|
|
|
)
|
2024-02-24 00:07:11 +08:00
|
|
|
elif [[ $TARGET == mac* ]]; then
|
|
|
|
|
:
|
2022-11-11 18:15:45 +08:00
|
|
|
else
|
|
|
|
|
echo "Unknown target"
|
|
|
|
|
return -1
|
|
|
|
|
fi
|
|
|
|
|
|
2024-12-20 15:13:59 +08:00
|
|
|
if [[ $TARGET == linux* || $TARGET == mac* ]] && [[ $TARGET == *arm64 ]]; then
|
|
|
|
|
myconf+=(
|
|
|
|
|
--with-NE10-libraries="$FFBUILD_PREFIX"/lib
|
|
|
|
|
--with-NE10-includes="$FFBUILD_PREFIX"/include/libNE10
|
|
|
|
|
)
|
|
|
|
|
fi
|
|
|
|
|
|
2024-12-21 20:27:39 +08:00
|
|
|
# Override previously set -O(n) option and the CC's default optimization options.
|
2024-12-21 19:47:17 +08:00
|
|
|
CFLAGS="$CFLAGS -O3" ./configure "${myconf[@]}"
|
2022-11-11 18:15:45 +08:00
|
|
|
make -j$(nproc)
|
|
|
|
|
make install
|
2024-12-20 15:13:59 +08:00
|
|
|
|
|
|
|
|
if [[ $TARGET == *arm64 ]]; then
|
|
|
|
|
if [[ $TARGET == mac* ]]; then
|
2024-12-21 20:27:39 +08:00
|
|
|
gsed -i 's/-lopus/-lopus -lNE10/' "$FFBUILD_PREFIX"/lib/pkgconfig/opus.pc
|
|
|
|
|
gsed -i 's/-I${includedir}\/opus/-I${includedir}\/opus -I${includedir}\/libNE10/' "$FFBUILD_PREFIX"/lib/pkgconfig/opus.pc
|
|
|
|
|
else
|
|
|
|
|
sed -i 's/-lopus/-lopus -lNE10/' "$FFBUILD_PREFIX"/lib/pkgconfig/opus.pc
|
|
|
|
|
sed -i 's/-I${includedir}\/opus/-I${includedir}\/opus -I${includedir}\/libNE10/' "$FFBUILD_PREFIX"/lib/pkgconfig/opus.pc
|
|
|
|
|
fi
|
2024-12-20 15:13:59 +08:00
|
|
|
fi
|
2022-11-11 18:15:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ffbuild_configure() {
|
|
|
|
|
echo --enable-libopus
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ffbuild_unconfigure() {
|
|
|
|
|
echo --disable-libopus
|
|
|
|
|
}
|