Configure PKGBUILD according to github event

- Release to AUR on push into `master`
- Update AUR installation instructions
- Use common linux directories for `PKGBUILD`
This commit is contained in:
ReenigneArcher 2022-06-19 16:20:25 -04:00
commit f07171315f
12 changed files with 126 additions and 303 deletions

View file

@ -56,12 +56,6 @@ jobs:
name: Linux AUR
runs-on: ubuntu-latest
needs: check_changelog
strategy:
fail-fast: false
matrix:
include:
- aur_pkg: sunshine
- aur_pkg: sunshine-git
steps:
- name: Checkout
@ -75,19 +69,60 @@ jobs:
- name: Configure PKGBUILD files
run: |
# variables for manifest
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 }}
echo "aur_publish=false" >> $GITHUB_ENV
aur_pkg=sunshine-dev
fragment=""
sub_version=""
conflicts="'sunshine'"
provides="'sunshine'"
# check the branch variable
if [ -z "$branch" ]
then
echo "This is a PUSH event"
branch=branch=${{ github.ref_name }}
commit=${{ github.sha }}
if [ ${{ github.ref == 'refs/heads/master' }} ]
then
aur_pkg=sunshine-git
# conflicts=""
# provides=""
echo "aur_publish=true" >> $GITHUB_ENV
elif [ ${{ github.ref == 'refs/heads/nightly' }} ]
then
aur_pkg=sunshine-nightly
sub_version=".r${commit}"
fi
else
echo "This is a PR event"
sub_version=".r${commit}"
fi
echo "aur_pkg=${aur_pkg}" >> $GITHUB_ENV
fragment="#commit=${commit}"
echo "Owner: ${owner}"
echo "Repo: ${repo}"
echo "Branch: ${branch}"
echo "Commit: ${commit}"
mkdir -p artifacts
mkdir -p build
cd build
cmake -DSUNSHINE_CONFIGURE_AUR=ON -DSUNSHINE_CONFIGURE_ONLY=ON -DSUNSHINE_AUR_PKG=${{ matrix.aur_pkg }} ..
cmake -DSUNSHINE_CONFIGURE_AUR=ON -DSUNSHINE_AUR_PKG=${aur_pkg} -DSUNSHINE_SUB_VERSION=${sub_version} -DSUNSHINE_AUR_CONFLICTS=${conflicts} -DSUNSHINE_AUR_PROVIDES=${provides} -DSUNSHINE_AUR_FRAGMENT=${fragment} -DGITHUB_OWNER=${owner} -DGITHUB_REPO=${repo} -DSUNSHINE_CONFIGURE_ONLY=ON ..
cd ..
mv ./build/PKGBUILD ./artifacts/
# mv ./build/.SRCINFO ./artifacts/
# mv ./packaging/linux/aur/tmp/* ./artifacts/
ls artifacts
- name: Validate package
uses: hapakaien/archlinux-package-action@v2
@ -98,44 +133,26 @@ jobs:
srcinfo: true
aur: true # workaround mirror problem
- name: Test artifacts
run: |
ls artifacts
# - name: PKGBUILD AUR
# uses: sunshinestream/pkgbuild-aur@sunshine-fix
# with:
# pkg-name: artifacts
- name: Upload Artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: sunshine-linux-aur-${{ matrix.aur_pkg }}
name: sunshine-linux-aur
path: artifacts/
- name: Setup Publish AUR Variables
if: ${{ github.event_name == 'push' }}
run: |
if [ ${{ github.ref == 'refs/heads/master' && matrix.aur_pkg == 'sunshine' }} ]
then
echo "aur_publish=true" >> $GITHUB_ENV
elif [ ${{ github.ref == 'refs/heads/nightly' && matrix.aur_pkg == 'sunshine-git' }} ]
then
echo "aur_publish=true" >> $GITHUB_ENV
else
echo "aur_publish=false" >> $GITHUB_ENV
fi
- name: Publish AUR package
if: ${{ env.aur_publish }}
uses: KSXGitHub/github-actions-deploy-aur@v2.2.5
if: ${{ env.aur_publish == 'true' }}
uses: KSXGitHub/github-actions-deploy-aur@master # assets arg not in latest release
with:
pkgname: ${{ env.aur_pkgname }}
pkgname: ${{ env.aur_pkg }}
pkgbuild: ./artifacts/PKGBUILD
assets: |
./artifacts/*
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: Autoupdate from GitHub
commit_message: Release ${{ needs.check_changelog.outputs.next_version }}
allow_empty_commits: false
build_linux_flatpak:
name: Linux Flatpak

View file

@ -14,8 +14,7 @@ option(SUNSHINE_CONFIGURE_ONLY "Configure special files only, then exit." OFF)
if(${SUNSHINE_CONFIGURE_APPIMAGE})
configure_file(packaging/linux/sunshine.desktop sunshine.desktop @ONLY)
elseif(${SUNSHINE_CONFIGURE_AUR})
configure_file(packaging/linux/aur/${SUNSHINE_AUR_PKG}/.SRCINFO .SRCINFO @ONLY)
configure_file(packaging/linux/aur/${SUNSHINE_AUR_PKG}/PKGBUILD PKGBUILD @ONLY)
configure_file(packaging/linux/aur/PKGBUILD PKGBUILD @ONLY)
elseif(${SUNSHINE_CONFIGURE_FLATPAK})
configure_file(packaging/linux/flatpak/com.github.sunshinestream.sunshine.yml com.github.sunshinestream.sunshine.yml @ONLY)
elseif(${SUNSHINE_CONFIGURE_PORTFILE})

View file

@ -60,6 +60,10 @@ Downloads
:alt: GitHub Releases
:target: https://github.com/SunshineStream/Sunshine/releases/latest
.. image:: https://img.shields.io/aur/version/sunshine-git?style=for-the-badge&logo=archlinux
:alt: AUR version
:target: https://aur.archlinux.org/packages/sunshine-git
.. comment
image:: https://img.shields.io/docker/pulls/sunshinestream/sunshine?style=for-the-badge&logo=docker
:alt: Docker

View file

@ -44,6 +44,16 @@ According to AppImageLint the AppImage can run on the following distros.
#. Download ``sunshine-appimage.zip`` and extract the contents to your home directory.
AUR Package
^^^^^^^^^^^
#. Open terminal and run the following code.
.. code-block:: bash
git clone https://aur.archlinux.org/sunshine-git.git
cd sunshine-git
makepkg -fi
Debian Package
^^^^^^^^^^^^^^
.. image:: https://img.shields.io/github/issues/sunshinestream/sunshine/pkg:deb?logo=github&style=for-the-badge

View file

@ -0,0 +1,55 @@
# Edit on github: https://github.com/SunshineStream/Sunshine/tree/nightly/packaging/linux/aur/PKGBUILD
# Reference: https://wiki.archlinux.org/title/PKGBUILD
pkgname=@SUNSHINE_AUR_PKG@
pkgver=@PROJECT_VERSION@@SUNSHINE_SUB_VERSION@
pkgrel=1
pkgdesc="@PROJECT_DESCRIPTION@"
arch=('x86_64' 'i686')
url=@PROJECT_HOMEPAGE_URL@
license=('GPL3')
depends=('boost-libs' 'ffmpeg4.4' 'libpulse' 'libevdev' 'libx11' 'libxcb' 'libxfixes' 'libxrandr' 'libxtst' 'openssl' 'opus' 'udev')
makedepends=('git' 'cmake' 'boost' 'make')
optdepends=('cuda' 'libdrm' 'libcap')
provides=(@SUNSHINE_AUR_PROVIDES@)
conflicts=(@SUNSHINE_AUR_CONFLICTS@)
source=("$pkgname::git+https://github.com/@GITHUB_OWNER@/@GITHUB_REPO@.git@SUNSHINE_AUR_FRAGMENT@")
sha256sums=('SKIP')
prepare() {
cd "$pkgname"
git submodule update --recursive --init
}
build() {
export CFLAGS="${CFLAGS/-Werror=format-security/}"
export CXXFLAGS="${CXXFLAGS/-Werror=format-security/}"
cmake \
-S "$pkgname" \
-B build \
-Wno-dev \
-D SUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \
-D CMAKE_INSTALL_PREFIX="/usr" \
-D SUNSHINE_ASSETS_DIR="local/sunshine/assets" \
-D SUNSHINE_CONFIG_DIR="local/sunshine/config" \
-D LIBAVCODEC_INCLUDE_DIR=/usr/include/ffmpeg4.4 \
-D LIBAVCODEC_LIBRARIES=/usr/lib/ffmpeg4.4/libavcodec.so \
-D LIBAVDEVICE_INCLUDE_DIR=/usr/include/ffmpeg4.4 \
-D LIBAVDEVICE_LIBRARIES=/usr/lib/ffmpeg4.4/libavdevice.so \
-D LIBAVFORMAT_INCLUDE_DIR=/usr/include/ffmpeg4.4 \
-D LIBAVFORMAT_LIBRARIES=/usr/lib/ffmpeg4.4/libavformat.so \
-D LIBAVUTIL_INCLUDE_DIR=/usr/include/ffmpeg4.4 \
-D LIBAVUTIL_LIBRARIES=/usr/lib/ffmpeg4.4/libavutil.so \
-D LIBSWSCALE_INCLUDE_DIR=/usr/include/ffmpeg4.4 \
-D LIBSWSCALE_LIBRARIES=/usr/lib/ffmpeg4.4/libswscale.so
make -C build
}
package() {
make -C build install DESTDIR="$pkgdir"
}

View file

@ -1,35 +0,0 @@
pkgbase = sunshine-git
pkgdesc = Open source implementation of NVIDIA's GameStream, as used by the NVIDIA Shield
pkgver = 0.13.0.957.4b658cd
pkgrel = 1
url = https://github.com/SunshineStream/sunshine
install = sunshine.install
arch = x86_64
arch = i686
license = GPL3
makedepends = git
makedepends = cmake
makedepends = boost
makedepends = make
depends = boost-libs
depends = ffmpeg4.4
depends = openssl
depends = libpulse
depends = opus
depends = libxtst
depends = libx11
depends = libxfixes
depends = libevdev
depends = libxcb
depends = libxrandr
depends = udev
provides = sunshine
conflicts = sunshine
source = sunshine-git::git+https://github.com/SunshineStream/sunshine.git
source = systemd-user-config.patch
source = udev.rules
sha256sums = SKIP
sha256sums = 1642eb8672b137e94aa16e4aadde37f68bf1920dfadd1325cca480d7731f38c9
sha256sums = 5ce01689247cb01d3f119cac32c731607d99bb875dcdd39c92b547f76d2befa0
pkgname = sunshine-git

View file

@ -1,92 +0,0 @@
# Maintainer: Jacek Szafarkiewicz <szafar at linux dot pl>
# Contributor: Levente Polyak <anthraxx[at]archlinux[dot]org>
pkgname=sunshine-git
pkgver=0.13.0.957.4b658cd
pkgrel=1
pkgdesc="Open source implementation of NVIDIA's GameStream, as used by the NVIDIA Shield"
url="https://github.com/SunshineStream/sunshine"
arch=('x86_64' 'i686')
license=('GPL3')
depends=('boost-libs' 'ffmpeg4.4' 'openssl' 'libpulse' 'opus' 'libxtst' 'libx11' 'libxfixes' 'libevdev' 'libxcb' 'libxrandr' 'udev')
makedepends=('git' 'cmake' 'boost' 'make')
provides=('sunshine')
conflicts=("sunshine")
# source=("$pkgname::git+https://github.com/SunshineStream/sunshine.git"
# "systemd-user-config.patch"
# "udev.rules")
source=("$pkgname::git+https://github.com/SunshineStream/sunshine.git")
# sha256sums=('SKIP'
# '1642eb8672b137e94aa16e4aadde37f68bf1920dfadd1325cca480d7731f38c9'
# '5ce01689247cb01d3f119cac32c731607d99bb875dcdd39c92b547f76d2befa0')
sha256sums=('SKIP')
# install=sunshine.install
_assets_path=/usr/share/sunshine
pkgver() {
cd "$pkgname"
printf "%s.%s.%s" "$(git describe --tags $(git rev-list --tags --max-count=1) | sed 's/^v//')" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
prepare() {
cd "$pkgname"
git submodule update --recursive --init
# patch -p1 < ../systemd-user-config.patch
}
build() {
export CFLAGS="${CFLAGS/-Werror=format-security/}"
export CXXFLAGS="${CXXFLAGS/-Werror=format-security/}"
cmake \
-S "$pkgname" \
-B build \
-Wno-dev \
-D SUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \
-D SUNSHINE_ASSETS_DIR="$_assets_path" \
\
-D LIBAVCODEC_INCLUDE_DIR=/usr/include/ffmpeg4.4 \
-D LIBAVCODEC_LIBRARIES=/usr/lib/ffmpeg4.4/libavcodec.so \
-D LIBAVDEVICE_INCLUDE_DIR=/usr/include/ffmpeg4.4 \
-D LIBAVDEVICE_LIBRARIES=/usr/lib/ffmpeg4.4/libavdevice.so \
-D LIBAVFORMAT_INCLUDE_DIR=/usr/include/ffmpeg4.4 \
-D LIBAVFORMAT_LIBRARIES=/usr/lib/ffmpeg4.4/libavformat.so \
-D LIBAVUTIL_INCLUDE_DIR=/usr/include/ffmpeg4.4 \
-D LIBAVUTIL_LIBRARIES=/usr/lib/ffmpeg4.4/libavutil.so \
-D LIBSWSCALE_INCLUDE_DIR=/usr/include/ffmpeg4.4 \
-D LIBAVUTIL_LIBRARIES=/usr/lib/ffmpeg4.4/libavutil.so \
-D LIBSWSCALE_INCLUDE_DIR=/usr/include/ffmpeg4.4 \
-D LIBSWSCALE_LIBRARIES=/usr/lib/ffmpeg4.4/libswscale.so
make -C build
}
package() {
pushd "$pkgname/assets"
install -Dvm644 sunshine.conf "$pkgdir/$_assets_path/sunshine.conf"
install -Dvm644 apps_linux.json "$pkgdir/$_assets_path/apps_linux.json"
find web shaders/opengl -type f -print0 | xargs -0 -I {} install -Dvm644 {} "$pkgdir/$_assets_path/{}"
popd
pushd build
install -Dvm755 sunshine "$pkgdir/usr/bin/sunshine"
install -Dvm644 sunshine.service "$pkgdir/usr/lib/systemd/user/sunshine.service"
popd
# install -Dvm644 udev.rules "$pkgdir/usr/lib/udev/rules.d/85-sunshine.rules"
}
post_install() {
if ! getent group input > /dev/null; then
echo "Creating group input"
groupadd -r input
fi
}
# vim: ts=2 sw=2 et:

View file

@ -1,33 +0,0 @@
pkgbase = sunshine
pkgdesc = Open source implementation of NVIDIA's GameStream, as used by the NVIDIA Shield
pkgver = 0.13.0
pkgrel = 1
url = https://github.com/SunshineStream/sunshine
install = sunshine.install
arch = x86_64
arch = i686
license = GPL3
makedepends = git
makedepends = cmake
makedepends = boost
makedepends = make
depends = boost-libs
depends = ffmpeg4.4
depends = openssl
depends = libpulse
depends = opus
depends = libxtst
depends = libx11
depends = libxfixes
depends = libevdev
depends = libxcb
depends = libxrandr
depends = udev
source = sunshine::git+https://github.com/SunshineStream/sunshine.git#tag=v0.13.0
source = systemd-user-config.patch
source = udev.rules
sha256sums = SKIP
sha256sums = 1642eb8672b137e94aa16e4aadde37f68bf1920dfadd1325cca480d7731f38c9
sha256sums = 5ce01689247cb01d3f119cac32c731607d99bb875dcdd39c92b547f76d2befa0
pkgname = sunshine

View file

@ -1,81 +0,0 @@
# Maintainer: Jacek Szafarkiewicz <szafar at linux dot pl>
pkgname=sunshine
pkgver=0.13.0
pkgrel=1
pkgdesc="Open source implementation of NVIDIA's GameStream, as used by the NVIDIA Shield"
url="https://github.com/SunshineStream/sunshine"
arch=('x86_64' 'i686')
license=('GPL3')
depends=('boost-libs' 'ffmpeg4.4' 'openssl' 'libpulse' 'opus' 'libxtst' 'libx11' 'libxfixes' 'libevdev' 'libxcb' 'libxrandr' 'udev')
makedepends=('git' 'cmake' 'boost' 'make')
# source=("$pkgname::git+https://github.com/SunshineStream/sunshine.git#tag=v$pkgver"
# "systemd-user-config.patch"
# "udev.rules")
source=("$pkgname::git+https://github.com/SunshineStream/sunshine.git#tag=v$pkgver")
# sha256sums=('SKIP'
# '1642eb8672b137e94aa16e4aadde37f68bf1920dfadd1325cca480d7731f38c9'
# '5ce01689247cb01d3f119cac32c731607d99bb875dcdd39c92b547f76d2befa0')
sha256sums=('SKIP')
# install=sunshine.install
_assets_path=/usr/share/$pkgname
prepare() {
cd "$pkgname"
git submodule update --recursive --init
# patch -p1 < ../systemd-user-config.patch
}
build() {
export CFLAGS="${CFLAGS/-Werror=format-security/}"
export CXXFLAGS="${CXXFLAGS/-Werror=format-security/}"
cmake \
-S "$pkgname" \
-B build \
-Wno-dev \
-D SUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \
-D SUNSHINE_ASSETS_DIR="$_assets_path" \
\
-D LIBAVCODEC_INCLUDE_DIR=/usr/include/ffmpeg4.4 \
-D LIBAVCODEC_LIBRARIES=/usr/lib/ffmpeg4.4/libavcodec.so \
-D LIBAVDEVICE_INCLUDE_DIR=/usr/include/ffmpeg4.4 \
-D LIBAVDEVICE_LIBRARIES=/usr/lib/ffmpeg4.4/libavdevice.so \
-D LIBAVFORMAT_INCLUDE_DIR=/usr/include/ffmpeg4.4 \
-D LIBAVFORMAT_LIBRARIES=/usr/lib/ffmpeg4.4/libavformat.so \
-D LIBAVUTIL_INCLUDE_DIR=/usr/include/ffmpeg4.4 \
-D LIBAVUTIL_LIBRARIES=/usr/lib/ffmpeg4.4/libavutil.so \
-D LIBSWSCALE_INCLUDE_DIR=/usr/include/ffmpeg4.4 \
-D LIBSWSCALE_LIBRARIES=/usr/lib/ffmpeg4.4/libswscale.so
make -C build
}
package() {
pushd "$pkgname/assets"
install -Dvm644 sunshine.conf "$pkgdir/$_assets_path/sunshine.conf"
install -Dvm644 apps_linux.json "$pkgdir/$_assets_path/apps_linux.json"
find web shaders/opengl -type f -print0 | xargs -0 -I {} install -Dvm644 {} "$pkgdir/$_assets_path/{}"
popd
pushd build
install -Dvm755 sunshine "$pkgdir/usr/bin/sunshine"
install -Dvm644 sunshine.service "$pkgdir/usr/lib/systemd/user/sunshine.service"
popd
# install -Dvm644 udev.rules "$pkgdir/usr/lib/udev/rules.d/85-sunshine.rules"
}
post_install() {
if ! getent group input > /dev/null; then
echo "Creating group input"
groupadd -r input
fi
}
# vim: ts=2 sw=2 et:

View file

@ -1,6 +0,0 @@
post_install() {
if ! getent group input > /dev/null; then
echo "Creating group input"
groupadd -r input
fi
}

View file

@ -1,14 +0,0 @@
diff --git a/sunshine.service.in b/sunshine.service.in
index c0c3828..fe45460 100644
--- a/sunshine.service.in
+++ b/sunshine.service.in
@@ -2,7 +2,8 @@
Description=Sunshine Gamestream Server for Moonlight
[Service]
-ExecStart=@SUNSHINE_EXECUTABLE_PATH@
+ExecStartPre=/bin/sh -c "test -e %E/sunshine || cp -r '@SUNSHINE_ASSETS_DIR@' '%E/sunshine'"
+ExecStart=@SUNSHINE_EXECUTABLE_PATH@ %E/sunshine/sunshine.conf
[Install]
WantedBy=graphical-session.target

View file

@ -1 +0,0 @@
KERNEL=="uinput", GROUP="input", MODE="0660"