From 3e9493f3e7a44574e4ddbd2105656e9e4293383a Mon Sep 17 00:00:00 2001 From: Mark Nokalt Date: Sat, 22 Jan 2022 18:10:49 -0300 Subject: [PATCH] build: Fix usage of CMAKE_INSTALL_PREFIX on Linux (#401) * build: Fix usage of CMAKE_INSTALL_PREFIX * build: Use /usr prefix in Linux CI builds * ci: Delete DEBIAN folder after .deb packaging step --- .github/workflows/build.yml | 23 +++++++++++++---------- cmake/build_helpers.cmake | 13 ++++++------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 960ae9c28..57918d05b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -177,10 +177,10 @@ jobs: sudo rm -rf /opt/ghc sudo rm -rf "/usr/local/share/boost" sudo rm -rf "$AGENT_TOOLSDIRECTORY" - + sudo apt update sudo bash dist/get_deps_debian.sh - + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh sh rustup-init.sh -y --default-toolchain none rm rustup-init.sh @@ -192,14 +192,14 @@ jobs: run: | mkdir -p build cd build - CC=gcc-10 CXX=g++-10 cmake \ - -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ - -DCMAKE_INSTALL_PREFIX="$PWD/install" \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DCMAKE_C_FLAGS="-fuse-ld=lld" \ - -DCMAKE_CXX_FLAGS="-fuse-ld=lld" \ - -DRUST_PATH="$HOME/.cargo/bin/" \ + CC=gcc-10 CXX=g++-10 cmake \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ + -DCMAKE_INSTALL_PREFIX="$PWD/install/usr" \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_C_FLAGS="-fuse-ld=lld" \ + -DCMAKE_CXX_FLAGS="-fuse-ld=lld" \ + -DRUST_PATH="$HOME/.cargo/bin/" \ .. make -j 4 install @@ -214,8 +214,10 @@ jobs: - name: 📦 Bundle DEB run: | + cp -r build/DEBIAN build/install dpkg-deb --build build/install mv build/install.deb imhex.deb + rm -rf build/install/DEBIAN - name: 📦 Bundle AppImage run: | @@ -249,3 +251,4 @@ jobs: name: Linux AppImage path: | imhex.AppImage + diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake index f72a276a8..3ae87b6f6 100644 --- a/cmake/build_helpers.cmake +++ b/cmake/build_helpers.cmake @@ -68,10 +68,10 @@ macro(detectOS) set(MAGIC_INSTALL_LOCATION "magic") elseif(UNIX AND NOT APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOS_LINUX") - set(CMAKE_INSTALL_BINDIR "usr/bin") - set(CMAKE_INSTALL_LIBDIR "usr/lib") - set(PLUGINS_INSTALL_LOCATION "usr/share/imhex/plugins") - set(MAGIC_INSTALL_LOCATION "usr/share/imhex/magic") + set(CMAKE_INSTALL_BINDIR "bin") + set(CMAKE_INSTALL_LIBDIR "lib") + set(PLUGINS_INSTALL_LOCATION "share/imhex/plugins") + set(MAGIC_INSTALL_LOCATION "share/imhex/magic") else() message(FATAL_ERROR "Unknown / unsupported system!") endif() @@ -209,9 +209,8 @@ macro(createPackage) ]]) elseif(UNIX AND NOT APPLE) configure_file(${CMAKE_SOURCE_DIR}/dist/DEBIAN/control.in ${CMAKE_BINARY_DIR}/DEBIAN/control) - install(FILES ${CMAKE_BINARY_DIR}/DEBIAN/control DESTINATION ${CMAKE_INSTALL_PREFIX}/DEBIAN) - install(FILES ${CMAKE_SOURCE_DIR}/dist/imhex.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/usr/share/applications) - install(FILES ${CMAKE_SOURCE_DIR}/resources/icon.png DESTINATION ${CMAKE_INSTALL_PREFIX}/usr/share/pixmaps RENAME imhex.png) + install(FILES ${CMAKE_SOURCE_DIR}/dist/imhex.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications) + install(FILES ${CMAKE_SOURCE_DIR}/resources/icon.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps RENAME imhex.png) endif() if (CREATE_BUNDLE)