From ae143a49120541ad92bff1720a3f607e7a4ccdf4 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Sun, 13 Jul 2025 21:31:43 +0100 Subject: [PATCH] Add a script for updating 3rd party libraries --- misc/update-libs.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 misc/update-libs.sh diff --git a/misc/update-libs.sh b/misc/update-libs.sh new file mode 100755 index 00000000..bd9b4c57 --- /dev/null +++ b/misc/update-libs.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)" +CODE="${ROOT}/code" + +prepare() +{ + local URL="$1" + shift + local EXCLUDE_PATTERNS=("$@") + local FILENAME=$(basename ${URL}) + local BASENAME="${FILENAME%.tar.gz}" + local DIR="${CODE}/${BASENAME}" + + local EXCLUDE_ARGS= + for EXCLUDE_PATTERN in "${EXCLUDE_PATTERNS[@]}"; do + EXCLUDE_ARGS+=" -not -regex ${EXCLUDE_PATTERN}" + done + + echo ${BASENAME} + curl -L "${URL}" | tar -xz -C "${CODE}" + ( + cd ${DIR} + [ -f ./configure ] && ./configure + find . -type f ${EXCLUDE_ARGS[@]} -delete + find . -type d -empty -delete + ) +} + +prepare "https://downloads.xiph.org/releases/ogg/libogg-1.3.6.tar.gz" "\./\(include\|src\)/.*\.[ch]" +prepare "https://downloads.xiph.org/releases/vorbis/libvorbis-1.3.7.tar.gz" "\./\(include\|lib\)/.*\.[ch]" +prepare "https://downloads.xiph.org/releases/opus/opus-1.5.2.tar.gz" "\./\(celt\|include\|silk\|src\)/.*\.[ch]" +prepare "https://downloads.xiph.org/releases/opus/opusfile-0.12.tar.gz" "\./\(include\|src\)/.*\.[ch]"