musikcube/script/archive-standalone-nix.sh

76 lines
1.5 KiB
Bash
Raw Normal View History

2022-02-10 08:19:54 +00:00
#!/bin/bash
# set -x
VERSION=$1
if [ -z "$VERSION" ]; then
echo "usage: archive-nix.sh <version>"
exit
fi
OS=$(uname)
ARCH=$(uname -m)
OS_ARCH="${OS}-${ARCH}"
2022-02-10 08:33:41 +00:00
OUTNAME="musikcube_${OS_ARCH}_$VERSION"
OUTDIR="dist/$OUTNAME"
2022-02-10 08:19:54 +00:00
SCRIPTDIR=`dirname "$0"`
DLL_EXT="so"
if [ $OS == "Darwin" ]; then
DLL_EXT="dylib"
fi
OS_SPECIFIC_BUILD_FLAGS=""
if [ $OS == "Linux" ]; then
OS_SPECIFIC_BUILD_FLAGS="-DENABLE_PIPEWIRE=true"
fi
2022-02-10 08:33:41 +00:00
printf "\n"
read -p ' clean and rebuild [y]? ' CLEAN
if [[ $CLEAN == 'n' || $CLEAN == 'N' ]]; then
printf "\n\n\n ***** SKIPPING REBUILD *****\n\n\n"
else
printf "\n\n\n ***** REBUILDING NOW *****\n\n\n"
2022-02-10 08:19:54 +00:00
2022-02-10 08:33:41 +00:00
${SCRIPTDIR}/clean-nix.sh
rm -rf bin/ 2> /dev/null
2022-02-10 08:19:54 +00:00
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_STANDALONE=true ${OS_SPECIFIC_BUILD_FLAGS} . || exit $?
make -j8 || exit $?
2022-02-10 08:33:41 +00:00
fi
2022-02-10 08:19:54 +00:00
./script/stage-vendor-libraries.sh || exit $?
2022-02-10 08:19:54 +00:00
rm -rf $OUTDIR
rm dist/$OUTNAME* 2> /dev/null
mkdir -p $OUTDIR/lib
mkdir -p $OUTDIR/plugins
mkdir -p $OUTDIR/locales
mkdir -p $OUTDIR/themes
cp bin/musikcube $OUTDIR
cp bin/musikcubed $OUTDIR
cp bin/libmusikcore.${DLL_EXT} $OUTDIR
cp bin/lib/* $OUTDIR/lib
cp bin/plugins/*.${DLL_EXT} $OUTDIR/plugins
cp bin/locales/*.json $OUTDIR/locales
cp bin/themes/*.json $OUTDIR/themes
strip $OUTDIR/musikcube
strip $OUTDIR/musikcubed
strip $OUTDIR/libmusikcore.${DLL_EXT}
strip $OUTDIR/lib/*
strip $OUTDIR/libmusikcore.${DLL_EXT}
strip $OUTDIR/plugins/*.${DLL_EXT}
cd dist
tar cvf $OUTNAME.tar $OUTNAME
bzip2 $OUTNAME.tar
cd ..
2022-02-10 08:39:29 +00:00
printf "\n\n\n ***** DONE *****\n\n\n"
ls -al dist/$OUTNAME.tar.bz2
printf "\n\n"