archive-os.sh => archive-nix.sh

This commit is contained in:
casey langen 2022-02-10 00:19:54 -08:00
parent 4af65ac4d4
commit 293e1dfc1b
3 changed files with 72 additions and 51 deletions

View File

@ -4,16 +4,6 @@
add_custom_target(postbuild ALL DEPENDS musikcube musikcubed)
add_custom_command(TARGET postbuild POST_BUILD COMMAND cmake .)
# strip binaries in release mode
if (CMAKE_BUILD_TYPE MATCHES Release)
if ((NOT DEFINED DISABLE_STRIP) OR (NOT ${DISABLE_STRIP} MATCHES "true"))
message(STATUS "[post-build] binary stripping enabled for ${CMAKE_CURRENT_SOURCE_DIR}")
add_custom_command(TARGET postbuild POST_BUILD COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/script/strip-nix.sh" ${CMAKE_CURRENT_SOURCE_DIR})
else()
message(STATUS "[post-build] DISABLE_STRIP=true, *NOT* stripping binaries.")
endif()
endif()
# ensure the binaries can find libmusikcore.so, which lives in the same directory.
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
message(STATUS "[post-build] patching macOS rpath...")
@ -27,3 +17,13 @@ if (${BUILD_STANDALONE} MATCHES "true")
message(STATUS "[post-build] copying vendor'd libs...")
add_custom_command(TARGET postbuild POST_BUILD COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/script/stage-vendor-libraries.sh")
endif()
# strip binaries in release mode
if (CMAKE_BUILD_TYPE MATCHES Release)
if ((NOT DEFINED DISABLE_STRIP) OR (NOT ${DISABLE_STRIP} MATCHES "true"))
message(STATUS "[post-build] binary stripping enabled for ${CMAKE_CURRENT_SOURCE_DIR}")
add_custom_command(TARGET postbuild POST_BUILD COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/script/strip-nix.sh" ${CMAKE_CURRENT_SOURCE_DIR})
else()
message(STATUS "[post-build] DISABLE_STRIP=true, *NOT* stripping binaries.")
endif()
endif()

View File

@ -1,41 +0,0 @@
#!/bin/sh
VERSION=$1
if [ -z "$VERSION" ]; then
echo "usage: archive-macos.sh <version>"
exit
fi
SCRIPTDIR=`dirname "$0"`
rm -rf bin/
${SCRIPTDIR}/clean-nix.sh
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_STANDALONE=true .
make -j7
DIRNAME="musikcube_macos_$VERSION"
OUTPATH="bin/dist/$DIRNAME"
rm -rf "$OUTPATH"
mkdir -p "$OUTPATH/plugins"
mkdir -p "$OUTPATH/locales"
mkdir -p "$OUTPATH/themes"
cp bin/musikcube "$OUTPATH"
cp bin/musikcubed "$OUTPATH"
cp bin/libmusikcore.dylib "$OUTPATH"
cp bin/plugins/*.dylib "$OUTPATH/plugins"
cp bin/locales/*.json "$OUTPATH/locales"
cp bin/themes/*.json "$OUTPATH/themes"
strip bin/musikcube
strip bin/musikcubed
strip bin/libmusikcore.dylib
strip bin/plugins/*.dylib
pushd bin/dist
tar cvf musikcube_macos_$VERSION.tar $DIRNAME
bzip2 musikcube_macos_$VERSION.tar
popd

62
script/archive-nix.sh Executable file
View File

@ -0,0 +1,62 @@
#!/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}"
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
# ${SCRIPTDIR}/clean-nix.sh
# rm -rf bin/ 2> /dev/null
# cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_PCH=true -DBUILD_STANDALONE=true ${OS_SPECIFIC_BUILD_FLAGS} .
# make -j8
OUTNAME="musikcube_${OS_ARCH}_$VERSION"
OUTDIR="dist/$OUTNAME"
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 ..