From 65389f229ecb7dd699f1b4b975475ec4b0437be1 Mon Sep 17 00:00:00 2001 From: casey langen Date: Tue, 15 Feb 2022 16:16:37 -0800 Subject: [PATCH] Added the ability to generate a standalone deb. --- .circleci/config.yml | 12 ++++++------ .cmake/GenerateDeb.cmake | 25 ++++++++++++++----------- .cmake/InstallFiles.cmake | 13 ++++++++++--- CMakeLists.txt | 2 +- script/archive-rpi.sh | 2 +- 5 files changed, 32 insertions(+), 22 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2f4d6ebc0..3d9f91a58 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ jobs: - run: apt-get update - run: DEBIAN_FRONTEND="noninteractive" TZ="America/Los_Angeles" apt-get install -y git ssh sshpass build-essential clang cmake libboost-thread1.71-dev libboost-system1.71-dev libboost-filesystem1.71-dev libboost-date-time1.71-dev libboost-atomic1.71-dev libboost-chrono1.71-dev libogg-dev libvorbis-dev libavutil-dev libavformat-dev libswresample-dev libncursesw5-dev libasound2-dev libpulse-dev pulseaudio libmicrohttpd-dev libmp3lame-dev libcurl4-openssl-dev libev-dev libssl-dev libtag1-dev libsystemd-dev - checkout - - run: cmake -DENABLE_PCH=true -DGENERATE_DEB=1 -DDEB_ARCHITECTURE=amd64 -DDEB_PLATFORM=ubuntu -DDEB_DISTRO=focal -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release . + - run: cmake -DENABLE_PCH=true -DGENERATE_DEB=true -DDEB_ARCHITECTURE=amd64 -DDEB_PLATFORM=ubuntu -DDEB_DISTRO=focal -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release . - run: make -j2 - run: make package - run: ./script/copy-artifacts-to-host.sh /root/project/*.deb @@ -21,7 +21,7 @@ jobs: - run: apt-get update - run: DEBIAN_FRONTEND="noninteractive" TZ="America/Los_Angeles" apt-get install -y git ssh sshpass build-essential clang cmake libboost-thread1.71-dev libboost-system1.71-dev libboost-filesystem1.71-dev libboost-date-time1.71-dev libboost-atomic1.71-dev libboost-chrono1.71-dev libogg-dev libvorbis-dev libavutil-dev libavformat-dev libswresample-dev libncursesw5-dev libasound2-dev libpulse-dev pulseaudio libmicrohttpd-dev libmp3lame-dev libcurl4-openssl-dev libev-dev libssl-dev libtag1-dev libsystemd-dev libpipewire-0.3-dev libspa-0.2-dev - checkout - - run: cmake -DENABLE_PCH=true -DENABLE_PIPEWIRE=true -DGENERATE_DEB=1 -DDEB_ARCHITECTURE=amd64 -DDEB_PLATFORM=ubuntu -DDEB_DISTRO=hirsute -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release . + - run: cmake -DENABLE_PCH=true -DENABLE_PIPEWIRE=true -DGENERATE_DEB=true -DDEB_ARCHITECTURE=amd64 -DDEB_PLATFORM=ubuntu -DDEB_DISTRO=hirsute -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release . - run: make -j2 - run: make package - run: ./script/copy-artifacts-to-host.sh /root/project/*.deb @@ -35,7 +35,7 @@ jobs: - run: apt-get update - run: DEBIAN_FRONTEND="noninteractive" TZ="America/Los_Angeles" apt-get install -y git ssh sshpass build-essential clang cmake libboost-thread1.74-dev libboost-system1.74-dev libboost-filesystem1.74-dev libboost-date-time1.74-dev libboost-atomic1.74-dev libboost-chrono1.74-dev libogg-dev libvorbis-dev libavutil-dev libavformat-dev libswresample-dev libncursesw5-dev libasound2-dev libpulse-dev pulseaudio libmicrohttpd-dev libmp3lame-dev libcurl4-openssl-dev libev-dev libssl-dev libtag1-dev libsystemd-dev libpipewire-0.3-dev libspa-0.2-dev - checkout - - run: cmake -DENABLE_PCH=true -DENABLE_PIPEWIRE=true -DGENERATE_DEB=1 -DDEB_ARCHITECTURE=amd64 -DDEB_PLATFORM=ubuntu -DDEB_DISTRO=impish -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release . + - run: cmake -DENABLE_PCH=true -DENABLE_PIPEWIRE=true -DGENERATE_DEB=true -DDEB_ARCHITECTURE=amd64 -DDEB_PLATFORM=ubuntu -DDEB_DISTRO=impish -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release . - run: make -j2 - run: make package - run: ./script/copy-artifacts-to-host.sh /root/project/*.deb @@ -101,7 +101,7 @@ jobs: - run: apt-get update - run: DEBIAN_FRONTEND="noninteractive" TZ="America/Los_Angeles" apt-get install -y git ssh sshpass build-essential clang cmake libboost-thread1.71-dev libboost-system1.71-dev libboost-filesystem1.71-dev libboost-date-time1.71-dev libboost-atomic1.71-dev libboost-chrono1.71-dev libogg-dev libvorbis-dev libavutil-dev libavformat-dev libswresample-dev libncursesw5-dev libasound2-dev libpulse-dev pulseaudio libmicrohttpd-dev libmp3lame-dev libcurl4-openssl-dev libev-dev libssl-dev libtag1-dev libsystemd-dev - checkout - - run: cmake -DENABLE_PCH=true -DGENERATE_DEB=1 -DDEB_ARCHITECTURE=amd64 -DDEB_PLATFORM=mint -DDEB_DISTRO=una -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release . + - run: cmake -DENABLE_PCH=true -DGENERATE_DEB=true -DDEB_ARCHITECTURE=amd64 -DDEB_PLATFORM=mint -DDEB_DISTRO=una -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release . - run: make -j2 - run: make package - run: ./script/copy-artifacts-to-host.sh /root/project/*.deb @@ -115,7 +115,7 @@ jobs: - run: apt-get update - run: DEBIAN_FRONTEND="noninteractive" TZ="America/Los_Angeles" apt-get install -y git ssh sshpass build-essential clang cmake libboost-thread1.67-dev libboost-system1.67-dev libboost-filesystem1.67-dev libboost-date-time1.67-dev libboost-atomic1.67-dev libboost-chrono1.67-dev libogg-dev libvorbis-dev libavutil-dev libavformat-dev libswresample-dev libncursesw5-dev libasound2-dev libpulse-dev pulseaudio libmicrohttpd-dev libmp3lame-dev libcurl4-openssl-dev libev-dev libssl-dev libtag1-dev libsystemd-dev - checkout - - run: cmake -DGENERATE_DEB=1 -DDEB_ARCHITECTURE=amd64 -DDEB_PLATFORM=debian -DDEB_DISTRO=buster -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release . + - run: cmake -DGENERATE_DEB=true -DDEB_ARCHITECTURE=amd64 -DDEB_PLATFORM=debian -DDEB_DISTRO=buster -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release . - run: make -j2 - run: make package - run: ./script/copy-artifacts-to-host.sh /root/project/*.deb @@ -129,7 +129,7 @@ jobs: - run: apt-get update - run: DEBIAN_FRONTEND="noninteractive" TZ="America/Los_Angeles" apt-get install -y git ssh sshpass build-essential clang cmake libboost-thread1.74-dev libboost-system1.74-dev libboost-filesystem1.74-dev libboost-date-time1.74-dev libboost-atomic1.74-dev libboost-chrono1.74-dev libogg-dev libvorbis-dev libavutil-dev libavformat-dev libswresample-dev libncursesw5-dev libasound2-dev libpulse-dev pulseaudio libmicrohttpd-dev libmp3lame-dev libcurl4-openssl-dev libev-dev libssl-dev libtag1-dev libsystemd-dev - checkout - - run: cmake -DGENERATE_DEB=1 -DDEB_ARCHITECTURE=amd64 -DDEB_PLATFORM=debian -DDEB_DISTRO=bullseye -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release . + - run: cmake -DGENERATE_DEB=true -DDEB_ARCHITECTURE=amd64 -DDEB_PLATFORM=debian -DDEB_DISTRO=bullseye -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release . - run: make -j2 - run: make package - run: ./script/copy-artifacts-to-host.sh /root/project/*.deb diff --git a/.cmake/GenerateDeb.cmake b/.cmake/GenerateDeb.cmake index daa9ffe45..1fb42ed9d 100644 --- a/.cmake/GenerateDeb.cmake +++ b/.cmake/GenerateDeb.cmake @@ -1,5 +1,7 @@ -if (GENERATE_DEB MATCHES "1") - if (CMAKE_SYSTEM_NAME MATCHES "Linux") +if (${GENERATE_DEB} MATCHES "1" AND CMAKE_SYSTEM_NAME MATCHES "Linux") + if (${BUILD_STANDALONE} MATCHES "true") + set(CPACK_PACKAGE_FILE_NAME "musikcube_${musikcube_VERSION}_standalone_${DEB_ARCHITECTURE}") + else() set(DEB_BOOST_VERSION "1.55.0") set(DEB_MICROHTTPD_VERSION "10") set(DEB_LIBCURL_VERSION "3") @@ -51,15 +53,16 @@ if (GENERATE_DEB MATCHES "1") set(DEPENDENCIES "${DEPENDENCIES}, libtag1v5") endif() - set(CPACK_GENERATOR "DEB") - set(CPACK_PACKAGE_DESCRIPTION "musikcube, a terminal-based music player and library") - set(CPACK_PACKAGE_VERSION_MAJOR "${musikcube_VERSION_MAJOR}") - set(CPACK_PACKAGE_VERSION_MINOR "${musikcube_VERSION_MINOR}") - set(CPACK_PACKAGE_VERSION_PATCH "${musikcube_VERSION_PATCH}") - set(CPACK_DEBIAN_PACKAGE_DEPENDS ${DEPENDENCIES}) - set(CPACK_DEBIAN_PACKAGE_MAINTAINER "casey langen") - set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${DEB_ARCHITECTURE}) set(CPACK_PACKAGE_FILE_NAME "musikcube_${musikcube_VERSION}_${DEB_PLATFORM}_${DEB_DISTRO}_${DEB_ARCHITECTURE}") - include(CPack) + set(CPACK_DEBIAN_PACKAGE_DEPENDS ${DEPENDENCIES}) endif() + + set(CPACK_GENERATOR "DEB") + set(CPACK_PACKAGE_DESCRIPTION "musikcube, a terminal-based music player and library") + set(CPACK_PACKAGE_VERSION_MAJOR "${musikcube_VERSION_MAJOR}") + set(CPACK_PACKAGE_VERSION_MINOR "${musikcube_VERSION_MINOR}") + set(CPACK_PACKAGE_VERSION_PATCH "${musikcube_VERSION_PATCH}") + set(CPACK_DEBIAN_PACKAGE_MAINTAINER "casey langen") + set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${DEB_ARCHITECTURE}) + include(CPack) endif() \ No newline at end of file diff --git a/.cmake/InstallFiles.cmake b/.cmake/InstallFiles.cmake index 05601c00f..62d3c003c 100644 --- a/.cmake/InstallFiles.cmake +++ b/.cmake/InstallFiles.cmake @@ -1,5 +1,5 @@ # plugin dynamic libraries -if (CMAKE_SYSTEM_NAME MATCHES "Darwin") +if (APPLE) file(GLOB plugins "bin/plugins/*.dylib") install(FILES ${plugins} DESTINATION share/musikcube/plugins) else () @@ -7,6 +7,13 @@ else () install(FILES ${plugins} DESTINATION share/musikcube/plugins) endif () +if (${BUILD_STANDALONE} MATCHES "true") + file(GLOB libraries "bin/lib/*") + install(FILES ${libraries} DESTINATION share/musikcube/lib) + file(GLOB_RECURSE share "bin/share/*") + install(FILES ${share} DESTINATION share/musikcube/share) +endif() + # sdk header files file(GLOB sdk_headers "src/musikcore/sdk/*.h") install(FILES ${sdk_headers} DESTINATION include/musikcube/musikcore/sdk) @@ -33,7 +40,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux") endif() # libmusikcore shared library -if (CMAKE_SYSTEM_NAME MATCHES "Darwin") +if (APPLE) install(FILES "bin/libmusikcore.dylib" DESTINATION share/musikcube) else() install(FILES "bin/libmusikcore.so" DESTINATION share/musikcube) @@ -71,4 +78,4 @@ install( PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE GROUP_EXECUTE GROUP_READ GROUP_WRITE - WORLD_EXECUTE WORLD_READ) \ No newline at end of file + WORLD_EXECUTE WORLD_READ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 03ffea494..f41c9e4c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ #cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr . #cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/usr . -#cmake -DGENERATE_DEB=1 -DDEB_ARCHITECTURE=i386|amd64|armhf -DDEB_PLATFORM=ubuntu -DDEB_DISTRO=eoan -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release . +#cmake -DGENERATE_DEB=true -DDEB_ARCHITECTURE=i386|amd64|armhf -DDEB_PLATFORM=ubuntu -DDEB_DISTRO=eoan -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release . #cmake -DCMAKE_BUILD_TYPE=Release - -DBUILD_STANDALONE=true . cmake_minimum_required(VERSION 3.0) diff --git a/script/archive-rpi.sh b/script/archive-rpi.sh index 96907d051..71cf1d1c5 100755 --- a/script/archive-rpi.sh +++ b/script/archive-rpi.sh @@ -4,6 +4,6 @@ SCRIPT_DIR=`dirname "$0"` rm -rf bin ${SCRIPT_DIR}/clean-nix.sh -cmake -DENABLE_PCH=true -DGENERATE_DEB=1 -DDEB_ARCHITECTURE=armhf -DDEB_PLATFORM=rpi -DDEB_DISTRO=buster -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release . +cmake -DENABLE_PCH=true -DGENERATE_DEB=true -DDEB_ARCHITECTURE=armhf -DDEB_PLATFORM=rpi -DDEB_DISTRO=buster -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release . make -j4 cpack