1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

chore(CI): Handle build scripts called with relative paths with spaces

foo=dirname "$0" only works if the script is called with an absolute path and
that path contains no spaces. Add quotes everywhere to contain spaces in
directory names or file names, and add realpath to get the absolute path
regardless of call path.

Not necessarily needed, but like in e405868037
it can avoid some annoying issues when e.g. that script was called with a
relative path in CI.
This commit is contained in:
Anthony Bilinski 2022-03-05 03:25:45 -08:00
parent 3c7ee98bc1
commit 9bf17acca6
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
44 changed files with 58 additions and 55 deletions

View File

@ -5,7 +5,7 @@
set -euo pipefail
"$(dirname "$0")"/download/download_aitool.sh
"$(dirname "$(realpath "$0")")/download/download_aitool.sh"
cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=ON \
-DAPPIMAGEKIT_PACKAGE_DEBS=ON

View File

@ -28,7 +28,7 @@ if [ "$ARCH" != "win32" ] && [ "$ARCH" != "win64" ]; then
exit 1
fi
"$(dirname "$0")"/download/download_ffmpeg.sh
"$(dirname "$(realpath "$0")")/download/download_ffmpeg.sh"
if [ "${ARCH}" == "win64" ]; then
FFMPEG_ARCH="x86_64"

View File

@ -32,7 +32,7 @@ else
HOST="i686-w64-mingw32"
fi
"$(dirname $0)"/download/download_gdb.sh
"$(dirname "$(realpath "$0")")/download/download_gdb.sh"
CFLAGS="-O2 -g0" ./configure --host="${HOST}" \
--prefix="/windows" \

View File

@ -32,7 +32,7 @@ else
HOST="i686-w64-mingw32"
fi
"$(dirname $0)"/download/download_gmp.sh
"$(dirname "$(realpath "$0")")/download/download_gmp.sh"
# https://gmplib.org/list-archives/gmp-discuss/2020-July/006519.html
CC_FOR_BUILD=gcc CFLAGS="-O2 -g0" ./configure --host="${HOST}" \

View File

@ -17,7 +17,7 @@
set -euo pipefail
"$(dirname "$0")"/download/download_ldqt.sh
"$(dirname $(realpath "$0"))/download/download_ldqt.sh"
qmake
make -j $(nproc)

View File

@ -28,7 +28,7 @@ if [ "$ARCH" != "win32" ] && [ "$ARCH" != "win64" ]; then
exit 1
fi
"$(dirname $0)"/download/download_libexif.sh
"$(dirname "$(realpath "$0")")/download/download_libexif.sh"
if [ "${ARCH}" == "win64" ]; then
HOST="x86_64-w64-mingw32"

View File

@ -26,7 +26,7 @@ if [ "$ARCH" != "win32" ] && [ "$ARCH" != "win64" ]; then
exit 1
fi
"$(dirname $0)"/download/download_libexpat.sh
"$(dirname "$(realpath "$0")")/download/download_libexpat.sh"
if [ "${ARCH}" == "win64" ]; then
HOST="x86_64-w64-mingw32"

View File

@ -6,6 +6,6 @@
set -euo pipefail
"$(dirname "$0")"/download/download_mingw_ldd.sh
"$(dirname $(realpath "$0"))/download/download_mingw_ldd.sh"
cp -a mingw_ldd/mingw_ldd.py /usr/local/bin/mingw-ldd.py

View File

@ -5,7 +5,7 @@
set -euo pipefail
"$(dirname "$0")"/download/download_msgpack_c.sh
"$(dirname "$(realpath "$0")")/download/download_msgpack_c.sh"
cmake -DCMAKE_INSTALL_PREFIX=/windows/ \
-DCMAKE_BUILD_TYPE=Release \

View File

@ -6,6 +6,6 @@
set -euo pipefail
"$(dirname "$0")"/download/download_nsisshellexecasuser.sh
"$(dirname $(realpath "$0"))/download/download_nsisshellexecasuser.sh"
cp unicode/ShellExecAsUser.dll /usr/share/nsis/Plugins/x86-unicode

View File

@ -6,6 +6,8 @@
set -euo pipefail
readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
usage()
{
echo "Download and build openal for the windows cross compiling environment"
@ -28,9 +30,10 @@ if [ "$ARCH" != "win32" ] && [ "$ARCH" != "win64" ]; then
exit 1
fi
"$(dirname "$0")"/download/download_openal.sh
"${SCRIPT_DIR}/download/download_openal.sh"
patch -p1 < "${SCRIPT_DIR}/patches/openal-cmake-3-11.patch"
patch -p1 < "$(dirname "$0")"/patches/openal-cmake-3-11.patch
if [ "${ARCH}" == "win64" ]; then
MINGW_DIR="x86_64-w64-mingw32"

View File

@ -34,7 +34,7 @@ else
exit 1
fi
"$(dirname "$0")"/download/download_openssl.sh
"$(dirname "$(realpath "$0")")/download/download_openssl.sh"
./Configure --prefix=/windows/ \
--openssldir=/windows/ssl \

View File

@ -32,7 +32,7 @@ else
exit 1
fi
"$(dirname "$0")"/download/download_opus.sh
"$(dirname "$(realpath "$0")")/download/download_opus.sh"
LDFLAGS="-fstack-protector" CFLAGS="-O2 -g0" \
./configure --host="${HOST}" \

View File

@ -32,7 +32,7 @@ else
exit 1
fi
"$(dirname "$0")"/download/download_qrencode.sh
"$(dirname "$(realpath "$0")")/download/download_qrencode.sh"
CFLAGS="-O2 -g0" ./configure --host="${HOST}" \
--prefix=/windows \

View File

@ -32,7 +32,7 @@ else
exit 1
fi
"$(dirname "$0")"/download/download_qt.sh
"$(dirname "$(realpath "$0")")/download/download_qt.sh"
OPENSSL_LIBS=$(pkg-config --libs openssl)
export OPENSSL_LIBS

View File

@ -17,6 +17,8 @@
set -euo pipefail
readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
usage ()
{
echo "Build/install snore for linux"
@ -33,7 +35,7 @@ while (( $# > 0 )); do
esac
done
"$(dirname "$0")"/download/download_snore.sh
"${SCRIPT_DIR}/download/download_snore.sh"
# Snore needs to be installed into /usr for linuxdeployqt to find it
if [ $SYSTEM_INSTALL -eq 1 ]; then
@ -42,7 +44,7 @@ else
INSTALL_PREFIX_ARGS=""
fi
patch -Np1 < "$(dirname "$0")"/patches/snore.patch
patch -Np1 < "${SCRIPT_DIR}/patches/snore.patch"
cmake -DCMAKE_BUILD_TYPE=Release $INSTALL_PREFIX_ARGS \
-DBUILD_daemon=OFF \

View File

@ -6,7 +6,7 @@
set -euo pipefail
"$(dirname "$0")"/download/download_snore.sh
"$(dirname "$(realpath "$0")")/download/download_snore.sh"
cmake -DCMAKE_INSTALL_PREFIX=/windows/ \
-DCMAKE_BUILD_TYPE=Release \

View File

@ -32,7 +32,7 @@ else
exit 1
fi
"$(dirname "$0")"/download/download_sodium.sh
"$(dirname "$(realpath "$0")")/download/download_sodium.sh"
LDFLAGS="-fstack-protector" \
./configure --host="${HOST}" \

View File

@ -32,7 +32,7 @@ else
exit 1
fi
"$(dirname "$0")"/download/download_sqlcipher.sh
"$(dirname "$(realpath "$0")")/download/download_sqlcipher.sh"
sed -i s/'if test "$TARGET_EXEEXT" = ".exe"'/'if test ".exe" = ".exe"'/g configure
sed -i 's|exec $PWD/mksourceid manifest|exec $PWD/mksourceid.exe manifest|g' tool/mksqlite3h.tcl

View File

@ -6,13 +6,15 @@
set -euo pipefail
readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
build_toxcore() {
TOXCORE_SRC="$(realpath toxcore)"
mkdir -p "$TOXCORE_SRC"
pushd $TOXCORE_SRC >/dev/null || exit 1
"$(dirname "$0")"/download/download_toxcore.sh
"${SCRIPT_DIR}/download/download_toxcore.sh"
cmake -DCMAKE_INSTALL_PREFIX=/windows/ \
-DBOOTSTRAP_DAEMON=OFF \
@ -34,7 +36,7 @@ build_toxext() {
mkdir -p "$TOXEXT_SRC"
pushd $TOXEXT_SRC >/dev/null || exit 1
"$(dirname "$0")"/download/download_toxext.sh
"${SCRIPT_DIR}/download/download_toxext.sh"
cmake -DCMAKE_INSTALL_PREFIX=/windows/ \
-DCMAKE_BUILD_TYPE=Release \
@ -53,7 +55,7 @@ build_toxext_messages() {
mkdir -p "$TOXEXT_MESSAGES_SRC"
pushd $TOXEXT_MESSAGES_SRC > /dev/null || exit 1
"$(dirname "$0")"/download/download_toxext_messages.sh
"${SCRIPT_DIR}/download/download_toxext_messages.sh"
cmake -DCMAKE_INSTALL_PREFIX=/windows/ \
-DCMAKE_BUILD_TYPE=Release \

View File

@ -17,13 +17,13 @@
set -euo pipefail
SCRIPT_DIR=$(dirname $(realpath "$0"))
readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
build_toxcore() {
mkdir -p toxcore
pushd toxcore >/dev/null || exit 1
"$SCRIPT_DIR"/download/download_toxcore.sh
"${SCRIPT_DIR}/download/download_toxcore.sh"
cmake . \
-DBOOTSTRAP_DAEMON=OFF \
@ -40,7 +40,7 @@ build_toxext() {
mkdir -p toxext
pushd toxext >/dev/null || exit 1
"$SCRIPT_DIR"/download/download_toxext.sh
"${SCRIPT_DIR}/download/download_toxext.sh"
cmake . -DCMAKE_BUILD_TYPE=Release
cmake --build . -- -j$(nproc)
@ -53,7 +53,7 @@ build_toxext_messages() {
mkdir -p toxext_messages
pushd toxext_messages > /dev/null || exit 1
"$SCRIPT_DIR"/download/download_toxext_messages.sh
"${SCRIPT_DIR}/download/download_toxext_messages.sh"
cmake . -DCMAKE_BUILD_TYPE=Release
cmake --build . -- -j$(nproc)

View File

@ -40,7 +40,7 @@ else
exit 1
fi
"$(dirname "$0")"/download/download_vpx.sh
"$(dirname "$(realpath "$0")")/download/download_vpx.sh"
patch -Np1 < "$(dirname "$0")"/patches/vpx.patch

View File

@ -20,7 +20,7 @@ set -euo pipefail
FFMPEG_VERSION=4.4.1
FFMPEG_HASH=eadbad9e9ab30b25f5520fbfde99fae4a92a1ae3c0257a8d68569a4651e30e02
source "$(dirname $0)"/common.sh
source "$(dirname "$(realpath "$0")")/common.sh"
download_verify_extract_tarball \
"https://www.ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.xz" \

View File

@ -20,9 +20,8 @@ set -euo pipefail
GDB_VERSION="11.1"
GDB_HASH="cccfcc407b20d343fb320d4a9a2110776dd3165118ffd41f4b1b162340333f94"
source "$(dirname $0)"/common.sh
source "$(dirname "$(realpath "$0")")/common.sh"
download_verify_extract_tarball \
"http://ftp.gnu.org/gnu/gdb/gdb-${GDB_VERSION}.tar.xz" \
${GDB_HASH}

View File

@ -20,9 +20,8 @@ set -euo pipefail
GMP_VERSION=6.2.1
GMP_HASH=fd4829912cddd12f84181c3451cc752be224643e87fac497b69edddadc49b4f2
source "$(dirname $0)"/common.sh
source "$(dirname "$(realpath "$0")")/common.sh"
download_verify_extract_tarball \
"http://ftp.gnu.org/gnu/gmp/gmp-${GMP_VERSION}.tar.xz" \
"${GMP_HASH}"

View File

@ -20,7 +20,7 @@ set -euo pipefail
LINUXDEPLOYQT_VERSION=570ca2dcb16f59ce0a2721f780093db8037cc9e0
LINUXDEPLOYQT_HASH=d53496c349f540ce17ea42c508d85802db1c7c3571e1bf962ec4e95482ea938e
source "$(dirname $0)"/common.sh
source "$(dirname "$(realpath "$0")")/common.sh"
download_verify_extract_tarball \
"https://github.com/probonopd/linuxdeployqt/archive/${LINUXDEPLOYQT_VERSION}.tar.gz" \

View File

@ -20,7 +20,7 @@ set -euo pipefail
LIBEXIF_VERSION=0.6.24
LIBEXIF_HASH=d47564c433b733d83b6704c70477e0a4067811d184ec565258ac563d8223f6ae
source "$(dirname $0)"/common.sh
source "$(dirname "$(realpath "$0")")/common.sh"
download_verify_extract_tarball \
"https://github.com/libexif/libexif/releases/download/v${LIBEXIF_VERSION}/libexif-${LIBEXIF_VERSION}.tar.bz2" \

View File

@ -20,7 +20,7 @@ set -euo pipefail
EXPAT_VERSION="2.4.1"
EXPAT_HASH="cf032d0dba9b928636548e32b327a2d66b1aab63c4f4a13dd132c2d1d2f2fb6a"
source "$(dirname $0)"/common.sh
source "$(dirname "$(realpath "$0")")/common.sh"
download_verify_extract_tarball \
"https://github.com/libexpat/libexpat/releases/download/R_${EXPAT_VERSION//./_}/expat-${EXPAT_VERSION}.tar.xz" \

View File

@ -20,7 +20,7 @@ set -euo pipefail
MINGW_W64_DEBUG_SCRIPTS_VERSION="c6ae689137844d1a6fd9c1b9a071d3f82a44c593"
MINGW_W64_DEBUG_SCRIPTS_HASH="5916bf9e6691d4f7f1c233c8c3a2b9f3b1d1ad0f58ab951381da5ec856f5d021"
source "$(dirname $0)"/common.sh
source "$(dirname "$(realpath "$0")")/common.sh"
download_verify_extract_tarball \
"https://github.com/nurupo/mingw-w64-debug-scripts/archive/${MINGW_W64_DEBUG_SCRIPTS_VERSION}.tar.gz" \

View File

@ -20,7 +20,7 @@ set -euo pipefail
MINGW_LDD_VERSION=0.2.1
MINGW_LDD_HASH=60d34506d2f345e011b88de172ef312f37ca3ba87f3764f511061b69878ab204
source "$(dirname $0)"/common.sh
source "$(dirname "$(realpath "$0")")/common.sh"
download_verify_extract_tarball \
"https://github.com/nurupo/mingw-ldd/archive/v${MINGW_LDD_VERSION}.tar.gz" \

View File

@ -20,7 +20,7 @@ set -euo pipefail
MSGPACK_VERSION=c-4.0.0
MSGPACK_HASH=656ebe4566845e7bda9c097b625ba59ac72ddfd45df6017172d46d9ac7365aa3
source "$(dirname $0)"/common.sh
source "$(dirname "$(realpath "$0")")/common.sh"
download_verify_extract_tarball \
"https://github.com/msgpack/msgpack-c/archive/${MSGPACK_VERSION}.tar.gz" \

View File

@ -19,7 +19,7 @@ set -euo pipefail
NSISSHELLEXECASUSER_HASH=79bdd3e54a9ba9c30af85557b475d2322286f8726687f2e23afa772aac6049ab
source "$(dirname "$0")/common.sh"
source "$(dirname "$(realpath "$0")")/common.sh"
download_file https://nsis.sourceforge.io/mediawiki/images/1/1d/ShellExecAsUserUnicodeUpdate.zip

View File

@ -20,7 +20,7 @@ set -euo pipefail
OPENAL_VERSION=b80570bed017de60b67c6452264c634085c3b148
OPENAL_HASH=e9f6d37672e085d440ef8baeebb7d62fec1d152094c162e5edb33b191462bd78
source "$(dirname "$0")"/common.sh
source "$(dirname "$(realpath "$0")")/common.sh"
## We can stop using the fork once OpenAL-Soft gets loopback capture implemented:
## https://github.com/kcat/openal-soft/pull/421

View File

@ -20,7 +20,7 @@ set -euo pipefail
OPENSSL_VERSION=1.1.1l
OPENSSL_HASH=0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1
source "$(dirname "$0")"/common.sh
source "$(dirname "$(realpath "$0")")/common.sh"
download_verify_extract_tarball \
"https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz" \

View File

@ -21,7 +21,7 @@ OPUS_VERSION=1.3.1
# https://archive.mozilla.org/pub/opus/SHA256SUMS.txt
OPUS_HASH=65b58e1e25b2a114157014736a3d9dfeaad8d41be1c8179866f144a2fb44ff9d
source "$(dirname "$0")"/common.sh
source "$(dirname "$(realpath "$0")")/common.sh"
download_verify_extract_tarball \
"https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz" \

View File

@ -20,7 +20,7 @@ set -euo pipefail
QRENCODE_VERSION=4.1.1
QRENCODE_HASH=e455d9732f8041cf5b9c388e345a641fd15707860f928e94507b1961256a6923
source "$(dirname "$0")"/common.sh
source "$(dirname "$(realpath "$0")")/common.sh"
download_verify_extract_tarball \
"https://fukuchi.org/works/qrencode/qrencode-${QRENCODE_VERSION}.tar.bz2" \

View File

@ -22,7 +22,7 @@ QT_MINOR=12
QT_PATCH=12
QT_HASH=1979a3233f689cb8b3e2783917f8f98f6a2e1821a70815fb737f020cd4b6ab06
source "$(dirname "$0")"/common.sh
source "$(dirname "$(realpath "$0")")/common.sh"
download_verify_extract_tarball \
https://download.qt.io/official_releases/qt/${QT_MAJOR}.${QT_MINOR}/${QT_MAJOR}.${QT_MINOR}.${QT_PATCH}/single/qt-everywhere-src-${QT_MAJOR}.${QT_MINOR}.${QT_PATCH}.tar.xz \

View File

@ -20,7 +20,7 @@ set -euo pipefail
SNORE_VERSION=0.7.0
SNORE_HASH=2e3f5fbb80ab993f6149136cd9a14c2de66f48cabce550dead167a9448f5bed9
source "$(dirname "$0")"/common.sh
source "$(dirname "$(realpath "$0")")/common.sh"
download_verify_extract_tarball \
"https://github.com/KDE/snorenotify/archive/v${SNORE_VERSION}.tar.gz" \

View File

@ -20,7 +20,7 @@ set -euo pipefail
SODIUM_VERSION=1.0.18
SODIUM_HASH=6f504490b342a4f8a4c4a02fc9b866cbef8622d5df4e5452b46be121e46636c1
source "$(dirname "$0")"/common.sh
source "$(dirname "$(realpath "$0")")/common.sh"
download_verify_extract_tarball \
"https://download.libsodium.org/libsodium/releases/libsodium-${SODIUM_VERSION}.tar.gz" \

View File

@ -20,7 +20,7 @@ set -euo pipefail
SQLCIPHER_VERSION=4.5.0
SQLCIPHER_HASH=20c46a855c47d5a0a159fdcaa8491ec7bdbaa706a734ee52bc76188b929afb14
source "$(dirname "$0")"/common.sh
source "$(dirname "$(realpath "$0")")/common.sh"
download_verify_extract_tarball \
"https://github.com/sqlcipher/sqlcipher/archive/v${SQLCIPHER_VERSION}.tar.gz" \

View File

@ -20,7 +20,7 @@ set -euo pipefail
TOXCORE_VERSION=0.2.17
TOXCORE_HASH=d9cdf5d690fe8e217dcaba5b988fb943bbe7bda919a2fde6d9506df047e5f4cb
source "$(dirname "$0")"/common.sh
source "$(dirname "$(realpath "$0")")/common.sh"
download_verify_extract_tarball \
https://github.com/TokTok/c-toxcore/archive/v$TOXCORE_VERSION.tar.gz \

View File

@ -20,9 +20,8 @@ set -euo pipefail
TOXEXT_VERSION=0.0.3
TOXEXT_HASH=99cf215d261a07bd83eafd1c69dcf78018db605898350b6137f1fd8e7c54734a
source "$(dirname "$0")"/common.sh
source "$(dirname "$(realpath "$0")")/common.sh"
download_verify_extract_tarball \
https://github.com/toxext/toxext/archive/v$TOXEXT_VERSION.tar.gz \
"$TOXEXT_HASH"

View File

@ -20,9 +20,8 @@ set -euo pipefail
TOXEXT_MESSAGES_VERSION=0.0.3
TOXEXT_MESSAGES_HASH=e7a9a199a3257382a85a8e555b6c8c540b652a11ca9a471b9da2a25a660dfdc3
source "$(dirname "$0")"/common.sh
source "$(dirname "$(realpath "$0")")/common.sh"
download_verify_extract_tarball \
https://github.com/toxext/tox_extension_messages/archive/v$TOXEXT_MESSAGES_VERSION.tar.gz \
"$TOXEXT_MESSAGES_HASH"

View File

@ -20,7 +20,7 @@ set -euo pipefail
VPX_VERSION=1.11.0
VPX_HASH=965e51c91ad9851e2337aebcc0f517440c637c506f3a03948062e3d5ea129a83
source "$(dirname "$0")"/common.sh
source "$(dirname "$(realpath "$0")")/common.sh"
download_verify_extract_tarball \
"https://github.com/webmproject/libvpx/archive/v$VPX_VERSION.tar.gz" \