Update MacOS build

This commit is contained in:
ReenigneArcher 2022-06-10 23:20:24 -04:00
parent 65c4f01998
commit 1a1cf20152
4 changed files with 177 additions and 37 deletions

View File

@ -264,12 +264,35 @@ jobs:
# fix openssl header not found # fix openssl header not found
cd /usr/local/include cd /usr/local/include
ln -s ../opt/openssl/include/openssl . ln -s ../opt/openssl/include/openssl .
# update paths for macports
# echo "/opt/local/sbin" >> $GITHUB_PATH
echo "/Users/runner/macports/sbin" >> $GITHUB_PATH
# echo "/opt/local/bin" >> $GITHUB_PATH
echo "/Users/runner/macports/bin" >> $GITHUB_PATH
- name: Build MacOS - name: Build MacOS
run: | run: |
# variables for Portfile
owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]' )
repo=$(echo ${GITHUB_REPOSITORY#*/} | tr '[:upper:]' '[:lower:]' )
branch=${GITHUB_HEAD_REF}
# check the branch variable
if [ -z "$branch" ]
then
echo "This is a PUSH event"
branch=${GITHUB_BASE_REF}
else
echo "This is a PR event"
fi
echo "Owner: ${owner}"
echo "Repo: ${repo}"
echo "Branch: ${branch}"
mkdir build mkdir build
cd 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 -DGITHUB_OWNER=${owner} -DGITHUB_REPO=${repo} -DGITHUB_BRANCH=${branch} ..
make -j ${nproc} make -j ${nproc}
- name: Package MacOS - name: Package MacOS
@ -279,12 +302,73 @@ jobs:
# package # package
cpack -G DragNDrop cpack -G DragNDrop
mv ./cpack_artifacts/Sunshine.dmg ../artifacts/sunshine-macos-experimental-dragndrop.dmg
cpack -G Bundle
mv ./cpack_artifacts/Sunshine.dmg ../artifacts/sunshine-macos-experimental-bundle.dmg
cpack -G ZIP cpack -G ZIP
mv ./cpack_artifacts/Sunshine.zip ../artifacts/sunshine-macos-experimental-archive.zip
# move # move
mv Portfile ../artifacts/Portfile mv Portfile ../artifacts/Portfile
mv ./cpack_artifacts/Sunshine.dmg ../artifacts/sunshine-macos.dmg
mv ./cpack_artifacts/Sunshine.zip ../artifacts/sunshine-macos.zip - name: Setup Macports
run : |
curl -O https://distfiles.macports.org/MacPorts/MacPorts-2.7.2.tar.bz2
tar xf MacPorts-2.7.2.tar.bz2
cd MacPorts-2.7.2
./configure --prefix=/Users/runner/macports
make
sudo make install
cd ../
rm -rf MacPorts-2.7.2*
# update sources
sudo port -v selfupdate
# use custom sources
# sudo chmod 777 /opt/local/etc/macports/sources.conf
sudo chmod 777 /Users/runner/macports/etc/macports/sources.conf
# echo file://$(echo ~)/ports > /opt/local/etc/macports/sources.conf
echo file://$(echo ~)/ports > /Users/runner/macports/etc/macports/sources.conf
# echo rsync://rsync.macports.org/macports/release/tarballs/ports.tar [default] >> /opt/local/etc/macports/sources.conf
echo rsync://rsync.macports.org/macports/release/tarballs/ports.tar [default] >> /Users/runner/macports/etc/macports/sources.conf
# sudo chmod 644 /opt/local/etc/macports/sources.conf
sudo chmod 644 /Users/runner/macports/etc/macports/sources.conf
- name: Package with MacPorts
run: |
# setup custom port
mkdir -p ~/ports/multimedia/sunshine
# copy configured Portfile
cp ./artifacts/Portfile ~/ports/multimedia/sunshine/
# index the ports
cd ~/ports
portindex
# 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 - name: Upload Artifacts
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
@ -293,6 +377,15 @@ jobs:
name: sunshine-macos name: sunshine-macos
path: artifacts/ path: artifacts/
# this step can be removed after packages are fixed
- name: Delete experimental packages
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
working-directory: artifacts
run: |
rm -f ./sunshine-macos-experimental-dragndrop.dmg
rm -f ./sunshine-macos-experimental-bundle.dmg
rm -f ./sunshine-macos-experimental-archive.zip
- name: Create Release - name: Create Release
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: SunshineStream/actions/create_release@master uses: SunshineStream/actions/create_release@master

View File

@ -443,9 +443,7 @@ endforeach()
target_compile_options(sunshine PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${SUNSHINE_COMPILE_OPTIONS}>;$<$<COMPILE_LANGUAGE:CUDA>:${SUNSHINE_COMPILE_OPTIONS_CUDA};-std=c++17>) target_compile_options(sunshine PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${SUNSHINE_COMPILE_OPTIONS}>;$<$<COMPILE_LANGUAGE:CUDA>:${SUNSHINE_COMPILE_OPTIONS_CUDA};-std=c++17>)
#############
# CPACK / Packaging # CPACK / Packaging
####
# Common options # Common options
set(CPACK_PACKAGE_NAME "SunshineStream") set(CPACK_PACKAGE_NAME "SunshineStream")
@ -562,6 +560,7 @@ if(APPLE) # TODO: test
set(CPACK_BUNDLE_NAME "${CMAKE_PROJECT_NAME}") set(CPACK_BUNDLE_NAME "${CMAKE_PROJECT_NAME}")
set(CPACK_BUNDLE_PLIST "${APPLE_PLIST_FILE}") set(CPACK_BUNDLE_PLIST "${APPLE_PLIST_FILE}")
set(CPACK_BUNDLE_ICON "${PROJECT_SOURCE_DIR}/sunshine.icns") set(CPACK_BUNDLE_ICON "${PROJECT_SOURCE_DIR}/sunshine.icns")
# set(CPACK_BUNDLE_STARTUP_COMMAND "${INSTALL_RUNTIME_DIR}/sunshine")
# Portfile # Portfile
configure_file(Portfile.in Portfile @ONLY) configure_file(Portfile.in Portfile @ONLY)

View File

@ -1,49 +1,75 @@
# -*- 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
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
github.setup sunshinestream sunshine master # bump revision when changes are made to this file
version @PROJECT_VERSION@ revision 1
revision 1
categories multimedia github.setup @GITHUB_OWNER@ @GITHUB_REPO@ @GITHUB_BRANCH@
license GPL-3 name @PROJECT_NAME@
maintainers {sunshinestream @SunshineStream} {outlook.com:anselm.busse} version @PROJECT_VERSION@
platforms darwin categories multimedia emulators games
platforms darwin
license GPL-3
maintainers {@SunshineStream sunshinestream}
description @PROJECT_DESCRIPTION@
long_description {*}${description}
homepage @PROJECT_HOMEPAGE_URL@
master_sites https://github.com/@GITHUB_OWNER@/@GITHUB_REPO@/releases
fetch.type git fetch.type git
post-fetch { post-fetch {
system -W ${worksrcpath} "${git.cmd} submodule update --init --recursive" system -W ${worksrcpath} "${git.cmd} submodule update --init --recursive"
} }
description @PROJECT_DESCRIPTION@ depends_lib port:avahi \
long_description {*}${description} port:ffmpeg \
homepage @PROJECT_HOMEPAGE_URL@ port:libopus
depends_lib port:avahi \ boost.version 1.76
port:ffmpeg \
port:libopus
configure.args -DBOOST_ROOT=[boost::install_area] \
-DSUNSHINE_ASSETS_DIR=${prefix}/etc/sunshine/assets \
-DSUNSHINE_CONFIG_DIR=${prefix}/etc/sunshine/config
boost.version 1.76 cmake.out_of_source yes
configure.args -DBOOST_ROOT=[boost::install_area] \ startupitem.create yes
-DSUNSHINE_ASSETS_DIR=${prefix}/etc/sunshine/assets startupitem.executable "${prefix}/bin/{$name}"
-DSUNSHINE_CONFIG_DIR=${prefix}/etc/sunshine/config startupitem.location LaunchDaemons
startupitem.name ${name}
cmake.out_of_source yes startupitem.netchange yes
# is this actually necessary? this should all be handled by CMakeLists
destroot { destroot {
xinstall -d -m 755 ${destroot}${prefix}/usr/local/${name}/.assets # install assets
xinstall {*}[glob ${worksrcpath}/src_assets/common/assets/*] ${destroot}${prefix}/usr/local/${name}/.assets xinstall -d -m 755 ${destroot}${prefix}/etc/${name}/assets
xinstall {*}[glob ${worksrcpath}/src_assets/macos/assets/*] ${destroot}${prefix}/usr/local/${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
xinstall -d -m 755 ${destroot}${prefix}/usr/local/${name}/config # install web assets
xinstall {*}[glob ${worksrcpath}/src_assets/common/config/*] ${destroot}${prefix}/usr/local/${name}/config xinstall -d -m 755 ${destroot}${prefix}/etc/${name}/assets/web/fonts/fontawesome-free-web/css
xinstall {*}[glob ${worksrcpath}/src_assets/macos/config/*] ${destroot}${prefix}/usr/local/${name}/config 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 xinstall ${workpath}/build/${name} ${destroot}${prefix}/bin
} }

View File

@ -108,13 +108,35 @@ Disk Image File option:
Portfile option: Portfile option:
#. Install `MacPorts <https://www.macports.org>`_ #. Install `MacPorts <https://www.macports.org>`_
#. Download the ``Portfile`` to ``/tmp`` and run the following code. #. Update the Macports sources.
.. code-block:: bash .. code-block:: bash
cd /tmp && sudo port install sudo nano /opt/local/etc/macports/sources.conf
Add this line, replacing your username, below the line that starts with ``rsync``.
file://Users/<username>/ports
``Ctrl+x``, then ``Y`` to exit and save changes.
#. Download the ``Portfile`` to ``~/Downloads`` and run the following code.
.. code-block:: bash
mkdir -p ~/ports/multimedia/sunshine
mv ~/Downlaods/Portfile ~/ports/multimedia/sunshine
cd ~/ports
portindex
sudo port install sunshine
#. The first time you start Sunshine, you will be asked to grant access to screen recording and your microphone. #. The first time you start Sunshine, you will be asked to grant access to screen recording and your microphone.
#. Try to run the following code if you get this error: `Dynamic session lookup supported but failed: launchd did
not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!`
.. code-block:: bash
launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist
Standalone option: Standalone option:
#. Download and extract ``sunshine-macos.zip`` #. Download and extract ``sunshine-macos.zip``