Update Portfile

- Add `compiler.cxx_standard`
- Don't overwrite config files
- Fix `maintainers`
- Correct cmake configure arguments
- Remove `destroot`
- Use `git` instead of `github.setup`
- Set revision to 0
- Add long description
This commit is contained in:
ReenigneArcher 2022-06-20 22:53:40 -04:00
parent 9c4763af75
commit 6b64149591
3 changed files with 57 additions and 49 deletions

View File

@ -9,6 +9,17 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: 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: check_changelog:
name: Check Changelog name: Check Changelog
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -438,28 +449,25 @@ jobs:
- name: Configure Portfile - name: Configure Portfile
run: | run: |
# variables for Portfile # variables for Portfile
owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]' )
repo=$(echo ${GITHUB_REPOSITORY#*/} | tr '[:upper:]' '[:lower:]' )
branch=${GITHUB_HEAD_REF} branch=${GITHUB_HEAD_REF}
commit=${{ github.event.pull_request.head.sha }}
# check the branch variable # check the branch variable
if [ -z "$branch" ] if [ -z "$branch" ]
then then
echo "This is a PUSH event" echo "This is a PUSH event"
branch=branch=${{ github.ref_name }}
commit=${{ github.sha }} commit=${{ github.sha }}
clone_url=${{ github.event.repository.clone_url }}
else else
echo "This is a PR event" echo "This is a PR event"
commit=${{ github.event.pull_request.head.sha }}
clone_url=${{ github.event.pull_request.head.repo.clone_url }}
fi fi
echo "Owner: ${owner}"
echo "Repo: ${repo}"
echo "Branch: ${branch}"
echo "Commit: ${commit}" echo "Commit: ${commit}"
echo "Clone URL: ${clone_url}"
mkdir build mkdir build
cd 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 .. cd ..
@ -470,6 +478,9 @@ jobs:
# copy Portfile to ports # copy Portfile to ports
mkdir -p ./ports/multimedia/Sunshine mkdir -p ./ports/multimedia/Sunshine
cp -f ./build/Portfile ./ports/multimedia/Sunshine/Portfile cp -f ./build/Portfile ./ports/multimedia/Sunshine/Portfile
# testing
cat ./artifacts/Portfile
- name: Bootstrap MacPorts - name: Bootstrap MacPorts
run: | run: |

View File

@ -5,6 +5,10 @@ project(Sunshine VERSION 0.14.0
HOMEPAGE_URL "https://sunshinestream.github.io" 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_APPIMAGE "Configure files required for AppImage." OFF)
option(SUNSHINE_CONFIGURE_FLATPAK "Configure files required for Flatpak." OFF) option(SUNSHINE_CONFIGURE_FLATPAK "Configure files required for Flatpak." OFF)
option(SUNSHINE_CONFIGURE_PORTFILE "Configure MacOS Portfile." OFF) option(SUNSHINE_CONFIGURE_PORTFILE "Configure MacOS Portfile." OFF)

View File

@ -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 # -*- 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 PortSystem 1.0
PortGroup cmake 1.1 PortGroup cmake 1.1
PortGroup github 1.0 PortGroup github 1.0
PortGroup boost 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@ name @PROJECT_NAME@
version @PROJECT_VERSION@ version @PROJECT_VERSION@
revision 0
categories multimedia emulators games categories multimedia emulators games
platforms darwin platforms darwin
license GPL-3 license GPL-3
maintainers {@SunshineStream sunshinestream} maintainers @SunshineStream
description @PROJECT_DESCRIPTION@ 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 fetch.type git
git.url @GITHUB_CLONE_URL@
git.branch @GITHUB_COMMIT@
post-fetch { post-fetch {
system -W ${worksrcpath} "${git.cmd} submodule update --init --recursive" system -W ${worksrcpath} "${git.cmd} submodule update --init --recursive"
} }
@ -31,11 +37,9 @@ depends_lib port:avahi \
boost.version 1.76 boost.version 1.76
configure.args -DBOOST_ROOT=[boost::install_area] \ configure.args -DCMAKE_INSTALL_PREFIX=${prefix} \
-DSUNSHINE_ASSETS_DIR=${prefix}/etc/sunshine/assets \ -DSUNSHINE_ASSETS_DIR=etc/sunshine/assets \
-DSUNSHINE_CONFIG_DIR=${prefix}/etc/sunshine/config -DSUNSHINE_CONFIG_DIR=etc/sunshine/config
cmake.out_of_source yes
startupitem.create yes startupitem.create yes
startupitem.executable "${prefix}/bin/{$name}" startupitem.executable "${prefix}/bin/{$name}"
@ -50,33 +54,22 @@ platform darwin {
} }
} }
# is this actually necessary? this should all be handled by CMakeLists # destroot not required as cmake install directive handles moving files
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
# install web assets # Rename files in `destroot`
xinstall -d -m 755 ${destroot}${prefix}/etc/${name}/assets/web/fonts/fontawesome-free-web/css post-destroot {
xinstall -d -m 755 ${destroot}${prefix}/etc/${name}/assets/web/fonts/fontawesome-free-web/webfonts file rename ${destroot}${prefix}/etc/${name}/config/sunshine.conf ${destroot}${prefix}/etc/${name}/config/sunshine.conf.sample
xinstall {*}[glob ${worksrcpath}/src_assets/common/assets/web/*.*] ${destroot}${prefix}/etc/${name}/assets/web file rename ${destroot}${prefix}/etc/${name}/config/apps.json ${destroot}${prefix}/etc/${name}/config/apps.json.sample
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 # Don't overwrite existing preference files
xinstall -d -m 755 ${destroot}${prefix}/etc/${name}/assets/web/images post-activate {
xinstall -d -m 755 ${destroot}${prefix}/etc/${name}/assets/web/third_party if {![file exists ${prefix}/etc/${name}/config/sunshine.conf]} {
xinstall {*}[glob ${worksrcpath}/src_assets/common/assets/web/images/*.*] ${destroot}${prefix}/etc/${name}/assets/web/images file copy ${destroot}${prefix}/etc/${name}/config/sunshine.conf.sample \
xinstall {*}[glob ${worksrcpath}/src_assets/common/assets/web/third_party/*.*] ${destroot}${prefix}/etc/${name}/assets/web/third_party ${prefix}/etc/${name}/config/sunshine.conf
}
xinstall -d -m 755 ${destroot}${prefix}/etc/${name}/config if {![file exists ${prefix}/etc/${name}/config/apps.json]} {
file copy ${destroot}${prefix}/etc/${name}/config/apps.json.sample \
# install sunshine.conf ${prefix}/etc/${name}/config/apps.json
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
} }