117 lines
2.9 KiB
Bash
117 lines
2.9 KiB
Bash
#!/bin/bash
|
|
|
|
# ==============================================================
|
|
#
|
|
# Bash script to build a statically linked version of opus-tools based on:
|
|
# https://gist.github.com/guest271314/12a93ff775590867c0862be45fc71161
|
|
#
|
|
# Repos:
|
|
# https://gitlab.xiph.org/xiph/ogg.git
|
|
# https://gitlab.xiph.org/xiph/flac.git
|
|
# https://gitlab.xiph.org/xiph/opus.git
|
|
# https://gitlab.xiph.org/xiph/libopusenc.git
|
|
# https://gitlab.xiph.org/xiph/opusfile.git
|
|
# https://gitlab.xiph.org/xiph/opus-tools.git
|
|
#
|
|
# Build deps: autoconf automake libtool pkg-config git
|
|
#
|
|
# ==============================================================
|
|
|
|
export BUILD_DIR="$(pwd)/build"
|
|
export PKG_CONFIG_PATH="$BUILD_DIR/lib/pkgconfig"
|
|
XIPH=https://gitlab.xiph.org/xiph/
|
|
LIBS=(ogg flac opus libopusenc opusfile opus-tools)
|
|
|
|
echo 'Cloning git repositories...'
|
|
for repo in "${LIBS[@]}"
|
|
do
|
|
git clone --depth 1 "$XIPH$repo.git"
|
|
done
|
|
|
|
mkdir -p "$BUILD_DIR"
|
|
|
|
echo 'Building libogg...'
|
|
cd "${LIBS[0]}" || exit
|
|
./autogen.sh
|
|
./configure --prefix="$BUILD_DIR" \
|
|
--disable-shared --enable-static \
|
|
--disable-maintainer-mode
|
|
make clean
|
|
make -j "$(nproc)" install
|
|
cd ..
|
|
|
|
echo 'Building FLAC...'
|
|
cd "${LIBS[1]}" || exit
|
|
./autogen.sh
|
|
./configure --prefix="$BUILD_DIR" \
|
|
--disable-shared --enable-static \
|
|
--disable-debug \
|
|
--disable-oggtest \
|
|
--disable-cpplibs \
|
|
--disable-xmms-plugin \
|
|
--disable-doxygen-docs \
|
|
--disable-examples
|
|
make clean
|
|
make -j "$(nproc)" install
|
|
cd ..
|
|
|
|
echo 'Building Opus...'
|
|
cd "${LIBS[2]}" || exit
|
|
./autogen.sh
|
|
./configure --prefix="$BUILD_DIR" \
|
|
--disable-shared --enable-static \
|
|
--disable-maintainer-mode \
|
|
--disable-doc \
|
|
--disable-extra-programs
|
|
make clean
|
|
make -j "$(nproc)" install
|
|
# Hack
|
|
sed -i 's/Version: unknown/Version: 1.3.1/' "$PKG_CONFIG_PATH/opus.pc"
|
|
cd ..
|
|
|
|
echo 'Building libopusenc...'
|
|
cd "${LIBS[3]}" || exit
|
|
./autogen.sh
|
|
./configure --prefix="$BUILD_DIR" \
|
|
--disable-shared --enable-static \
|
|
--disable-maintainer-mode \
|
|
--disable-examples \
|
|
--disable-doc
|
|
make clean
|
|
make -j "$(nproc)" install
|
|
# Hack
|
|
sed -i 's/Version: unknown/Version: 0.2.1/' "$PKG_CONFIG_PATH/libopusenc.pc"
|
|
cd ..
|
|
|
|
echo 'Building opusfile...'
|
|
cd "${LIBS[4]}" || exit
|
|
./autogen.sh
|
|
./configure --prefix="$BUILD_DIR" \
|
|
--disable-shared --enable-static \
|
|
--disable-maintainer-mode \
|
|
--disable-examples \
|
|
--disable-doc \
|
|
--disable-http
|
|
make clean
|
|
make -j "$(nproc)" install
|
|
# Hack
|
|
sed -i 's/Version: unknown/Version: 0.12/' "$PKG_CONFIG_PATH/opusfile.pc"
|
|
sed -i 's/Version: unknown/Version: 0.12/' "$PKG_CONFIG_PATH/opusurl.pc"
|
|
cd ..
|
|
|
|
echo 'Building opus-tools...'
|
|
cd "${LIBS[5]}" || exit
|
|
./autogen.sh
|
|
./configure --prefix="$BUILD_DIR" \
|
|
--disable-shared --enable-static \
|
|
--disable-maintainer-mode
|
|
make clean
|
|
make -j "$(nproc)" install || exit
|
|
cd ..
|
|
|
|
for file in "$BUILD_DIR"/bin/opus*
|
|
do
|
|
cp "$file" "$PWD/$(basename "$file")-static"
|
|
strip --strip-debug "$PWD/$(basename "$file")-static"
|
|
done
|