cmake hack to prevent cpack from re-generating binaries after they

have been stripped/patched.
This commit is contained in:
casey langen 2022-12-22 23:19:14 -08:00
parent 3b66303ba8
commit 7b5d824209
3 changed files with 11 additions and 1 deletions

View File

@ -114,6 +114,10 @@ bzip2 $OUTNAME.tar
cd ../../
if [[ $OS == "Linux" ]]; then
# hack so the pre-install script doesn't re-run, clobbering binaries that
# have had their rpaths updated and symbols stripped.
# https://stackoverflow.com/a/57531164
perl -i.bak -0pe "s|Unix Makefiles|Ninja|" CPackConfig.cmake
cpack
mv *.deb dist/$VERSION/
mv *.rpm dist/$VERSION/

View File

@ -6,4 +6,5 @@ find . -name CMakeFiles -type d -exec rm -rf "{}" \; 2> /dev/null
rm -f Makefile
rm -f *.cmake
rm -rf _CPack_Packages 2> /dev/null
rm CPack* 2> /dev/null
rm install_manifest.txt 2> /dev/null

View File

@ -5,6 +5,10 @@ PLATFORM=$(uname)
if [[ "$PLATFORM" == 'Linux' ]]; then
echo "[patch-rpath] patch Linux .so files..."
chmod -x ./bin/lib/*
chmod -x ./bin/plugins/*
chmod -x ./bin/*.so
# update the RPATH so libraries in libs/ can discover each other,
# and plugins can discover themselves, and libs/ (but not the
# other way around)
@ -21,7 +25,8 @@ if [[ "$PLATFORM" == 'Linux' ]]; then
patchelf --set-rpath "\$ORIGIN:\$ORIGIN/../lib" "$f"
done
chmod -x ./bin/lib/*
patchelf --set-rpath "\$ORIGIN:\$ORIGIN/lib" bin/musikcube
patchelf --set-rpath "\$ORIGIN:\$ORIGIN/lib" bin/musikcubed
fi
if [[ "$PLATFORM" == 'Darwin' ]]; then