Install_speex.sh - moved download to fetch_submodule.sh

This commit is contained in:
Martin Pulec
2021-02-24 11:53:13 +01:00
parent 3b57ae4203
commit 04bb45e3c6
3 changed files with 50 additions and 27 deletions

View File

@@ -12,7 +12,7 @@ ORIGDIR=`pwd`
cd $srcdir
. ./data/scripts/add_cl_if_not_present.sh # add --with-cuda-host-compiler=<cl> to current params (Win)
. ./data/scripts/install_speex.sh
./data/scripts/install_speex.sh
# install config.guess config.sub install-sh missing
echo "Running automake..."

View File

@@ -0,0 +1,41 @@
## fetches a submodule
##
## @param $1 name
## @param $2 fallback Gzip URL
## @param $3 fallback Git URL
## @retval 1 submodule was updated
fetch_submodule() {
MODULE=$1
FALLBACK_URL=$2
FALLBACK_GIT_URL=$3
SUBMODULE_UPDATED= # assume that submodule have not been updated
printf "Downloading ${MODULE}... "
if ! command -v git >/dev/null; then
if [ ! -d ext-deps/$MODULE ]; then
echo "git not found - trying to download a release"
mkdir -p ext-deps/tmp
curl -L $FALLBACK_URL | tar -C ext-deps/tmp -xz
mv ext-deps/tmp/* ext-deps/$MODULE
rmdir ext-deps/tmp
else
echo "skipped (ext-deps/$MODULE is already present)"
fi
elif ! git branch >/dev/null 2>&1; then
# we are not in UltraGrid git repository but can use git to download
if [ ! -d ext-deps/$MODULE ]; then
echo "git submodule found - trying to clone"
git clone $FALLBACK_GIT_URL ext-deps/$MODULE
else
echo "skipped (ext-deps/$MODULE is already present)"
fi
else
SUBMODULE_UPDATED=`git submodule update --init ext-deps/$module`
if [ -z "$SUBMODULE_UPDATED" ]; then
echo "not needed"
return 0
fi
return 1
fi
return 0
}

34
data/scripts/install_speex.sh Normal file → Executable file
View File

@@ -1,38 +1,20 @@
#!/bin/sh -eu
## Install speex and speexdsp
##
## Normally try to use git submodules present in the repository. If not possible
## it tries to either clone (.git directory stripped) or to download release
## (if git not found).
. $(dirname $0)/fetch_submodule.sh
for module in speex speexdsp; do
SUBMODULE_UPDATED= # assume that submodule have not been updated
printf "Downloading ${module}... "
if ! command -v git >/dev/null; then
if [ ! -d ext-deps/$module ]; then
echo "git not found - trying to download a release"
mkdir -p ext-deps
curl -L http://downloads.us.xiph.org/releases/speex/${module}-1.2.0.tar.gz | tar -C ext-deps -xz
mv ext-deps/speex*-1.2.0 ext-deps/$module
else
echo "skipped (ext-deps/$module is already present)"
fi
elif ! git branch >/dev/null 2>&1; then
# we are not in UltraGrid git repository but can use git to download
if [ ! -d ext-deps/$module ]; then
echo "git submodule found - trying to clone"
git clone https://gitlab.xiph.org/xiph/$module ext-deps/$module
else
echo "skipped (ext-deps/$module is already present)"
fi
else
SUBMODULSE_UPDATED=`git submodule update --init ext-deps/$module`
if [ -z "$SUBMODULE_UPDATED" ]; then
echo "not needed"
fi
fi
set +e
fetch_submodule $module http://downloads.us.xiph.org/releases/speex/${module}-1.2.0.tar.gz https://gitlab.xiph.org/xiph/$module
[ $? = 1 ] && SUBMODULE_UPDATED=yes || SUBMODULE_UPDATED=no
set -e
printf "Configuring ${module}... "
if [ -f ext-deps/$module/include/speex/${module}_config_types.h -a -z "$SUBMODULE_UPDATED" ]; then
if [ -f ext-deps/$module/include/speex/${module}_config_types.h -a $SUBMODULE_UPDATED = no ]; then
echo "not needed"
else
cd ext-deps/$module