Files

57 lines
2.2 KiB
Bash

# This is the recipe.sh script. It is executed by BPM in a temporary directory when compiling a source package
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
# Package recipe based on LizardByte's official arch PKGBUILD
# https://github.com/LizardByte/pacman-repo/blob/master/pkgbuilds/sunshine/PKGBUILD
# The prepare function is executed in the root of the temp directory
# This function is used for putting downloaded files to the correct location or applying patches
prepare() {
cd "$BPM_SOURCE"
git submodule update --recursive --init
}
# The build function is executed in the source directory
# This function is used to compile the source code
build() {
export BRANCH="master"
export BUILD_VERSION="${BPM_PKG_VERSION}"
export COMMIT=$(git rev-parse HEAD)
export CC="gcc"
export CXX="g++"
export CFLAGS="${CFLAGS/-Werror=format-security/}"
export CXXFLAGS="${CXXFLAGS/-Werror=format-security/}"
cmake -B build \
-DCMAKE_INSTALL_PREFIX=/usr \
-DBUILD_DOCS=OFF \
-DBUILD_WERROR=ON \
-DSUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \
-DSUNSHINE_ASSETS_DIR="share/sunshine" \
-DSUNSHINE_ENABLE_CUDA=OFF \
-DCUDA_FAIL_ON_MISSING=OFF \
-DBUILD_TESTS=OFF
appstreamcli validate "build/dev.lizardbyte.app.Sunshine.metainfo.xml"
appstream-util validate "build/dev.lizardbyte.app.Sunshine.metainfo.xml"
desktop-file-validate "build/dev.lizardbyte.app.Sunshine.desktop"
desktop-file-validate "build/dev.lizardbyte.app.Sunshine.terminal.desktop"
cmake --build build
}
# The package function is executed in the source directory
# This function is used to move the compiled files into the output directory
package() {
DESTDIR="$BPM_OUTPUT" cmake --install build
# Install desktop file
install -Dm644 "$BPM_WORKDIR"/dev.lizardbyte.app.Sunshine.desktop "$BPM_OUTPUT"/usr/share/applications/dev.lizardbyte.app.Sunshine.desktop
# Install package license
install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/sunshine/LICENSE
}