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

@ -265,11 +265,34 @@ jobs:
cd /usr/local/include
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
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
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}
- name: Package MacOS
@ -279,12 +302,73 @@ jobs:
# package
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
mv ./cpack_artifacts/Sunshine.zip ../artifacts/sunshine-macos-experimental-archive.zip
# move
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
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
@ -293,6 +377,15 @@ jobs:
name: sunshine-macos
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
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/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>)
#############
# CPACK / Packaging
####
# Common options
set(CPACK_PACKAGE_NAME "SunshineStream")
@ -562,6 +560,7 @@ if(APPLE) # TODO: test
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")
# Portfile
configure_file(Portfile.in Portfile @ONLY)

View File

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

View File

@ -108,13 +108,35 @@ Disk Image File option:
Portfile option:
#. Install `MacPorts <https://www.macports.org>`_
#. Download the ``Portfile`` to ``/tmp`` and run the following code.
#. Update the Macports sources.
.. 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.
#. 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:
#. Download and extract ``sunshine-macos.zip``