diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 285ef572..71abe96e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -56,6 +56,19 @@ jobs: name: Linux runs-on: ubuntu-20.04 needs: check_changelog + strategy: + fail-fast: false # false to test all, true to fail entire job if any fail + matrix: + include: # package these differently + - type: cpack + CMAKE_INSTALL_PREFIX: '/usr/local/sunshine' + SUNSHINE_ASSETS_DIR: 'assets' + SUNSHINE_CONFIG_DIR: 'config' + - type: appimage + CMAKE_INSTALL_PREFIX: '.' + SUNSHINE_ASSETS_DIR: 'usr/local/sunshine/assets' + SUNSHINE_CONFIG_DIR: 'usr/local/sunshine/config' + steps: - name: Checkout uses: actions/checkout@v3 @@ -128,21 +141,39 @@ jobs: - name: Build Linux run: | mkdir -p build + mkdir -p artifacts cd build - cmake -DCMAKE_BUILD_TYPE=Release -DSUNSHINE_ASSETS_DIR=/usr/local/sunshine/.assets -DSUNSHINE_CONFIG_DIR=/usr/local/sunshine/config -DSUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine -DSUNSHINE_ENABLE_WAYLAND=ON -DSUNSHINE_ENABLE_X11=ON -DSUNSHINE_ENABLE_DRM=ON -DSUNSHINE_ENABLE_CUDA=ON .. + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{ matrix.CMAKE_INSTALL_PREFIX }} -DSUNSHINE_ASSETS_DIR=${{ matrix.SUNSHINE_ASSETS_DIR }} -DSUNSHINE_CONFIG_DIR=${{ matrix.SUNSHINE_CONFIG_DIR }} -DSUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine -DSUNSHINE_ENABLE_WAYLAND=ON -DSUNSHINE_ENABLE_X11=ON -DSUNSHINE_ENABLE_DRM=ON -DSUNSHINE_ENABLE_CUDA=ON .. make -j ${nproc} + - name: Package Linux - CPACK + if: ${{ matrix.type == 'cpack' }} + working-directory: build + run: | + # package + cpack -G DEB + cpack -G RPM + + # move + mv ./cpack_artifacts/Sunshine.deb ../artifacts/sunshine.deb + mv ./cpack_artifacts/Sunshine.rpm ../artifacts/sunshine.rpm + - name: Set AppImage Version - if: ${{ needs.check_changelog.outputs.next_version_bare != needs.check_changelog.outputs.latest_version }} + if: ${{ matrix.type == 'appimage' && ( needs.check_changelog.outputs.next_version_bare != needs.check_changelog.outputs.latest_version ) }} run: | version=${{ needs.check_changelog.outputs.next_version_bare }} echo "VERSION=${version}" >> $GITHUB_ENV - - name: Package Linux + - name: Package Linux - AppImage + if: ${{ matrix.type == 'appimage' }} + working-directory: build run: | - mkdir -p artifacts - cd build + # install sunshine to the DESTDIR + make install DESTDIR=AppDir + + # testing only + ls AppDir # variables DESKTOP_FILE="${DESKTOP_FILE:-sunshine.desktop}" @@ -160,7 +191,7 @@ jobs: # export DEPLOY_GTK_VERSION=3 ./linuxdeploy-x86_64.AppImage \ - --appdir . \ + --appdir ./AppDir \ --executable ./sunshine \ --icon-file "../$ICON_FILE" \ --desktop-file "./$DESKTOP_FILE" \ @@ -171,16 +202,11 @@ jobs: # # add this argument back if using gtk plugin # --plugin gtk \ - # package - cpack -G DEB - cpack -G RPM - # move mv Sunshine*.AppImage ../artifacts/sunshine.AppImage - mv ./cpack_artifacts/Sunshine.deb ../artifacts/sunshine.deb - mv ./cpack_artifacts/Sunshine.rpm ../artifacts/sunshine.rpm - name: Verify AppImage + if: ${{ matrix.type == 'appimage' }} run: | wget https://github.com/TheAssassin/appimagelint/releases/download/continuous/appimagelint-x86_64.AppImage chmod +x appimagelint-x86_64.AppImage @@ -193,7 +219,7 @@ jobs: if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} uses: actions/upload-artifact@v3 with: - name: sunshine-linux + name: sunshine-linux-${{ matrix.type }} path: artifacts/ - name: Create Release @@ -229,7 +255,7 @@ jobs: run: | mkdir build cd build - cmake -DCMAKE_BUILD_TYPE=Release -DSUNSHINE_ASSETS_DIR=/usr/local/sunshine/.assets -DSUNSHINE_CONFIG_DIR=/usr/local/sunshine/config .. + cmake -DCMAKE_BUILD_TYPE=Release -DSUNSHINE_ASSETS_DIR=/usr/local/sunshine/assets -DSUNSHINE_CONFIG_DIR=/usr/local/sunshine/config .. make -j ${nproc} - name: Package MacOS diff --git a/CMakeLists.txt b/CMakeLists.txt index 68035d54..53358f35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -393,7 +393,7 @@ else() endif() if(NOT SUNSHINE_ASSETS_DIR) - set(SUNSHINE_ASSETS_DIR "${CMAKE_CURRENT_BINARY_DIR}/.assets") + set(SUNSHINE_ASSETS_DIR "${CMAKE_CURRENT_BINARY_DIR}/assets") endif() if(NOT SUNSHINE_CONFIG_DIR) @@ -535,13 +535,15 @@ if(WIN32) # see options at: https://cmake.org/cmake/help/latest/cpack_gen/nsis.h set(CPACK_COMPONENT_SUNSHINESVC_GROUP "Tools") endif() if(UNIX) + # Installation destination dir + set(CPACK_SET_DESTDIR true) + if(NOT CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local/sunshine") + endif() + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}") install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}") - - # Installation destination dir - set(CPACK_SET_DESTDIR true) - set(CMAKE_INSTALL_PREFIX "/usr/local/sunshine/") endif() if(APPLE) # TODO: test @@ -576,14 +578,14 @@ if(UNIX AND NOT APPLE) # Pre and post install set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA - "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/deb/preinst;${SUNSHINE_SOURCE_ASSETS_DIR}/linux/deb/postinst;${SUNSHINE_SOURCE_ASSETS_DIR}/linux/deb/conffiles") - set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/deb/preinst") - set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/deb/postinst") + "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/preinst;${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/postinst;${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/conffiles") + set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/preinst") + set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/postinst") # Dependencies set(CPACK_DEB_COMPONENT_INSTALL ON) set(CPACK_DEBIAN_PACKAGE_DEPENDS "libssl1.1 | libssl3.0, libavdevice58, libboost-thread1.67.0 | libboost-thread1.71.0 | libboost-thread1.74.0, libboost-filesystem1.67.0 | libboost-filesystem1.71.0 | libboost-filesystem1.74.0, libboost-log1.67.0 | libboost-log1.71.0 | libboost-log1.74.0, libpulse0, libopus0, libxcb-shm0, libxcb-xfixes0, libxtst6, libevdev2, libdrm2, libcap2") - set(CPACK_RPM_PACKAGE_REQUIRES "libssl==1.1, libavdevice>=58, libboost-thread>=1.67.0, libboost-filesystem>=1.67.0, libboost-log>=1.67.0, libpulse>=0, libopus>=0, libxcb-shm>=0, libxcb-xfixes>=0, libxtst>=0, libevdev>=2.0, libdrm>=2.0, libcap>=2.0") + set(CPACK_RPM_PACKAGE_REQUIRES "openssl >= 1.1, libavdevice >= 4.3, boost-thread >= 1.67.0, boost-filesystem >= 1.67.0, boost-log >= 1.67.0, pulseaudio-libs >= 10.0, libopusenc >= 0.2.1, libxcb >= 1.13, libXtst >= 1.2.3, libevdev >= 1.5.6, libdrm >= 2.4.97, libcap >= 2.22") set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF) # This should automatically figure out dependencies, doesn't work with the current config # AppImage desktop file diff --git a/Portfile.in b/Portfile.in index 2cb35466..3ab6b0ff 100644 --- a/Portfile.in +++ b/Portfile.in @@ -31,8 +31,8 @@ depends_lib port:avahi \ boost.version 1.76 configure.args -DBOOST_ROOT=[boost::install_area] \ - -DSUNSHINE_ASSETS_DIR=${prefix}/usr/local/sunshine/.assets - -DSUNSHINE_CONFIG_DIR=${prefix}/usr/local/sunshine/config + -DSUNSHINE_ASSETS_DIR=${prefix}/etc/sunshine/assets + -DSUNSHINE_CONFIG_DIR=${prefix}/etc/sunshine/config cmake.out_of_source yes diff --git a/src_assets/linux/deb/conffiles b/src_assets/linux/misc/conffiles similarity index 100% rename from src_assets/linux/deb/conffiles rename to src_assets/linux/misc/conffiles diff --git a/src_assets/linux/deb/postinst b/src_assets/linux/misc/postinst similarity index 100% rename from src_assets/linux/deb/postinst rename to src_assets/linux/misc/postinst diff --git a/src_assets/linux/deb/preinst b/src_assets/linux/misc/preinst similarity index 100% rename from src_assets/linux/deb/preinst rename to src_assets/linux/misc/preinst