Removed RUNPATH from Bloom's binary (except for debug builds), and created invocation script

This commit is contained in:
Nav
2023-09-28 22:36:02 +01:00
parent 48271a2516
commit 7c04345e70
6 changed files with 38 additions and 18 deletions

View File

@@ -13,10 +13,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
option(EXCLUDE_INSIGHT "Exclude the Insight component from this build" OFF) option(EXCLUDE_INSIGHT "Exclude the Insight component from this build" OFF)
set(CMAKE_SKIP_BUILD_RPATH false) set(CMAKE_SKIP_RPATH true)
set(CMAKE_BUILD_RPATH_USE_ORIGIN true)
set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib:/usr/local/lib")
set(CMAKE_BUILD_RPATH ${CMAKE_INSTALL_RPATH})
set(COMPILED_RESOURCES_BUILD_DIR ${CMAKE_BINARY_DIR}/compiled_resources/) set(COMPILED_RESOURCES_BUILD_DIR ${CMAKE_BINARY_DIR}/compiled_resources/)
add_compile_definitions(BLOOM_VERSION="${CMAKE_PROJECT_VERSION}") add_compile_definitions(BLOOM_VERSION="${CMAKE_PROJECT_VERSION}")
@@ -41,6 +38,8 @@ if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
# CMAKE_BUILD_RPATH needs to point to the local Qt installation, to use Gammaray during development. # CMAKE_BUILD_RPATH needs to point to the local Qt installation, to use Gammaray during development.
# This is because the distributed Qt binaries may not be compatible with the local installation of Gammaray # This is because the distributed Qt binaries may not be compatible with the local installation of Gammaray
# If you don't intend to use Gammaray, you can comment this out # If you don't intend to use Gammaray, you can comment this out
set(CMAKE_SKIP_RPATH false)
set(CMAKE_SKIP_BUILD_RPATH false)
set(CMAKE_BUILD_RPATH /opt/Qt/6.2.4/gcc_64/lib/) set(CMAKE_BUILD_RPATH /opt/Qt/6.2.4/gcc_64/lib/)
endif() endif()
@@ -130,11 +129,6 @@ target_compile_options(
PUBLIC $<$<CONFIG:DEBUG>:-fkeep-static-functions> PUBLIC $<$<CONFIG:DEBUG>:-fkeep-static-functions>
) )
target_link_options(
Bloom
PUBLIC [=[-Wl,-z,origin]=] #,--verbose
)
if (${ENABLE_SANITIZERS}) if (${ENABLE_SANITIZERS})
message(WARNING "Sanitizers have been enabled") message(WARNING "Sanitizers have been enabled")

View File

@@ -0,0 +1,7 @@
#!/bin/sh
BloomInstallationDir=@BLOOM_INSTALLATION_PREFIX@
LD_LIBRARY_PATH=$BloomInstallationDir/lib:$LD_LIBRARY_PATH;
export LD_LIBRARY_PATH;
exec $BloomInstallationDir/bin/bloom "$@";

View File

@@ -2,7 +2,7 @@
PLAYGROUND_DIR=@CMAKE_BINARY_DIR@/packaging/deb/playground; PLAYGROUND_DIR=@CMAKE_BINARY_DIR@/packaging/deb/playground;
DEBIAN_DIR=${PLAYGROUND_DIR}/DEBIAN DEBIAN_DIR=${PLAYGROUND_DIR}/DEBIAN
BLOOM_INSTALLATION_PREFIX=/opt/bloom/ BLOOM_INSTALLATION_PREFIX=@BLOOM_INSTALLATION_PREFIX@/
BLOOM_INSTALLATION_DIR=${PLAYGROUND_DIR}/${BLOOM_INSTALLATION_PREFIX} BLOOM_INSTALLATION_DIR=${PLAYGROUND_DIR}/${BLOOM_INSTALLATION_PREFIX}
BLOOM_PACKAGE_PATH=@CMAKE_BINARY_DIR@/packaging/@BLOOM_PACKAGE_FILE_NAME@.deb BLOOM_PACKAGE_PATH=@CMAKE_BINARY_DIR@/packaging/@BLOOM_PACKAGE_FILE_NAME@.deb
@@ -28,6 +28,9 @@ cp -a @CMAKE_BINARY_DIR@/packaging/deb/control ${DEBIAN_DIR}/;
echo "Copying Bloom binary..."; echo "Copying Bloom binary...";
cp -a @CMAKE_BINARY_DIR@/bin/bloom ${BLOOM_INSTALLATION_DIR}/bin/; cp -a @CMAKE_BINARY_DIR@/bin/bloom ${BLOOM_INSTALLATION_DIR}/bin/;
echo "Copying Bloom invocation script...";
cp -a @CMAKE_BINARY_DIR@/packaging/bloom.sh ${BLOOM_INSTALLATION_DIR}/bin/;
echo "Copying resources..."; echo "Copying resources...";
cp -a @CMAKE_BINARY_DIR@/resources ${BLOOM_INSTALLATION_DIR}/; cp -a @CMAKE_BINARY_DIR@/resources ${BLOOM_INSTALLATION_DIR}/;
cp -a @CMAKE_CURRENT_SOURCE_DIR@/build/distributed/fonts ${BLOOM_INSTALLATION_DIR}/resources/; cp -a @CMAKE_CURRENT_SOURCE_DIR@/build/distributed/fonts ${BLOOM_INSTALLATION_DIR}/resources/;
@@ -48,8 +51,8 @@ chmod u=rwX,g=rX,o=rX -R ${BLOOM_INSTALLATION_DIR}/resources/;
chmod u=rw,g=r,o=r ${PLAYGROUND_DIR}/lib/udev/rules.d/99-bloom.rules; chmod u=rw,g=r,o=r ${PLAYGROUND_DIR}/lib/udev/rules.d/99-bloom.rules;
echo "Creating symbolic link for Bloom binary..." echo "Creating symbolic link for Bloom's invocation script..."
ln -s -f ${BLOOM_INSTALLATION_PREFIX}./bin/bloom ${PLAYGROUND_DIR}/usr/bin/; ln -s -f ${BLOOM_INSTALLATION_PREFIX}./bin/bloom.sh ${PLAYGROUND_DIR}/usr/bin/bloom;
echo "Building Debian package..."; echo "Building Debian package...";
dpkg-deb --build ${PLAYGROUND_DIR} ${BLOOM_PACKAGE_PATH}; dpkg-deb --build ${PLAYGROUND_DIR} ${BLOOM_PACKAGE_PATH};

View File

@@ -2,7 +2,7 @@
PLAYGROUND_DIR=@CMAKE_BINARY_DIR@/packaging/pkgbuild/playground; PLAYGROUND_DIR=@CMAKE_BINARY_DIR@/packaging/pkgbuild/playground;
BUILD_ROOT_DIR=${PLAYGROUND_DIR}/build_root BUILD_ROOT_DIR=${PLAYGROUND_DIR}/build_root
BLOOM_INSTALLATION_PREFIX=/opt/bloom/ BLOOM_INSTALLATION_PREFIX=@BLOOM_INSTALLATION_PREFIX@/
BLOOM_INSTALLATION_DIR=${BUILD_ROOT_DIR}/${BLOOM_INSTALLATION_PREFIX} BLOOM_INSTALLATION_DIR=${BUILD_ROOT_DIR}/${BLOOM_INSTALLATION_PREFIX}
BLOOM_PACKAGE_PATH=@CMAKE_BINARY_DIR@/packaging/@BLOOM_PACKAGE_FILE_NAME@.pkg.tar.gz BLOOM_PACKAGE_PATH=@CMAKE_BINARY_DIR@/packaging/@BLOOM_PACKAGE_FILE_NAME@.pkg.tar.gz
@@ -28,6 +28,9 @@ cp -a @CMAKE_BINARY_DIR@/packaging/pkgbuild/PKGBUILD ${PLAYGROUND_DIR}/;
echo "Copying Bloom binary..."; echo "Copying Bloom binary...";
cp -a @CMAKE_BINARY_DIR@/bin/bloom ${BLOOM_INSTALLATION_DIR}/bin/; cp -a @CMAKE_BINARY_DIR@/bin/bloom ${BLOOM_INSTALLATION_DIR}/bin/;
echo "Copying Bloom invocation script...";
cp -a @CMAKE_BINARY_DIR@/packaging/bloom.sh ${BLOOM_INSTALLATION_DIR}/bin/;
echo "Copying resources..."; echo "Copying resources...";
cp -a @CMAKE_BINARY_DIR@/resources ${BLOOM_INSTALLATION_DIR}/; cp -a @CMAKE_BINARY_DIR@/resources ${BLOOM_INSTALLATION_DIR}/;
cp -a @CMAKE_CURRENT_SOURCE_DIR@/build/distributed/fonts ${BLOOM_INSTALLATION_DIR}/resources/; cp -a @CMAKE_CURRENT_SOURCE_DIR@/build/distributed/fonts ${BLOOM_INSTALLATION_DIR}/resources/;
@@ -51,8 +54,8 @@ chmod u=rwX,g=rX,o=rX -R ${BLOOM_INSTALLATION_DIR}/resources/;
chmod u=rw,g=r,o=r ${BUILD_ROOT_DIR}/usr/lib/udev/rules.d/99-bloom.rules; chmod u=rw,g=r,o=r ${BUILD_ROOT_DIR}/usr/lib/udev/rules.d/99-bloom.rules;
echo "Creating symbolic link for Bloom binary..." echo "Creating symbolic link for Bloom's invocation script..."
ln -s -f ${BLOOM_INSTALLATION_PREFIX}./bin/bloom ${BUILD_ROOT_DIR}/usr/bin/; ln -s -f ${BLOOM_INSTALLATION_PREFIX}./bin/bloom.sh ${BUILD_ROOT_DIR}/usr/bin/bloom;
echo "Building Arch package..."; echo "Building Arch package...";
cd ${PLAYGROUND_DIR}; cd ${PLAYGROUND_DIR};

View File

@@ -5,7 +5,7 @@ SPECS_DIR=${PLAYGROUND_DIR}/SPECS;
SOURCES_DIR=${PLAYGROUND_DIR}/SOURCES; SOURCES_DIR=${PLAYGROUND_DIR}/SOURCES;
RELEASE_DIR_NAME=@BLOOM_PACKAGE_NAME_LOWER@-@CMAKE_PROJECT_VERSION@; RELEASE_DIR_NAME=@BLOOM_PACKAGE_NAME_LOWER@-@CMAKE_PROJECT_VERSION@;
RELEASE_DIR=${PLAYGROUND_DIR}/${RELEASE_DIR_NAME}; RELEASE_DIR=${PLAYGROUND_DIR}/${RELEASE_DIR_NAME};
BLOOM_INSTALLATION_PREFIX=/opt/bloom/ BLOOM_INSTALLATION_PREFIX=@BLOOM_INSTALLATION_PREFIX@/
BLOOM_INSTALLATION_DIR=${RELEASE_DIR}/${BLOOM_INSTALLATION_PREFIX} BLOOM_INSTALLATION_DIR=${RELEASE_DIR}/${BLOOM_INSTALLATION_PREFIX}
BLOOM_PACKAGE_PATH=@CMAKE_BINARY_DIR@/packaging/@BLOOM_PACKAGE_FILE_NAME@.rpm BLOOM_PACKAGE_PATH=@CMAKE_BINARY_DIR@/packaging/@BLOOM_PACKAGE_FILE_NAME@.rpm
@@ -37,6 +37,9 @@ cp -a @CMAKE_BINARY_DIR@/packaging/rpm/bloom.spec ${SPECS_DIR}/;
echo "Copying Bloom binary..."; echo "Copying Bloom binary...";
cp -a @CMAKE_BINARY_DIR@/bin/bloom ${BLOOM_INSTALLATION_DIR}/bin/; cp -a @CMAKE_BINARY_DIR@/bin/bloom ${BLOOM_INSTALLATION_DIR}/bin/;
echo "Copying Bloom invocation script...";
cp -a @CMAKE_BINARY_DIR@/packaging/bloom.sh ${BLOOM_INSTALLATION_DIR}/bin/;
echo "Copying resources..."; echo "Copying resources...";
cp -a @CMAKE_BINARY_DIR@/resources ${BLOOM_INSTALLATION_DIR}/; cp -a @CMAKE_BINARY_DIR@/resources ${BLOOM_INSTALLATION_DIR}/;
cp -a @CMAKE_CURRENT_SOURCE_DIR@/build/distributed/fonts ${BLOOM_INSTALLATION_DIR}/resources/; cp -a @CMAKE_CURRENT_SOURCE_DIR@/build/distributed/fonts ${BLOOM_INSTALLATION_DIR}/resources/;
@@ -57,8 +60,8 @@ chmod u=rwX,g=rX,o=rX -R ${BLOOM_INSTALLATION_DIR}/resources/;
chmod u=rw,g=r,o=r ${RELEASE_DIR}/usr/lib/udev/rules.d/99-bloom.rules; chmod u=rw,g=r,o=r ${RELEASE_DIR}/usr/lib/udev/rules.d/99-bloom.rules;
echo "Creating symbolic link for Bloom binary..." echo "Creating symbolic link for Bloom's invocation script..."
ln -s -f ${BLOOM_INSTALLATION_PREFIX}./bin/bloom ${RELEASE_DIR}/usr/bin/; ln -s -f ${BLOOM_INSTALLATION_PREFIX}./bin/bloom.sh ${RELEASE_DIR}/usr/bin/bloom;
echo "Creating release tarball..." echo "Creating release tarball..."
tar -zcvf ${SOURCES_DIR}/@BLOOM_PACKAGE_NAME_LOWER@-@CMAKE_PROJECT_VERSION@.tar.gz -C ${PLAYGROUND_DIR} ./${RELEASE_DIR_NAME} tar -zcvf ${SOURCES_DIR}/@BLOOM_PACKAGE_NAME_LOWER@-@CMAKE_PROJECT_VERSION@.tar.gz -C ${PLAYGROUND_DIR} ./${RELEASE_DIR_NAME}

View File

@@ -3,9 +3,19 @@ set(BLOOM_PACKAGE_FILE_NAME "Bloom-${CMAKE_PROJECT_VERSION}-Linux-x86_64")
set(BLOOM_PACKAGE_DESCRIPTION "Debugger for AVR-based embedded systems") set(BLOOM_PACKAGE_DESCRIPTION "Debugger for AVR-based embedded systems")
set(BLOOM_PACKAGE_CONTACT "Nav Mohammed <support@bloom.oscillate.io>") set(BLOOM_PACKAGE_CONTACT "Nav Mohammed <support@bloom.oscillate.io>")
# All generated packages will install Bloom to BLOOM_INSTALLATION_PREFIX
set(BLOOM_INSTALLATION_PREFIX "/opt/bloom")
string(TOLOWER ${BLOOM_PACKAGE_NAME} BLOOM_PACKAGE_NAME_LOWER) string(TOLOWER ${BLOOM_PACKAGE_NAME} BLOOM_PACKAGE_NAME_LOWER)
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/packaging/pkgbuild") file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/packaging/pkgbuild")
# Generate Bloom's invocation script
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/build/packaging/bloom.sh.in"
"${CMAKE_BINARY_DIR}/packaging/bloom.sh"
@ONLY
)
# Generate the DEB control file and packaging script # Generate the DEB control file and packaging script
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/packaging/deb") file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/packaging/deb")