From 767f44d168dc47591fb1c88a12cac1d533a27184 Mon Sep 17 00:00:00 2001 From: casey langen Date: Mon, 7 Feb 2022 20:09:52 -0800 Subject: [PATCH] More build script cleans. --- .cmake/PostBuild.cmake | 10 ++++++++-- script/bootstrap-static-vendors.sh | 11 ----------- script/stage-static-vendor-libraries.sh | 9 +++++++++ 3 files changed, 17 insertions(+), 13 deletions(-) create mode 100755 script/stage-static-vendor-libraries.sh diff --git a/.cmake/PostBuild.cmake b/.cmake/PostBuild.cmake index 80292253f..a7359505c 100644 --- a/.cmake/PostBuild.cmake +++ b/.cmake/PostBuild.cmake @@ -7,15 +7,21 @@ 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 "[build] binary stripping enabled for ${CMAKE_CURRENT_SOURCE_DIR}") + 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 "[build] DISABLE_STRIP=true, *NOT* stripping binaries.") + 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...") add_custom_command(TARGET postbuild POST_BUILD COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/script/patch-macos-rpath.sh") endif() +# copy boost and ffmpeg libraries (which can't be statically linked) to bin/ +if (${LINK_STATICALLY} MATCHES "true") + message(STATUS "[post-build] copying boost and ffmpeg libs...") + add_custom_command(TARGET postbuild POST_BUILD COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/script/stage-static-vendor-libraries.sh") +endif() diff --git a/script/bootstrap-static-vendors.sh b/script/bootstrap-static-vendors.sh index 9db4d3f3d..41823d706 100755 --- a/script/bootstrap-static-vendors.sh +++ b/script/bootstrap-static-vendors.sh @@ -233,14 +233,3 @@ make install mv output ../zlib-bin cd .. -# -# stage -# - -mkdir -p bin/plugins/ -cp vendor/boost-bin/lib/libboost_filesystem.so.1.78.0 ./bin/ -cp vendor/boost-bin/lib/libboost_thread.so.1.78.0 ./bin/ -cp vendor/ffmpeg-bin/lib/libavcodec-musikcube.so.59 ./bin/plugins/ -cp vendor/ffmpeg-bin/lib/libavformat-musikcube.so.59 ./bin/plugins -cp vendor/ffmpeg-bin/lib/libavutil-musikcube.so.57 ./bin/plugins -cp vendor/ffmpeg-bin/lib/libswresample-musikcube.so.4 ./bin/plugins diff --git a/script/stage-static-vendor-libraries.sh b/script/stage-static-vendor-libraries.sh new file mode 100755 index 000000000..30f549758 --- /dev/null +++ b/script/stage-static-vendor-libraries.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +mkdir -p bin/plugins/ +cp vendor/boost-bin/lib/libboost_filesystem.so.1.78.0 ./bin/ +cp vendor/boost-bin/lib/libboost_thread.so.1.78.0 ./bin/ +cp vendor/ffmpeg-bin/lib/libavcodec-musikcube.so.59 ./bin/plugins/ +cp vendor/ffmpeg-bin/lib/libavformat-musikcube.so.59 ./bin/plugins +cp vendor/ffmpeg-bin/lib/libavutil-musikcube.so.57 ./bin/plugins +cp vendor/ffmpeg-bin/lib/libswresample-musikcube.so.4 ./bin/plugins