diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3da5a4b0..66e7d6da 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -9,6 +9,17 @@ on: workflow_dispatch: jobs: + github_env: + name: GitHub Env Debug + runs-on: ubuntu-latest + + steps: + - name: Dump github context + run: echo "$GITHUB_CONTEXT" + shell: bash + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + check_changelog: name: Check Changelog runs-on: ubuntu-latest @@ -438,28 +449,25 @@ jobs: - name: Configure Portfile run: | # variables for Portfile - owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]' ) - repo=$(echo ${GITHUB_REPOSITORY#*/} | tr '[:upper:]' '[:lower:]' ) branch=${GITHUB_HEAD_REF} - commit=${{ github.event.pull_request.head.sha }} # check the branch variable if [ -z "$branch" ] then echo "This is a PUSH event" - branch=branch=${{ github.ref_name }} commit=${{ github.sha }} + clone_url=${{ github.event.repository.clone_url }} else echo "This is a PR event" + commit=${{ github.event.pull_request.head.sha }} + clone_url=${{ github.event.pull_request.head.repo.clone_url }} fi - echo "Owner: ${owner}" - echo "Repo: ${repo}" - echo "Branch: ${branch}" echo "Commit: ${commit}" + echo "Clone URL: ${clone_url}" mkdir build cd build - cmake -DGITHUB_OWNER=${owner} -DGITHUB_REPO=${repo} -DGITHUB_BRANCH=${branch} -DSUNSHINE_CONFIGURE_PORTFILE=ON -DSUNSHINE_CONFIGURE_ONLY=ON .. + cmake -DGITHUB_COMMIT=${commit} -DGITHUB_CLONE_URL=${clone_url} -DSUNSHINE_CONFIGURE_PORTFILE=ON -DSUNSHINE_CONFIGURE_ONLY=ON .. cd .. @@ -470,6 +478,9 @@ jobs: # copy Portfile to ports mkdir -p ./ports/multimedia/Sunshine cp -f ./build/Portfile ./ports/multimedia/Sunshine/Portfile + + # testing + cat ./artifacts/Portfile - name: Bootstrap MacPorts run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index d37fc1fd..884c14dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,10 @@ project(Sunshine VERSION 0.14.0 HOMEPAGE_URL "https://sunshinestream.github.io" ) +set(PROJECT_LONG_DESCRIPTION "Sunshine is a self hosted, low latency, cloud gaming solution with support for AMD, \ +Intel, and Nvidia gpus. It is an open source implementation of NVIDIA's GameStream, as used by the NVIDIA Shield. \ +Connect to Sunshine from any Moonlight client, available for nearly any device imaginable.") + 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) diff --git a/packaging/macos/Portfile b/packaging/macos/Portfile index 371b5cdf..4bb28b7b 100644 --- a/packaging/macos/Portfile +++ b/packaging/macos/Portfile @@ -1,26 +1,32 @@ # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 +# initial PR into macports: https://github.com/macports/macports-ports/pull/15143 + PortSystem 1.0 PortGroup cmake 1.1 PortGroup github 1.0 PortGroup boost 1.0 -# bump revision when changes are made to this file -revision 1 - -github.setup @GITHUB_OWNER@ @GITHUB_REPO@ @GITHUB_BRANCH@ name @PROJECT_NAME@ version @PROJECT_VERSION@ +revision 0 categories multimedia emulators games platforms darwin license GPL-3 -maintainers {@SunshineStream sunshinestream} +maintainers @SunshineStream description @PROJECT_DESCRIPTION@ -long_description {*}${description} -homepage @PROJECT_HOMEPAGE_URL@ -master_sites https://github.com/@GITHUB_OWNER@/@GITHUB_REPO@/releases +# long_description will not be split into multiple lines as it's configured by CMakeLists +long_description @PROJECT_LONG_DESCRIPTION@ +homepage @PROJECT_HOMEPAGE_URL@ +master_sites https://github.com/sunshinestream/sunshine/releases + +compiler.cxx_standard 2017 fetch.type git + +git.url @GITHUB_CLONE_URL@ +git.branch @GITHUB_COMMIT@ + post-fetch { system -W ${worksrcpath} "${git.cmd} submodule update --init --recursive" } @@ -31,11 +37,9 @@ depends_lib port:avahi \ boost.version 1.76 -configure.args -DBOOST_ROOT=[boost::install_area] \ - -DSUNSHINE_ASSETS_DIR=${prefix}/etc/sunshine/assets \ - -DSUNSHINE_CONFIG_DIR=${prefix}/etc/sunshine/config - -cmake.out_of_source yes +configure.args -DCMAKE_INSTALL_PREFIX=${prefix} \ + -DSUNSHINE_ASSETS_DIR=etc/sunshine/assets \ + -DSUNSHINE_CONFIG_DIR=etc/sunshine/config startupitem.create yes startupitem.executable "${prefix}/bin/{$name}" @@ -50,33 +54,22 @@ platform darwin { } } -# is this actually necessary? this should all be handled by CMakeLists -destroot { - # install assets - xinstall -d -m 755 ${destroot}${prefix}/etc/${name}/assets - xinstall {*}[glob ${worksrcpath}/src_assets/common/assets/*.*] ${destroot}${prefix}/etc/${name}/assets - xinstall {*}[glob ${worksrcpath}/src_assets/macos/assets/*.*] ${destroot}${prefix}/etc/${name}/assets +# destroot not required as cmake install directive handles moving files - # install web assets - xinstall -d -m 755 ${destroot}${prefix}/etc/${name}/assets/web/fonts/fontawesome-free-web/css - xinstall -d -m 755 ${destroot}${prefix}/etc/${name}/assets/web/fonts/fontawesome-free-web/webfonts - xinstall {*}[glob ${worksrcpath}/src_assets/common/assets/web/*.*] ${destroot}${prefix}/etc/${name}/assets/web - xinstall {*}[glob ${worksrcpath}/src_assets/common/assets/web/fonts/fontawesome-free-web/*.*] ${destroot}${prefix}/etc/${name}/assets/web/fonts/fontawesome-free-web - xinstall {*}[glob ${worksrcpath}/src_assets/common/assets/web/fonts/fontawesome-free-web/css/*.*] ${destroot}${prefix}/etc/${name}/assets/web/fonts/fontawesome-free-web/css - xinstall {*}[glob ${worksrcpath}/src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/*.*] ${destroot}${prefix}/etc/${name}/assets/web/fonts/fontawesome-free-web/webfonts - xinstall -d -m 755 ${destroot}${prefix}/etc/${name}/assets/web/images - xinstall -d -m 755 ${destroot}${prefix}/etc/${name}/assets/web/third_party - xinstall {*}[glob ${worksrcpath}/src_assets/common/assets/web/images/*.*] ${destroot}${prefix}/etc/${name}/assets/web/images - xinstall {*}[glob ${worksrcpath}/src_assets/common/assets/web/third_party/*.*] ${destroot}${prefix}/etc/${name}/assets/web/third_party - - xinstall -d -m 755 ${destroot}${prefix}/etc/${name}/config - - # install sunshine.conf - xinstall {*}[glob ${worksrcpath}/src_assets/common/config/*.*] ${destroot}${prefix}/etc/${name}/config - - # install apps.json - xinstall {*}[glob ${worksrcpath}/src_assets/macos/config/*.*] ${destroot}${prefix}/etc/${name}/config - - # install the binary - xinstall ${workpath}/build/${name} ${destroot}${prefix}/bin +# Rename files in `destroot` +post-destroot { + file rename ${destroot}${prefix}/etc/${name}/config/sunshine.conf ${destroot}${prefix}/etc/${name}/config/sunshine.conf.sample + file rename ${destroot}${prefix}/etc/${name}/config/apps.json ${destroot}${prefix}/etc/${name}/config/apps.json.sample +} + +# Don't overwrite existing preference files +post-activate { + if {![file exists ${prefix}/etc/${name}/config/sunshine.conf]} { + file copy ${destroot}${prefix}/etc/${name}/config/sunshine.conf.sample \ + ${prefix}/etc/${name}/config/sunshine.conf + } + if {![file exists ${prefix}/etc/${name}/config/apps.json]} { + file copy ${destroot}${prefix}/etc/${name}/config/apps.json.sample \ + ${prefix}/etc/${name}/config/apps.json + } }