From e78ec5c2ce9b70ba3ed16b509e0fa26ce6bb483c Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Thu, 16 Jun 2022 16:18:59 -0400 Subject: [PATCH 01/15] Add notes --- Portfile.in | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Portfile.in b/Portfile.in index 36a7d476..371b5cdf 100644 --- a/Portfile.in +++ b/Portfile.in @@ -43,6 +43,13 @@ startupitem.location LaunchDaemons startupitem.name ${name} startupitem.netchange yes +platform darwin { + if { ${os.major} < 20 } { + # See: https://github.com/SunshineStream/Sunshine/discussions/117#discussioncomment-2513494 + notes-append "Port is limited to software encoding, when used with macOS releases prior to Big Sur." + } +} + # is this actually necessary? this should all be handled by CMakeLists destroot { # install assets From 3663e35ecfb8df4598c04298f2e590116a17ca91 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Thu, 16 Jun 2022 16:55:16 -0400 Subject: [PATCH 02/15] Lint and built Portfile --- .github/workflows/CI.yml | 276 +++++++++++++++++++++++++-------------- 1 file changed, 179 insertions(+), 97 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 18d7e89c..50f00c69 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -340,103 +340,185 @@ jobs: last_version: ${{ needs.check_changelog.outputs.last_version }} release_body: ${{ needs.check_changelog.outputs.release_body }} -# build_mac_port: -# name: Macports -# runs-on: macos-11 -# needs: [check_changelog, build_mac] -# -# steps: -# - name: Cache Artifacts -# uses: actions/cache@v3 -# with: -# path: artifacts -# key: ${{ runner.os }}-artifacts -# -# - name: Setup Macports -# run : | -# # update paths for macports -# echo "/opt/local/sbin" >> $GITHUB_PATH -# echo "/opt/local/bin" >> $GITHUB_PATH -# -# # Set OpenSSL 1.1 as default -# # rm -rf /usr/local/opt/openssl -# # rm -rf /usr/local/bin/openssl -# # ln -sf /usr/local/Cellar/openssl@1.1/1.1.1o/bin/openssl /usr/local/bin/openssl -# # ln -sf /usr/local/Cellar/openssl@1.1/1.1.1o /usr/local/opt/openssl -# -# # download and extract macports -# curl -O https://distfiles.macports.org/MacPorts/MacPorts-2.7.2.tar.bz2 -# tar xf MacPorts-2.7.2.tar.bz2 -# -# # build macports -# cd MacPorts-2.7.2 -# ./configure -# make -# sudo make install -# cd ../ -# rm -rf MacPorts-2.7.2* -# -# - name: Configure Macports -# run: | -# # update sources -# sudo port -v selfupdate -# -# # use custom sources -# sudo chmod 777 /opt/local/etc/macports/sources.conf -# echo file://$(echo ~)/ports > /opt/local/etc/macports/sources.conf -# echo rsync://rsync.macports.org/macports/release/tarballs/ports.tar [default] >> /opt/local/etc/macports/sources.conf -# sudo chmod 644 /opt/local/etc/macports/sources.conf -# -# # setup custom port -# mkdir -p ~/ports/multimedia/sunshine -# -# # copy configured Portfile -# mv ./artifacts/Portfile ~/ports/multimedia/sunshine/ -# -# # remove remaining cached artifacts -# rm -r -f ./artifacts -# mkdir artifacts -# -# # index the ports -# cd ~/ports -# portindex -# -# - name: Build -# run: | -# # build port -# sudo port install sunshine \ -# || cat /opt/local/var/macports/logs/_Users_runner_ports_multimedia_sunshine/Sunshine/main.log \ -# && exit 1 -# -# # create packages -# sudo port dmg sunshine -# sudo port pkg sunshine -# -# # move -# mv $(port work sunshine)/Sunshine*.dmg ./artifacts/sunshine.dmg -# mv $(port work sunshine)/Sunshine*.ppkg ./artifacts/sunshine.pkg -# -# # testing only -# # ls ~/ports/multimedia/sunshine -# # cat ~/ports/multimedia/sunshine/Portfile -# # cat /opt/local/etc/macports/sources.conf -# # cat ~/ports/Portindex -# # port search sunshine -# -# - name: Upload Artifacts -# uses: actions/upload-artifact@v3 -# with: -# name: sunshine-macports -# path: artifacts/ -# -# - name: Create Release -# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} -# uses: SunshineStream/actions/create_release@master -# with: -# token: ${{ secrets.GITHUB_TOKEN }} -# next_version: ${{ needs.check_changelog.outputs.next_version }} -# last_version: ${{ needs.check_changelog.outputs.last_version }} -# release_body: ${{ needs.check_changelog.outputs.release_body }} + build_mac_port: + name: Macports + needs: [check_changelog, build_mac] + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ macos-10.15, macos-11, macos-12 ] + + steps: + - name: Cache Artifacts + uses: actions/cache@v3 + with: + path: artifacts + key: ${{ runner.os }}-artifacts + + - name: Checkout ports + uses: actions/checkout@v3 + with: + repository: macports/macports-ports + fetch-depth: 64 + path: ports + + - name: Checkout mpbb + uses: actions/checkout@v3 + with: + repository: macports/mpbb + path: mpbb + + - name: Bootstrap MacPorts + run: | + . ports/.github/workflows/bootstrap.sh + + - name: Setup Macports + run : | + # Add getopt, mpbb and the MacPorts paths to $PATH for the subsequent steps. + echo "/opt/mports/bin" >> $GITHUB_PATH + echo "${PWD}/mpbb" >> $GITHUB_PATH + echo "/opt/local/bin" >> $GITHUB_PATH + echo "/opt/local/sbin" >> $GITHUB_PATH + + # copy Portfile from artifacts to ports + mkdir -p ./ports/multimedia/Sunshine + cp -f ./artifacts/Portfile ./ports/multimedia/Sunshine/Portfile + + - name: Determine list of subports + id: subportlist + run: | + set -eu + port=Sunshine + subportlist="" + + echo "Listing subports for Sunshine" + new_subports=$(mpbb \ + --work-dir /tmp/mpbb \ + list-subports \ + --archive-site= \ + --archive-site-private= \ + --include-deps=no \ + "$port" \ + | tr '\n' ' ') + for subport in $new_subports; do + echo "$subport" + subportlist="$subportlist $subport" + done + echo "::set-output name=subportlist::${subportlist}" + + - name: Run port lint for all subports + run: | + set -eu + fail=0 + for subport in $subportlist; do + echo "::group::${subport}" + path=$(port file "$subport") + messagetype="warning" + if ! messages=$(port -q lint "$subport" 2>&1); then + messagetype="error" + fail=1 + fi + if [ -n "$messages" ]; then + echo "$messages" + # See https://github.com/actions/toolkit/issues/193#issuecomment-605394935 + encoded_messages="port lint ${subport}:%0A" + encoded_messages+="$(echo "${messages}" | sed -E 's/$/%0A/g' | tr -d '\n')" + echo "::${messagetype} file=${path#${PWD}/ports/},line=1,col=1::${encoded_messages}" + fi + echo "::endgroup::" + done + exit "$fail" + env: + subportlist: ${{ steps.subportlist.outputs.subportlist }} + + - name: Build subports + run: | + set -eu + fail=0 + for subport in $subportlist; do + workdir="/tmp/mpbb/$subport" + mkdir -p "$workdir/logs" + touch "$workdir/logs/dependencies-progress.txt" + echo "::group::Cleaning up between ports" + sudo mpbb --work-dir "$workdir" cleanup + echo "::endgroup::" + echo "::group::Installing dependencies for ${subport}" + sudo mpbb \ + --work-dir "$workdir" \ + install-dependencies \ + "$subport" >"$workdir/logs/install-dependencies.log" 2>&1 & + deps_pid=$! + tail -f "$workdir/logs/dependencies-progress.txt" 2>/dev/null & + tail_pid=$! + set +e + wait "$deps_pid" + deps_exit=$? + set -e + kill "$tail_pid" || true + if [ "$deps_exit" -ne 0 ]; then + echo "::endgroup::" + echo "::error::Failed to install dependencies for ${subport}" + fail=1 + continue + fi + echo "::endgroup::" + echo "::group::Installing ${subport}" + set +e + sudo mpbb \ + --work-dir "$workdir" \ + install-port \ + --source \ + "$subport" + install_exit=$? + set -e + if [ "$install_exit" -ne 0 ]; then + echo "::endgroup::" + echo "::error::Failed to install ${subport}" + fail=1 + continue + fi + echo "::endgroup::" + done + exit "$fail" + env: + subportlist: ${{ steps.subportlist.outputs.subportlist }} + + - name: Package + run: | + # build port + # sudo port install sunshine \ + # || cat /opt/local/var/macports/logs/_Users_runner_ports_multimedia_sunshine/Sunshine/main.log \ + # && exit 1 + + # create packages + sudo port dmg sunshine + sudo port pkg sunshine + + # move + mv $(port work sunshine)/Sunshine*.dmg ./artifacts/sunshine.dmg + mv $(port work sunshine)/Sunshine*.ppkg ./artifacts/sunshine.pkg + + # testing only + # ls ~/ports/multimedia/sunshine + # cat ~/ports/multimedia/sunshine/Portfile + # cat /opt/local/etc/macports/sources.conf + # cat ~/ports/Portindex + # port search sunshine + + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: sunshine-macports + path: artifacts/ + + - name: Create Release + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + uses: SunshineStream/actions/create_release@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + next_version: ${{ needs.check_changelog.outputs.next_version }} + last_version: ${{ needs.check_changelog.outputs.last_version }} + release_body: ${{ needs.check_changelog.outputs.release_body }} build_win: name: Windows From 4a0d632c6ed51491d748d3d078e75d77da506468 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Thu, 16 Jun 2022 16:55:16 -0400 Subject: [PATCH 03/15] Lint and built Portfile --- .github/workflows/CI.yml | 281 +++++++++++++++++++++++++-------------- 1 file changed, 183 insertions(+), 98 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 18d7e89c..71a86ab8 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -297,7 +297,7 @@ jobs: - name: Package MacOS run: | # remove cached artifacts - rm -r -f ./artifacts + rm -r -f ./artifacts/ mkdir artifacts mkdir -p artifacts @@ -340,103 +340,188 @@ jobs: last_version: ${{ needs.check_changelog.outputs.last_version }} release_body: ${{ needs.check_changelog.outputs.release_body }} -# build_mac_port: -# name: Macports -# runs-on: macos-11 -# needs: [check_changelog, build_mac] -# -# steps: -# - name: Cache Artifacts -# uses: actions/cache@v3 -# with: -# path: artifacts -# key: ${{ runner.os }}-artifacts -# -# - name: Setup Macports -# run : | -# # update paths for macports -# echo "/opt/local/sbin" >> $GITHUB_PATH -# echo "/opt/local/bin" >> $GITHUB_PATH -# -# # Set OpenSSL 1.1 as default -# # rm -rf /usr/local/opt/openssl -# # rm -rf /usr/local/bin/openssl -# # ln -sf /usr/local/Cellar/openssl@1.1/1.1.1o/bin/openssl /usr/local/bin/openssl -# # ln -sf /usr/local/Cellar/openssl@1.1/1.1.1o /usr/local/opt/openssl -# -# # download and extract macports -# curl -O https://distfiles.macports.org/MacPorts/MacPorts-2.7.2.tar.bz2 -# tar xf MacPorts-2.7.2.tar.bz2 -# -# # build macports -# cd MacPorts-2.7.2 -# ./configure -# make -# sudo make install -# cd ../ -# rm -rf MacPorts-2.7.2* -# -# - name: Configure Macports -# run: | -# # update sources -# sudo port -v selfupdate -# -# # use custom sources -# sudo chmod 777 /opt/local/etc/macports/sources.conf -# echo file://$(echo ~)/ports > /opt/local/etc/macports/sources.conf -# echo rsync://rsync.macports.org/macports/release/tarballs/ports.tar [default] >> /opt/local/etc/macports/sources.conf -# sudo chmod 644 /opt/local/etc/macports/sources.conf -# -# # setup custom port -# mkdir -p ~/ports/multimedia/sunshine -# -# # copy configured Portfile -# mv ./artifacts/Portfile ~/ports/multimedia/sunshine/ -# -# # remove remaining cached artifacts -# rm -r -f ./artifacts -# mkdir artifacts -# -# # index the ports -# cd ~/ports -# portindex -# -# - name: Build -# run: | -# # build port -# sudo port install sunshine \ -# || cat /opt/local/var/macports/logs/_Users_runner_ports_multimedia_sunshine/Sunshine/main.log \ -# && exit 1 -# -# # create packages -# sudo port dmg sunshine -# sudo port pkg sunshine -# -# # move -# mv $(port work sunshine)/Sunshine*.dmg ./artifacts/sunshine.dmg -# mv $(port work sunshine)/Sunshine*.ppkg ./artifacts/sunshine.pkg -# -# # testing only -# # ls ~/ports/multimedia/sunshine -# # cat ~/ports/multimedia/sunshine/Portfile -# # cat /opt/local/etc/macports/sources.conf -# # cat ~/ports/Portindex -# # port search sunshine -# -# - name: Upload Artifacts -# uses: actions/upload-artifact@v3 -# with: -# name: sunshine-macports -# path: artifacts/ -# -# - name: Create Release -# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} -# uses: SunshineStream/actions/create_release@master -# with: -# token: ${{ secrets.GITHUB_TOKEN }} -# next_version: ${{ needs.check_changelog.outputs.next_version }} -# last_version: ${{ needs.check_changelog.outputs.last_version }} -# release_body: ${{ needs.check_changelog.outputs.release_body }} + build_mac_port: + name: Macports + needs: [check_changelog, build_mac] + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ macos-10.15, macos-11, macos-12 ] + + steps: + - name: Cache Artifacts + uses: actions/cache@v3 + with: + path: artifacts + key: ${{ runner.os }}-artifacts + + - name: Checkout ports + uses: actions/checkout@v3 + with: + repository: macports/macports-ports + fetch-depth: 64 + path: ports + + - name: Checkout mpbb + uses: actions/checkout@v3 + with: + repository: macports/mpbb + path: mpbb + + - name: Bootstrap MacPorts + run: | + # copy Portfile from artifacts to ports + mkdir -p ./ports/multimedia/Sunshine + cp -f ./artifacts/Portfile ./ports/multimedia/Sunshine/Portfile + + # display the Portfile + cat ./ports/multimedia/Sunshine/Portfile + + . ports/.github/workflows/bootstrap.sh + + - name: Setup Macports + run : | + # Add getopt, mpbb and the MacPorts paths to $PATH for the subsequent steps. + echo "/opt/mports/bin" >> $GITHUB_PATH + echo "${PWD}/mpbb" >> $GITHUB_PATH + echo "/opt/local/bin" >> $GITHUB_PATH + echo "/opt/local/sbin" >> $GITHUB_PATH + + - name: Determine list of subports + id: subportlist + run: | + set -eu + port=Sunshine + subportlist="" + + echo "Listing subports for Sunshine" + new_subports=$(mpbb \ + --work-dir /tmp/mpbb \ + list-subports \ + --archive-site= \ + --archive-site-private= \ + --include-deps=no \ + "$port" \ + | tr '\n' ' ') + for subport in $new_subports; do + echo "$subport" + subportlist="$subportlist $subport" + done + echo "::set-output name=subportlist::${subportlist}" + + - name: Run port lint for all subports + run: | + set -eu + fail=0 + for subport in $subportlist; do + echo "::group::${subport}" + path=$(port file "$subport") + messagetype="warning" + if ! messages=$(port -q lint "$subport" 2>&1); then + messagetype="error" + fail=1 + fi + if [ -n "$messages" ]; then + echo "$messages" + # See https://github.com/actions/toolkit/issues/193#issuecomment-605394935 + encoded_messages="port lint ${subport}:%0A" + encoded_messages+="$(echo "${messages}" | sed -E 's/$/%0A/g' | tr -d '\n')" + echo "::${messagetype} file=${path#${PWD}/ports/},line=1,col=1::${encoded_messages}" + fi + echo "::endgroup::" + done + exit "$fail" + env: + subportlist: ${{ steps.subportlist.outputs.subportlist }} + + - name: Build subports + run: | + set -eu + fail=0 + for subport in $subportlist; do + workdir="/tmp/mpbb/$subport" + mkdir -p "$workdir/logs" + touch "$workdir/logs/dependencies-progress.txt" + echo "::group::Cleaning up between ports" + sudo mpbb --work-dir "$workdir" cleanup + echo "::endgroup::" + echo "::group::Installing dependencies for ${subport}" + sudo mpbb \ + --work-dir "$workdir" \ + install-dependencies \ + "$subport" >"$workdir/logs/install-dependencies.log" 2>&1 & + deps_pid=$! + tail -f "$workdir/logs/dependencies-progress.txt" 2>/dev/null & + tail_pid=$! + set +e + wait "$deps_pid" + deps_exit=$? + set -e + kill "$tail_pid" || true + if [ "$deps_exit" -ne 0 ]; then + echo "::endgroup::" + echo "::error::Failed to install dependencies for ${subport}" + fail=1 + continue + fi + echo "::endgroup::" + echo "::group::Installing ${subport}" + set +e + sudo mpbb \ + --work-dir "$workdir" \ + install-port \ + --source \ + "$subport" + install_exit=$? + set -e + if [ "$install_exit" -ne 0 ]; then + echo "::endgroup::" + echo "::error::Failed to install ${subport}" + fail=1 + continue + fi + echo "::endgroup::" + done + exit "$fail" + env: + subportlist: ${{ steps.subportlist.outputs.subportlist }} + + - name: Package + run: | + # build port + # sudo port install sunshine \ + # || cat /opt/local/var/macports/logs/_Users_runner_ports_multimedia_sunshine/Sunshine/main.log \ + # && exit 1 + + # create packages + sudo port dmg sunshine + sudo port pkg sunshine + + # move + mv $(port work sunshine)/Sunshine*.dmg ./artifacts/sunshine.dmg + mv $(port work sunshine)/Sunshine*.ppkg ./artifacts/sunshine.pkg + + # testing only + # ls ~/ports/multimedia/sunshine + # cat ~/ports/multimedia/sunshine/Portfile + # cat /opt/local/etc/macports/sources.conf + # cat ~/ports/Portindex + # port search sunshine + + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: sunshine-macports + path: artifacts/ + + - name: Create Release + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + uses: SunshineStream/actions/create_release@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + next_version: ${{ needs.check_changelog.outputs.next_version }} + last_version: ${{ needs.check_changelog.outputs.last_version }} + release_body: ${{ needs.check_changelog.outputs.release_body }} build_win: name: Windows From 9c4763af752c72316cc6099b39a6427c0c5c2a31 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Sat, 18 Jun 2022 13:05:34 -0400 Subject: [PATCH 04/15] Configure Portfile in Macports job --- .github/workflows/CI.yml | 132 +++++++++++++++++++-------------------- 1 file changed, 64 insertions(+), 68 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c97883ee..3da5a4b0 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -346,13 +346,6 @@ jobs: with: submodules: recursive - # this is for the macports job - - name: Cache Artifacts - uses: actions/cache@v3 - with: - path: artifacts - key: ${{ runner.os }}-artifacts - - name: Setup Dependencies MacOS run: | # install dependencies using homebrew @@ -363,29 +356,9 @@ jobs: - name: Build MacOS 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 }} - else - echo "This is a PR event" - fi - echo "Owner: ${owner}" - echo "Repo: ${repo}" - echo "Branch: ${branch}" - echo "Commit: ${commit}" - mkdir build cd build - 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 .. + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DSUNSHINE_ASSETS_DIR=local/sunshine/assets -DSUNSHINE_CONFIG_DIR=local/sunshine/config .. make -j ${nproc} - name: Package MacOS @@ -407,9 +380,6 @@ jobs: cpack -G ZIP mv ./cpack_artifacts/Sunshine.zip ../artifacts/sunshine-macos-experimental-archive.zip - # move - mv Portfile ../artifacts/Portfile - - name: Upload Artifacts uses: actions/upload-artifact@v3 with: @@ -436,18 +406,16 @@ jobs: build_mac_port: name: Macports - needs: [check_changelog, build_mac] + needs: check_changelog runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [ macos-10.15, macos-11, macos-12 ] steps: - - name: Cache Artifacts - uses: actions/cache@v3 - with: - path: artifacts - key: ${{ runner.os }}-artifacts + - name: Checkout + uses: actions/checkout@v3 - name: Checkout ports uses: actions/checkout@v3 @@ -462,28 +430,56 @@ jobs: repository: macports/mpbb path: mpbb + - name: Setup Dependencies Macports + run: | + # install dependencies using homebrew + brew install cmake + + - 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 }} + else + echo "This is a PR event" + fi + echo "Owner: ${owner}" + echo "Repo: ${repo}" + echo "Branch: ${branch}" + echo "Commit: ${commit}" + + mkdir build + cd build + cmake -DGITHUB_OWNER=${owner} -DGITHUB_REPO=${repo} -DGITHUB_BRANCH=${branch} -DSUNSHINE_CONFIGURE_PORTFILE=ON -DSUNSHINE_CONFIGURE_ONLY=ON .. + + cd .. + + # copy Portfile to artifacts + mkdir -p artifacts + cp -f ./build/Portfile ./artifacts/ + + # copy Portfile to ports + mkdir -p ./ports/multimedia/Sunshine + cp -f ./build/Portfile ./ports/multimedia/Sunshine/Portfile + - name: Bootstrap MacPorts run: | - # copy Portfile from artifacts to ports - mkdir -p ./ports/multimedia/Sunshine - cp -f ./artifacts/Portfile ./ports/multimedia/Sunshine/Portfile - - # display the Portfile - cat ./ports/multimedia/Sunshine/Portfile - . ports/.github/workflows/bootstrap.sh - - - name: Setup Macports - run : | + # Add getopt, mpbb and the MacPorts paths to $PATH for the subsequent steps. echo "/opt/mports/bin" >> $GITHUB_PATH echo "${PWD}/mpbb" >> $GITHUB_PATH echo "/opt/local/bin" >> $GITHUB_PATH echo "/opt/local/sbin" >> $GITHUB_PATH - - # copy Portfile from artifacts to ports - mkdir -p ./ports/multimedia/Sunshine - cp -f ./artifacts/Portfile ./ports/multimedia/Sunshine/Portfile - name: Determine list of subports id: subportlist @@ -586,30 +582,30 @@ jobs: - name: Package run: | - # build port - # sudo port install sunshine \ - # || cat /opt/local/var/macports/logs/_Users_runner_ports_multimedia_sunshine/Sunshine/main.log \ - # && exit 1 - # create packages - sudo port dmg sunshine sudo port pkg sunshine + sudo port dmg sunshine - # move - mv $(port work sunshine)/Sunshine*.dmg ./artifacts/sunshine.dmg - mv $(port work sunshine)/Sunshine*.ppkg ./artifacts/sunshine.pkg - - # testing only - # ls ~/ports/multimedia/sunshine - # cat ~/ports/multimedia/sunshine/Portfile - # cat /opt/local/etc/macports/sources.conf - # cat ~/ports/Portindex - # port search sunshine + work=$(port work sunshine) + echo "Sunshine port work directory: ${work}" + + # testing + ls ${work} + + # move components out of port work directory + sudo mv ${work}/Sunshine*component.pkg /tmp/ + + # copy artifacts + sudo mv ${work}/Sunshine*.pkg ./artifacts/sunshine.pkg + sudo mv ${work}/Sunshine*.dmg ./artifacts/sunshine.dmg + + # move components back + # sudo mv /tmp/Sunshine*component.pkg ${work}/ - name: Upload Artifacts uses: actions/upload-artifact@v3 with: - name: sunshine-macports + name: sunshine-macports-${{ matrix.os }} path: artifacts/ - name: Create Release From 6b641495913f6d724c6116db1da1b1a54dde02ce Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Mon, 20 Jun 2022 22:53:40 -0400 Subject: [PATCH 05/15] 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 --- .github/workflows/CI.yml | 27 ++++++++++----- CMakeLists.txt | 4 +++ packaging/macos/Portfile | 75 ++++++++++++++++++---------------------- 3 files changed, 57 insertions(+), 49 deletions(-) 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 + } } From 802e5c79fa822ca1e12b8c29db3f81c457712dee Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Wed, 22 Jun 2022 19:20:04 -0400 Subject: [PATCH 06/15] Add config option `SUNSHINE_MACOS_PACKAGE` - Refactor UNIX/APPLE packaging --- CMakeLists.txt | 86 +++++++++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 884c14dc..5382a5e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,6 +151,9 @@ if(WIN32) set_source_files_properties(third-party/ViGEmClient/src/ViGEmClient.cpp PROPERTIES COMPILE_FLAGS "-Wno-unknown-pragmas -Wno-misleading-indentation -Wno-class-memaccess") elseif(APPLE) add_compile_definitions(SUNSHINE_PLATFORM="macos") + + option(SUNSHINE_MACOS_PACKAGE "Should only be used when creating a MACOS package/dmg." OFF) + link_directories(/opt/local/lib) link_directories(/usr/local/lib) ADD_DEFINITIONS(-DBOOST_LOG_DYN_LINK) @@ -560,57 +563,62 @@ if(WIN32) # see options at: https://cmake.org/cmake/help/latest/cpack_gen/nsis.h set(CPACK_COMPONENT_SUNSHINESVC_DESCRIPTION "CLI tool that allows you to enable/disable the Sunshine service.") 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}") -endif() -if(APPLE) # TODO: test - - set(prefix "${CMAKE_PROJECT_NAME}.app/Contents") - set(INSTALL_RUNTIME_DIR "${prefix}/MacOS") - - install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}") - - install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}") - - install(TARGETS sunshine - BUNDLE DESTINATION . COMPONENT Runtime - RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} COMPONENT Runtime) - +if(APPLE) # TODO: bundle doesn't produce a valid .app use cpack -G DragNDrop set(CPACK_BUNDLE_NAME "${CMAKE_PROJECT_NAME}") set(CPACK_BUNDLE_PLIST "${APPLE_PLIST_FILE}") set(CPACK_BUNDLE_ICON "${PROJECT_SOURCE_DIR}/sunshine.icns") # set(CPACK_BUNDLE_STARTUP_COMMAND "${INSTALL_RUNTIME_DIR}/sunshine") endif() -if(UNIX AND NOT APPLE) - install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}") +if(APPLE AND SUNSHINE_MACOS_PACKAGE) # TODO + set(prefix "${CMAKE_PROJECT_NAME}.app/Contents") + set(INSTALL_RUNTIME_DIR "${prefix}/MacOS") - install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}") + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}") + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}") - install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/85-sunshine-rules.rules" DESTINATION "/etc/udev/rules.d") + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}") + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}") + + install(TARGETS sunshine + BUNDLE DESTINATION . COMPONENT Runtime + RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} COMPONENT Runtime) +elseif(UNIX) + # Installation destination dir + set(CPACK_SET_DESTDIR true) + if(NOT CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local/sunshine") + endif() 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 - "${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") + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}") + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}") - # Dependencies - set(CPACK_DEB_COMPONENT_INSTALL ON) - set(CPACK_DEBIAN_PACKAGE_DEPENDS "openssl, 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 "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 + if(APPLE) + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}") + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}") + else() + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}") + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}") + + install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/85-sunshine-rules.rules" DESTINATION "/etc/udev/rules.d") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service" DESTINATION "${CMAKE_INSTALL_LIBDIR}/systemd/user") + + # Pre and post install + set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA + "${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 "openssl, 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 "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 + endif() endif() include(CPack) From c61b31e8a6732977d11c6304014d69172eac012d Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Wed, 22 Jun 2022 21:42:10 -0400 Subject: [PATCH 07/15] Create uninstall_pkg.sh --- CMakeLists.txt | 2 ++ src_assets/macos/misc/uninstall_pkg.sh | 39 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src_assets/macos/misc/uninstall_pkg.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 5382a5e7..ba27a8a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -598,6 +598,8 @@ elseif(UNIX) if(APPLE) install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}") install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}") + + install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/misc/uninstall_pkg.sh" DESTINATION "${SUNSHINE_ASSETS_DIR}") else() install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}") install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}") diff --git a/src_assets/macos/misc/uninstall_pkg.sh b/src_assets/macos/misc/uninstall_pkg.sh new file mode 100644 index 00000000..8cc7f62c --- /dev/null +++ b/src_assets/macos/misc/uninstall_pkg.sh @@ -0,0 +1,39 @@ +#!/bin/bash -e +set -e + +FILES=(pkgutil --files org.macports.Sunshine) + +remove_config=True +remove_apps=True + +for n in {1..2}; do + echo "Loop: $n" + for file in "${FILES[@]}"; do + if [[ $file == *sunshine.conf ]]; then + if [ $remove_config == True ]; then + while true; do + read -p -r "Do you wish to remove 'sunshine.conf'?" yn + case $yn in + [Yy]* ) rm --force "$file"; break;; + [Nn]* ) remove_config=False; break;; + * ) echo "Please answer yes or no.";; + esac + done + fi + fi + if [[ $file == *apps.json ]]; then + if [ $remove_apps == True ]; then + while true; do + read -p -r "Do you wish to remove 'apps.conf'?" yn + case $yn in + [Yy]* ) rm --force "$file"; break;; + [Nn]* ) remove_apps=False; break;; + * ) echo "Please answer yes or no.";; + esac + done + fi + fi + + rm --force --dir "$file" + done +done From a1d8cc22968eaade1fada30ce61f8cd6fce336ef Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Wed, 22 Jun 2022 21:43:18 -0400 Subject: [PATCH 08/15] Update installation.rst --- docs/source/about/installation.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/source/about/installation.rst b/docs/source/about/installation.rst index 9973b820..e175bd99 100644 --- a/docs/source/about/installation.rst +++ b/docs/source/about/installation.rst @@ -99,6 +99,16 @@ RPM Package MacOS ----- +Requirements + .. table:: + :widths: auto + + =========== ============= + requirement reason + =========== ============= + macOS 10.8+ Video Toolbox + =========== ============= + .. image:: https://img.shields.io/github/issues/sunshinestream/sunshine/os:macos?logo=github&style=for-the-badge :alt: GitHub issues by-label From 7019756fa1ed368f1f9d79cd37c25f98bde01df0 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Thu, 23 Jun 2022 20:42:18 -0400 Subject: [PATCH 09/15] Fix macos uninstall pkg script --- src_assets/macos/misc/uninstall_pkg.sh | 75 ++++++++++++++++---------- 1 file changed, 47 insertions(+), 28 deletions(-) diff --git a/src_assets/macos/misc/uninstall_pkg.sh b/src_assets/macos/misc/uninstall_pkg.sh index 8cc7f62c..69f31df1 100644 --- a/src_assets/macos/misc/uninstall_pkg.sh +++ b/src_assets/macos/misc/uninstall_pkg.sh @@ -1,39 +1,58 @@ #!/bin/bash -e set -e -FILES=(pkgutil --files org.macports.Sunshine) +package_name=org.macports.Sunshine + +echo "Removing files now..." +FILES=$(pkgutil --files --only-files $package_name) remove_config=True remove_apps=True -for n in {1..2}; do - echo "Loop: $n" - for file in "${FILES[@]}"; do - if [[ $file == *sunshine.conf ]]; then - if [ $remove_config == True ]; then - while true; do - read -p -r "Do you wish to remove 'sunshine.conf'?" yn - case $yn in - [Yy]* ) rm --force "$file"; break;; - [Nn]* ) remove_config=False; break;; - * ) echo "Please answer yes or no.";; - esac - done - fi +for file in ${FILES}; do + file="/$file" + remove_current=True + if [[ $file == *sunshine.conf ]]; then + if [[ $remove_config == True ]]; then + while true; do + read -p -r "Do you wish to remove 'sunshine.conf'?" yn + case $yn in + [Yy]* ) echo "removing: $file"; rm -f "$file"; break;; + [Nn]* ) remove_config=False; remove_current=False; break;; + * ) echo "Please answer yes or no.";; + esac + done fi - if [[ $file == *apps.json ]]; then - if [ $remove_apps == True ]; then - while true; do - read -p -r "Do you wish to remove 'apps.conf'?" yn - case $yn in - [Yy]* ) rm --force "$file"; break;; - [Nn]* ) remove_apps=False; break;; - * ) echo "Please answer yes or no.";; - esac - done - fi + fi + if [[ $file == *apps.json ]]; then + if [[ $remove_apps == True ]]; then + while true; do + read -p -r "Do you wish to remove 'apps.conf'?" yn + case $yn in + [Yy]* ) echo "removing: $file"; rm -f "$file"; break;; + [Nn]* ) remove_apps=False; remove_current=False; break;; + * ) echo "Please answer yes or no.";; + esac + done fi + fi - rm --force --dir "$file" - done + if [[ $remove_current == True ]]; then + echo "removing: $file" + rm -f "$file" + fi done + +echo "Removing directories now..." +DIRECTORIES=$(pkgutil --files --only-dirs org.macports.Sunshine) + +for dir in ${DIRECTORIES}; do + dir="/$dir" + echo "Checking if empty directory: $dir" + find "$dir" -type d -empty -exec rm -f -d {} \; +done + +echo "Forgetting Sunshine..." +pkgutil --forget $package_name + +echo "Sunshine has been uninstalled..." From 46dede3381babb59ea17b3c2b6d7c323fd176840 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Thu, 23 Jun 2022 22:58:27 -0400 Subject: [PATCH 10/15] Disable matrix for Macports - Currently cannot build Sunshine on macOS < 10.8 due to missing video toolbox framework --- .github/workflows/CI.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 66e7d6da..af348f7b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -418,11 +418,12 @@ jobs: build_mac_port: name: Macports needs: check_changelog - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ macos-10.15, macos-11, macos-12 ] + runs-on: macos-11 +# runs-on: ${{ matrix.os }} +# strategy: +# fail-fast: false +# matrix: +# os: [ macos-10.15, macos-11, macos-12 ] steps: - name: Checkout @@ -616,7 +617,7 @@ jobs: - name: Upload Artifacts uses: actions/upload-artifact@v3 with: - name: sunshine-macports-${{ matrix.os }} + name: sunshine-macports path: artifacts/ - name: Create Release From 25e21ee807b13c822b3406ad8fabe101d127f750 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Sat, 25 Jun 2022 19:10:47 -0400 Subject: [PATCH 11/15] Fix removing directories for macos uninstall_pkg --- src_assets/macos/misc/uninstall_pkg.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src_assets/macos/misc/uninstall_pkg.sh b/src_assets/macos/misc/uninstall_pkg.sh index 69f31df1..7e136109 100644 --- a/src_assets/macos/misc/uninstall_pkg.sh +++ b/src_assets/macos/misc/uninstall_pkg.sh @@ -4,7 +4,7 @@ set -e package_name=org.macports.Sunshine echo "Removing files now..." -FILES=$(pkgutil --files --only-files $package_name) +FILES=$(pkgutil --files $package_name --only-files) remove_config=True remove_apps=True @@ -44,12 +44,22 @@ for file in ${FILES}; do done echo "Removing directories now..." -DIRECTORIES=$(pkgutil --files --only-dirs org.macports.Sunshine) +DIRECTORIES=$(pkgutil --files org.macports.Sunshine --only-dirs) for dir in ${DIRECTORIES}; do dir="/$dir" echo "Checking if empty directory: $dir" - find "$dir" -type d -empty -exec rm -f -d {} \; + + # check if directory is empty... could just use ${DIRECTORIES} here if pkgutils added the `/` prefix + empty_dir=$(find "$dir" -depth 0 -type d -empty) + + # remove the directory if it is empty + if [[ $empty_dir != "" ]]; then # prevent the loop from running and failing if no directories found + for i in "${empty_dir}"; do # don't split words as we already know this will be a single directory + echo "Removing empty directory: ${i}" + rmdir "${i}" + done + fi done echo "Forgetting Sunshine..." From 4f07672cfa5af859691f3340f8c2f18dab12fb22 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Sat, 25 Jun 2022 20:02:40 -0400 Subject: [PATCH 12/15] CI cleanup --- .github/workflows/CI.yml | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index af348f7b..c3ee11fd 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -374,10 +374,6 @@ jobs: - name: Package MacOS run: | - # remove cached artifacts - rm -r -f ./artifacts/ - mkdir artifacts - mkdir -p artifacts cd build @@ -406,14 +402,15 @@ jobs: rm -f ./sunshine-macos-experimental-bundle.dmg rm -f ./sunshine-macos-experimental-archive.zip - - name: Create Release - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} - uses: SunshineStream/actions/create_release@master - with: - token: ${{ secrets.GITHUB_TOKEN }} - next_version: ${{ needs.check_changelog.outputs.next_version }} - last_version: ${{ needs.check_changelog.outputs.last_version }} - release_body: ${{ needs.check_changelog.outputs.release_body }} + # no artifacts to release currently +# - name: Create Release +# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} +# uses: SunshineStream/actions/create_release@master +# with: +# token: ${{ secrets.GITHUB_TOKEN }} +# next_version: ${{ needs.check_changelog.outputs.next_version }} +# last_version: ${{ needs.check_changelog.outputs.last_version }} +# release_body: ${{ needs.check_changelog.outputs.release_body }} build_mac_port: name: Macports @@ -601,9 +598,6 @@ jobs: work=$(port work sunshine) echo "Sunshine port work directory: ${work}" - # testing - ls ${work} - # move components out of port work directory sudo mv ${work}/Sunshine*component.pkg /tmp/ From 3cd3d261e97f43a7f2873494200da8dd6fe8ad31 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Tue, 28 Jun 2022 19:16:24 -0400 Subject: [PATCH 13/15] Update macOS documentation --- CMakeLists.txt | 4 ++-- README.rst | 15 +++++++++------ docs/source/about/advanced_usage.rst | 22 +++++++++++----------- docs/source/about/installation.rst | 9 ++++++--- docs/source/about/usage.rst | 4 ++-- docs/source/building/build.rst | 2 +- docs/source/building/macos.rst | 6 +++--- docs/source/troubleshooting/macos.rst | 17 ++++++++++++++++- sunshine/platform/common.h | 2 +- 9 files changed, 51 insertions(+), 30 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ba27a8a5..86a68db0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,12 +6,12 @@ project(Sunshine VERSION 0.14.0 ) 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. \ +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) +option(SUNSHINE_CONFIGURE_PORTFILE "Configure macOS Portfile." OFF) option(SUNSHINE_CONFIGURE_ONLY "Configure special files only, then exit." OFF) if(${SUNSHINE_CONFIGURE_APPIMAGE}) diff --git a/README.rst b/README.rst index 24d0c161..95408df8 100644 --- a/README.rst +++ b/README.rst @@ -6,19 +6,22 @@ SunshineStream has the full documentation hosted on `Read the Docs `_ or `BlackHole `_. @@ -395,7 +395,7 @@ Examples audio_sink = alsa_output.pci-0000_09_00.3.analog-stereo - MacOS + macOS .. code-block:: text audio_sink = BlackHole 2ch @@ -993,7 +993,7 @@ vt_software Description Force Video Toolbox to use software encoding. - .. Note:: This option only applies when using MacOS. + .. Note:: This option only applies when using macOS. **Choices** @@ -1023,7 +1023,7 @@ vt_realtime Description Realtime encoding. - .. Note:: This option only applies when using MacOS. + .. Note:: This option only applies when using macOS. .. Warning:: Disabling realtime encoding might result in a delayed frame encoding or frame drop. @@ -1041,7 +1041,7 @@ vt_coder Description The entropy encoding to use. - .. Note:: This option only applies when using MacOS. + .. Note:: This option only applies when using macOS. **Choices** diff --git a/docs/source/about/installation.rst b/docs/source/about/installation.rst index e175bd99..ed8e9ac1 100644 --- a/docs/source/about/installation.rst +++ b/docs/source/about/installation.rst @@ -9,8 +9,6 @@ Binaries Binaries of Sunshine are created for each release. They are available for Linux, and Windows. Binaries can be found in the `latest release`_. -.. Todo:: Create binary package(s) for MacOS. See `here `_. - .. Tip:: Some third party packages also exist. See :ref:`Third Party Packages `. @@ -97,7 +95,7 @@ RPM Package .. Tip:: You can double click the rpm file to see details about the package and begin installation. -MacOS +macOS ----- Requirements .. table:: @@ -112,6 +110,11 @@ Requirements .. image:: https://img.shields.io/github/issues/sunshinestream/sunshine/os:macos?logo=github&style=for-the-badge :alt: GitHub issues by-label +pkg + .. Warning:: The `pkg` does not include runtime dependencies and should be considered experimental. + + #. Download the ``sunshine.pkg`` file and install it as normal. + Portfile #. Install `MacPorts `_ #. Update the Macports sources. diff --git a/docs/source/about/usage.rst b/docs/source/about/usage.rst index 8ae0287c..92038cf9 100644 --- a/docs/source/about/usage.rst +++ b/docs/source/about/usage.rst @@ -27,7 +27,7 @@ Usage list of applications that are started just before running a stream. This is the directory within the GitHub repo. - .. Attention:: Application list is not fully supported on MacOS + .. Attention:: Application list is not fully supported on macOS #. In Moonlight, you may need to add the PC manually. #. When Moonlight request you insert the correct pin on sunshine: @@ -137,7 +137,7 @@ Sunshine needs access to `uinput` to create mouse and gamepad events. sudo reboot now -MacOS +macOS ^^^^^ Sunshine can only access microphones on macOS due to system limitations. To stream system audio use `Soundflower `_ or diff --git a/docs/source/building/build.rst b/docs/source/building/build.rst index cd83cb14..a703959d 100644 --- a/docs/source/building/build.rst +++ b/docs/source/building/build.rst @@ -22,7 +22,7 @@ Compile See the section specific to your OS. - :ref:`Linux ` -- :ref:`MacOS ` +- :ref:`macOS ` - :ref:`Windows ` Remote Build diff --git a/docs/source/building/macos.rst b/docs/source/building/macos.rst index 51ae6b15..d20a5517 100644 --- a/docs/source/building/macos.rst +++ b/docs/source/building/macos.rst @@ -1,11 +1,11 @@ :github_url: https://github.com/SunshineStream/Sunshine/tree/nightly/docs/source/building/macos.rst -MacOS +macOS ===== Requirements ------------ -MacOS Big Sur and Xcode 12.5+ +macOS Big Sur and Xcode 12.5+ Use either `MacPorts `_ or `Homebrew `_ @@ -35,7 +35,7 @@ Build cmake .. make -j ${nproc} - cpack -G DragNDrop # optionally, create a MacOS dmg package + cpack -G DragNDrop # optionally, create a macOS dmg package If cmake fails complaining to find Boost, try to set the path explicitly. diff --git a/docs/source/troubleshooting/macos.rst b/docs/source/troubleshooting/macos.rst index 18ea9361..5a6ae658 100644 --- a/docs/source/troubleshooting/macos.rst +++ b/docs/source/troubleshooting/macos.rst @@ -1,6 +1,6 @@ :github_url: https://github.com/SunshineStream/Sunshine/tree/nightly/docs/source/troubleshooting/macos.rst -MacOS +macOS ===== If you get this error: @@ -12,3 +12,18 @@ If you get this error: .. code-block:: bash launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist + +Uninstall: + + - pkg + + .. code-block:: bash + + sudo chmod +x /opt/local/etc/sunshine/assets/uninstall_pkg.sh + sudo /opt/local/etc/sunshine/assets/uninstall_pkg.sh + + - Portfile + + .. code-block:: bash + + sudo port uninstall Sunshine diff --git a/sunshine/platform/common.h b/sunshine/platform/common.h index 4d1588a3..ef9a2cf6 100644 --- a/sunshine/platform/common.h +++ b/sunshine/platform/common.h @@ -161,7 +161,7 @@ struct sink_t { // Play on host PC std::string host; - // On MacOS and Windows, it is not possible to create a virtual sink + // On macOS and Windows, it is not possible to create a virtual sink // Therefore, it is optional struct null_t { std::string stereo; From 00405892cb26d84680b675ebdb2249ea7a644002 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Tue, 28 Jun 2022 19:26:34 -0400 Subject: [PATCH 14/15] Don't rename default config files --- packaging/macos/Portfile | 41 ++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/packaging/macos/Portfile b/packaging/macos/Portfile index 4bb28b7b..061027e9 100644 --- a/packaging/macos/Portfile +++ b/packaging/macos/Portfile @@ -56,20 +56,29 @@ platform darwin { # destroot not required as cmake install directive handles moving files -# 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 -} +# # 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 - } -} +# # 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 +# } +# } + +# disabled not overwriting config files... these are the default config files required by Sunshine +# this did not work with pkg created by macports +# we should always install the default files and user should start sunshine like "sunshine " +# if the file doesn't exist sunshine will copy the default config to that location +notes-append "Run @PROJECT_NAME@ by executing 'sunshine ', e.g. 'sunshine ~/sunshine.conf' " +notes-append "The config file will be created if it doesn't exist." +notes-append "It is recommended to set a location for the apps file in the config." +notes-append "See our documentation at 'https://sunshinestream.readthedocs.io/en/v@PROJECT_VERSION@/' for further info." From 8ba3c073e7432d5c8016666ab6f66f6c161d6d33 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Wed, 29 Jun 2022 19:08:14 -0400 Subject: [PATCH 15/15] Remove macOS requirements table --- docs/source/about/installation.rst | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/docs/source/about/installation.rst b/docs/source/about/installation.rst index 2b84c3f6..cbe5aca3 100644 --- a/docs/source/about/installation.rst +++ b/docs/source/about/installation.rst @@ -107,16 +107,6 @@ RPM Package macOS ----- -Requirements - .. table:: - :widths: auto - - =========== ============= - requirement reason - =========== ============= - macOS 10.8+ Video Toolbox - =========== ============= - .. image:: https://img.shields.io/github/issues/sunshinestream/sunshine/os:macos?logo=github&style=for-the-badge :alt: GitHub issues by-label