From 2a13697fefe4e4ec3d68e6d137d0a98b56d0de1a Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Fri, 17 Jun 2022 16:30:59 -0400 Subject: [PATCH] Replace hardcoded paths for unix and... - Add cache for flatpak job Co-Authored-By: istori1 <107304850+istori1@users.noreply.github.com> --- .github/workflows/CI.yml | 14 ++++++++++---- CMakeLists.txt | 19 +++++++++++-------- .../com.github.sunshinestream.sunshine.yml | 6 ++---- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a4d67abe..34d1c7c3 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -67,6 +67,12 @@ jobs: remove-android: 'true' remove-haskell: 'true' + - name: Cache flatpak-builder + uses: actions/cache@v3 + with: + path: ./build/.flatpak-builder + key: ${{ runner.os }}-flatpak-builder + - name: Checkout uses: actions/checkout@v3 @@ -137,9 +143,9 @@ jobs: matrix: include: # package these differently - type: cpack - CMAKE_INSTALL_PREFIX: '/usr/local/sunshine' - SUNSHINE_ASSETS_DIR: 'assets' - SUNSHINE_CONFIG_DIR: 'config' + CMAKE_INSTALL_PREFIX: '/usr' + SUNSHINE_ASSETS_DIR: 'local/sunshine/assets' + SUNSHINE_CONFIG_DIR: 'local/sunshine/config' EXTRA_ARGS: '' - type: appimage CMAKE_INSTALL_PREFIX: '/usr' @@ -370,7 +376,7 @@ jobs: mkdir build cd build - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/sunshine -DSUNSHINE_ASSETS_DIR=assets -DSUNSHINE_CONFIG_DIR=config -DGITHUB_OWNER=${owner} -DGITHUB_REPO=${repo} -DGITHUB_BRANCH=${branch} -DSUNSHINE_CONFIGURE_PORTFILE=ON .. + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DSUNSHINE_ASSETS_DIR=local/sunshine/assets -DSUNSHINE_CONFIG_DIR=local/sunshine/config -DGITHUB_OWNER=${owner} -DGITHUB_REPO=${repo} -DGITHUB_BRANCH=${branch} -DSUNSHINE_CONFIGURE_PORTFILE=ON .. make -j ${nproc} - name: Package MacOS diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e083567..d37fc1fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,11 @@ project(Sunshine VERSION 0.14.0 HOMEPAGE_URL "https://sunshinestream.github.io" ) +option(SUNSHINE_CONFIGURE_APPIMAGE "Configure files required for AppImage." OFF) +option(SUNSHINE_CONFIGURE_FLATPAK "Configure files required for Flatpak." OFF) +option(SUNSHINE_CONFIGURE_PORTFILE "Configure MacOS Portfile." OFF) +option(SUNSHINE_CONFIGURE_ONLY "Configure special files only, then exit." OFF) + if(${SUNSHINE_CONFIGURE_APPIMAGE}) configure_file(packaging/linux/sunshine.desktop sunshine.desktop @ONLY) elseif(${SUNSHINE_CONFIGURE_FLATPAK}) @@ -414,11 +419,9 @@ if(NOT SUNSHINE_CONFIG_DIR) set(SUNSHINE_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/config") endif() -if(CMAKE_INSTALL_PREFIX) - if(NOT ${SUNSHINE_CONFIGURE_APPIMAGE}) - set(SUNSHINE_ASSETS_DIR "${CMAKE_INSTALL_PREFIX}/${SUNSHINE_ASSETS_DIR}") - set(SUNSHINE_CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/${SUNSHINE_CONFIG_DIR}") - endif() +if(UNIX AND CMAKE_INSTALL_PREFIX AND NOT ${SUNSHINE_CONFIGURE_APPIMAGE}) + set(SUNSHINE_ASSETS_DIR "${CMAKE_INSTALL_PREFIX}/${SUNSHINE_ASSETS_DIR}") + set(SUNSHINE_CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/${SUNSHINE_CONFIG_DIR}") endif() list(APPEND CBS_EXTERNAL_LIBRARIES @@ -435,7 +438,7 @@ list(APPEND SUNSHINE_EXTERNAL_LIBRARIES ${OPENSSL_LIBRARIES} ${PLATFORM_LIBRARIES}) -if (NOT WIN32) +if(NOT WIN32) list(APPEND SUNSHINE_EXTERNAL_LIBRARIES Boost::log) endif() @@ -590,8 +593,8 @@ if(UNIX AND NOT APPLE) install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/85-sunshine-rules.rules" DESTINATION "/etc/udev/rules.d") - install(TARGETS sunshine RUNTIME DESTINATION "/usr/bin") - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service" DESTINATION "/usr/lib/systemd/user") + install(TARGETS sunshine RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service" DESTINATION "${CMAKE_INSTALL_LIBDIR}/systemd/user") # Pre and post install set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA diff --git a/packaging/linux/flatpak/com.github.sunshinestream.sunshine.yml b/packaging/linux/flatpak/com.github.sunshinestream.sunshine.yml index 7d6b92fe..08e47999 100644 --- a/packaging/linux/flatpak/com.github.sunshinestream.sunshine.yml +++ b/packaging/linux/flatpak/com.github.sunshinestream.sunshine.yml @@ -191,11 +191,11 @@ modules: - name: sunshine buildsystem: cmake no-make-install: false + builddir: true build-options: - cxxflags: -I/app/include/libevdev-1.0 + cxxflags: -I${C_INCLUDE_PATH}/libevdev-1.0 config-opts: - -DCMAKE_BUILD_TYPE=Release - - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/app/bin - -DCMAKE_INSTALL_PREFIX='/app' - -DSUNSHINE_ASSETS_DIR=assets - -DSUNSHINE_CONFIG_DIR=config @@ -204,8 +204,6 @@ modules: - -DSUNSHINE_ENABLE_X11=ON - -DSUNSHINE_ENABLE_DRM=ON - -DSUNSHINE_ENABLE_CUDA=ON - post-install: - - cp -f ./src_assets/linux/misc/85-sunshine-rules.rules /etc/udev/rules.d/ sources: - type: git url: https://github.com/@GITHUB_OWNER@/@GITHUB_REPO@.git