Convert a couple shell scripts from bash -> sh to improve portability.

This commit is contained in:
casey langen 2023-01-20 19:08:20 -08:00
parent d7f6dbe46f
commit 1f60f7c1d8
3 changed files with 15 additions and 16 deletions

View File

@ -1,9 +1,9 @@
#!/bin/bash #!/bin/sh
PLATFORM=$(uname) PLATFORM=$(uname)
if [[ "$PLATFORM" == 'Linux' ]]; then if [ "$PLATFORM" = 'Linux' ]; then
echo "[patch-rpath] patch Linux .so files..." echo "[patch-rpath] patching Linux .so files..."
chmod -x ./bin/lib/* chmod -x ./bin/lib/*
chmod -x ./bin/plugins/* chmod -x ./bin/plugins/*
@ -29,8 +29,8 @@ if [[ "$PLATFORM" == 'Linux' ]]; then
patchelf --set-rpath "\$ORIGIN:\$ORIGIN/lib" bin/musikcubed patchelf --set-rpath "\$ORIGIN:\$ORIGIN/lib" bin/musikcubed
fi fi
if [[ "$PLATFORM" == 'Darwin' ]]; then if [ "$PLATFORM" = 'Darwin' ]; then
echo "[patch-rpath] patch macOS binaries..." echo "[patch-rpath] patching macOS binaries..."
install_name_tool -add_rpath "@executable_path/" bin/musikcube install_name_tool -add_rpath "@executable_path/" bin/musikcube
install_name_tool -add_rpath "@executable_path/lib" bin/musikcube install_name_tool -add_rpath "@executable_path/lib" bin/musikcube

View File

@ -1,6 +1,5 @@
#!/bin/bash #!/bin/sh
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
CMAKE_CURRENT_SOURCE_DIR=$1 CMAKE_CURRENT_SOURCE_DIR=$1
CMAKE_SYSTEM_NAME=$2 CMAKE_SYSTEM_NAME=$2
CMAKE_BUILD_TYPE=$3 CMAKE_BUILD_TYPE=$3
@ -9,15 +8,15 @@ DISABLE_STRIP=$5
echo "[post-build] started..." echo "[post-build] started..."
if [[ "$BUILD_TYPE" == 'Release' ]]; then if [ "$CMAKE_BUILD_TYPE" = 'Release' ]; then
echo "[post-build] BUILD_TYPE=${BUILD_TYPE}, stripping binaries" echo "[post-build] BUILD_TYPE=${CMAKE_BUILD_TYPE}, stripping binaries"
$SCRIPT_DIR/strip-binaries.sh $DIR $CMAKE_CURRENT_SOURCE_DIR/script/strip-nix.sh $DIR
else else
echo "[post-build] BUILD_TYPE=${BUILD_TYPE}, not stripping" echo "[post-build] BUILD_TYPE=${CMAKE_BUILD_TYPE}, not stripping"
fi fi
echo "[post-build] patching library rpath entries..." echo "[post-build] patching library rpath entries..."
$SCRIPT_DIR/patch-rpath.sh $DIR $CMAKE_CURRENT_SOURCE_DIR/script/patch-rpath.sh $CMAKE_CURRENT_SOURCE_DIR
echo "[post-build] staging static assets..." echo "[post-build] staging static assets..."
mkdir -p "$CMAKE_CURRENT_SOURCE_DIR/bin/themes" mkdir -p "$CMAKE_CURRENT_SOURCE_DIR/bin/themes"

View File

@ -1,11 +1,11 @@
#!/bin/sh #!/bin/sh
DIR=$1 DIR=$1
if [ -z "$DIR" ]; then if [ -z "$DIR" ]; then
echo "[strip] directory not specified, using current working directory" echo "[strip-nix] directory not specified, using current working directory"
DIR=`pwd` DIR=`pwd`
fi fi
echo "[strip] resolved directory: ${DIR}" echo "[strip-nix] using directory: ${DIR}/bin/"
strip "$DIR/bin/*" 2> /dev/null strip "$DIR/bin/*" 2> /dev/null
strip "$DIR/bin/lib/*" 2> /dev/null strip "$DIR/bin/lib/*" 2> /dev/null
strip "$DIR/bin/plugin/*" 2> /dev/null strip "$DIR/bin/plugin/*" 2> /dev/null
echo "[strip] finished" echo "[strip-nix] finished"