Skip to content

Commit

Permalink
feat: add publisher metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher committed Aug 24, 2024
1 parent c9f853d commit 4cb1f70
Show file tree
Hide file tree
Showing 18 changed files with 124 additions and 17 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,13 @@ jobs:
COMMIT: ${{ needs.setup_release.outputs.release_commit }}
run: |
chmod +x ./scripts/linux_build.sh
./scripts/linux_build.sh --skip-cleanup --skip-package --ubuntu-test-repo ${{ matrix.EXTRA_ARGS }}
./scripts/linux_build.sh \
--publisher-name='${{ github.repository_owner }}' \
--publisher-url='https://app.lizardbyte.dev' \
--publisher-issue-url='https://app.lizardbyte.dev/support' \
--skip-cleanup \
--skip-package \
--ubuntu-test-repo ${{ matrix.EXTRA_ARGS }}
- name: Set AppImage Version
if: |
Expand Down Expand Up @@ -1101,6 +1107,9 @@ jobs:
-DBUILD_WERROR=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DSUNSHINE_ASSETS_DIR=assets \
-DSUNSHINE_PUBLSIHER_NAME='${{ github.repository_owner }}' \
-DSUNSHINE_PUBLISHER_WEBSITE='https://app.lizardbyte.dev' \
-DSUNSHINE_PUBLISHER_ISSUE_URL='https://app.lizardbyte.dev/support' \
-DTESTS_SOFTWARE_ENCODER_UNAVAILABLE='skip'
ninja -C build
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,7 @@ package-lock.json

# Dummy macOS files
.DS_Store

# Python
*.pyc
venv/
5 changes: 5 additions & 0 deletions cmake/compile_definitions/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_ASSETS_DIR="${SUNSHINE_ASSETS_DIR_DEF}

list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_TRAY=${SUNSHINE_TRAY})

# Publisher metadata
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_PUBLISHER_NAME="${SUNSHINE_PUBLISHER_NAME}")
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_PUBLISHER_WEBSITE="${SUNSHINE_PUBLISHER_WEBSITE}")
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_PUBLISHER_ISSUE_URL="${SUNSHINE_PUBLISHER_ISSUE_URL}")

include_directories("${CMAKE_SOURCE_DIR}")

include_directories(
Expand Down
9 changes: 9 additions & 0 deletions cmake/prep/options.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# Publisher Metadata
set(SUNSHINE_PUBLISHER_NAME "Third Party Publisher"
CACHE STRING "The name of the publisher (not developer) of the application.")
set(SUNSHINE_PUBLISHER_WEBSITE ""
CACHE STRING "The URL of the publisher's website.")
set(SUNSHINE_PUBLISHER_ISSUE_URL "https://app.lizardbyte.dev/support"
CACHE STRING "The URL of the publisher's support site or issue tracker.
If you provide a modified version of Sunshine, we kindly request that you use your own url.")

option(BUILD_DOCS "Build documentation" ON)
option(BUILD_TESTS "Build tests" ON)
option(TESTS_ENABLE_PYTHON_TESTS "Enable Python tests" ON)
Expand Down
6 changes: 5 additions & 1 deletion docker/debian-bookworm.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ RUN <<_BUILD
#!/bin/bash
set -e
chmod +x ./scripts/linux_build.sh
./scripts/linux_build.sh --sudo-off
./scripts/linux_build.sh \
--publisher-name='LizardByte' \
--publisher-url='https://app.lizardbyte.dev' \
--publisher-issue-url='https://app.lizardbyte.dev/support' \
--sudo-off
apt-get clean
rm -rf /var/lib/apt/lists/*
_BUILD
Expand Down
6 changes: 5 additions & 1 deletion docker/fedora-39.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ RUN <<_BUILD
#!/bin/bash
set -e
chmod +x ./scripts/linux_build.sh
./scripts/linux_build.sh --sudo-off
./scripts/linux_build.sh \
--publisher-name='LizardByte' \
--publisher-url='https://app.lizardbyte.dev' \
--publisher-issue-url='https://app.lizardbyte.dev/support' \
--sudo-off
dnf clean all
rm -rf /var/cache/yum
_BUILD
Expand Down
6 changes: 5 additions & 1 deletion docker/fedora-40.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ RUN <<_BUILD
#!/bin/bash
set -e
chmod +x ./scripts/linux_build.sh
./scripts/linux_build.sh --sudo-off
./scripts/linux_build.sh \
--publisher-name='LizardByte' \
--publisher-url='https://app.lizardbyte.dev' \
--publisher-issue-url='https://app.lizardbyte.dev/support' \
--sudo-off
dnf clean all
rm -rf /var/cache/yum
_BUILD
Expand Down
6 changes: 5 additions & 1 deletion docker/ubuntu-22.04.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ RUN <<_BUILD
#!/bin/bash
set -e
chmod +x ./scripts/linux_build.sh
./scripts/linux_build.sh --sudo-off
./scripts/linux_build.sh \
--publisher-name='LizardByte' \
--publisher-url='https://app.lizardbyte.dev' \
--publisher-issue-url='https://app.lizardbyte.dev/support' \
--sudo-off
apt-get clean
rm -rf /var/lib/apt/lists/*
_BUILD
Expand Down
6 changes: 5 additions & 1 deletion docker/ubuntu-24.04.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ RUN <<_BUILD
#!/bin/bash
set -e
chmod +x ./scripts/linux_build.sh
./scripts/linux_build.sh --sudo-off
./scripts/linux_build.sh \
--publisher-name='LizardByte' \
--publisher-url='https://app.lizardbyte.dev' \
--publisher-issue-url='https://app.lizardbyte.dev/support' \
--sudo-off
apt-get clean
rm -rf /var/lib/apt/lists/*
_BUILD
Expand Down
5 changes: 4 additions & 1 deletion packaging/linux/Arch/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ build() {
-D BUILD_WERROR=ON \
-D CMAKE_INSTALL_PREFIX=/usr \
-D SUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \
-D SUNSHINE_ASSETS_DIR="share/sunshine"
-D SUNSHINE_ASSETS_DIR="share/sunshine" \
-D SUNSHINE_PUBLSIHER_NAME='LizardByte' \
-D SUNSHINE_PUBLISHER_WEBSITE='https://app.lizardbyte.dev' \
-D SUNSHINE_PUBLISHER_ISSUE_URL='https://app.lizardbyte.dev/support'

make -C build
}
Expand Down
5 changes: 4 additions & 1 deletion packaging/linux/flatpak/dev.lizardbyte.app.Sunshine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,15 @@ modules:
- -DCMAKE_BUILD_TYPE=Release
- -DCMAKE_CUDA_COMPILER=/app/cuda/bin/nvcc
- -DSUNSHINE_ASSETS_DIR=share/sunshine
- -DSUNSHINE_BUILD_FLATPAK=ON
- -DSUNSHINE_EXECUTABLE_PATH=/app/bin/sunshine
- -DSUNSHINE_ENABLE_WAYLAND=ON
- -DSUNSHINE_ENABLE_X11=ON
- -DSUNSHINE_ENABLE_DRM=ON
- -DSUNSHINE_ENABLE_CUDA=ON
- -DSUNSHINE_BUILD_FLATPAK=ON
- -DSUNSHINE_PUBLSIHER_NAME='LizardByte'
-DSUNSHINE_PUBLISHER_WEBSITE='https://app.lizardbyte.dev'
-DSUNSHINE_PUBLISHER_ISSUE_URL='https://app.lizardbyte.dev/support'
sources:
- type: git
url: "@GITHUB_CLONE_URL@"
Expand Down
5 changes: 4 additions & 1 deletion packaging/macos/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ depends_lib port:curl \
configure.args -DBOOST_USE_STATIC=ON \
-DBUILD_WERROR=ON \
-DCMAKE_INSTALL_PREFIX=${prefix} \
-DSUNSHINE_ASSETS_DIR=etc/sunshine/assets
-DSUNSHINE_ASSETS_DIR=etc/sunshine/assets \
-DSUNSHINE_PUBLSIHER_NAME='LizardByte' \
-DSUNSHINE_PUBLISHER_WEBSITE='https://app.lizardbyte.dev' \
-DSUNSHINE_PUBLISHER_ISSUE_URL='https://app.lizardbyte.dev/support'

configure.env-append BRANCH=@GITHUB_BRANCH@
configure.env-append BUILD_VERSION=@BUILD_VERSION@
Expand Down
3 changes: 3 additions & 0 deletions packaging/sunshine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ def install
-DSUNSHINE_ASSETS_DIR=sunshine/assets
-DSUNSHINE_BUILD_HOMEBREW=ON
-DSUNSHINE_ENABLE_TRAY=OFF
-DSUNSHINE_PUBLSIHER_NAME='LizardByte'
-DSUNSHINE_PUBLISHER_WEBSITE='https://app.lizardbyte.dev'
-DSUNSHINE_PUBLISHER_ISSUE_URL='https://app.lizardbyte.dev/support'
]

if build.with? "docs-off"
Expand Down
43 changes: 35 additions & 8 deletions scripts/linux_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ set -e

# Default value for arguments
appimage_build=0
publisher_name="Third Party Publisher"
publisher_website=""
publisher_issue_url="https://app.lizardbyte.dev/support"
skip_cleanup=0
skip_cuda=0
skip_libva=0
Expand All @@ -21,14 +24,18 @@ Usage:
$0 [options]
Options:
-h, --help Display this help message.
-s, --sudo-off Disable sudo command.
--appimage-build Compile for AppImage, this will not create the AppImage, just the executable.
--skip-cleanup Do not restore the original gcc alternatives, or the math-vector.h file.
--skip-cuda Skip CUDA installation.
--skip-libva Skip libva installation. This will automatically be enabled if passing --appimage-build.
--skip-package Skip creating DEB, or RPM package.
--ubuntu-test-repo Install ppa:ubuntu-toolchain-r/test repo on Ubuntu.
-h, --help Display this help message.
-s, --sudo-off Disable sudo command.
--appimage-build Compile for AppImage, this will not create the AppImage, just the executable.
--publisher-name The name of the publisher (not developer) of the application.
--publisher-website The URL of the publisher's website.
--publisher-issue-url The URL of the publisher's support site or issue tracker.
If you provide a modified version of Sunshine, we kindly request that you use your own url.
--skip-cleanup Do not restore the original gcc alternatives, or the math-vector.h file.
--skip-cuda Skip CUDA installation.
--skip-libva Skip libva installation. This will automatically be enabled if passing --appimage-build.
--skip-package Skip creating DEB, or RPM package.
--ubuntu-test-repo Install ppa:ubuntu-toolchain-r/test repo on Ubuntu.
EOF

exit "$exit_code"
Expand All @@ -46,6 +53,15 @@ while getopts ":hs-:" opt; do
appimage_build=1
skip_libva=1
;;
publisher-name=*)
publisher_name="${OPTARG#*=}"
;;
publisher-website=*)
publisher_website="${OPTARG#*=}"
;;
publisher-issue-url=*)
publisher_issue_url="${OPTARG#*=}"
;;
skip-cleanup) skip_cleanup=1 ;;
skip-cuda) skip_cuda=1 ;;
skip-libva) skip_libva=1 ;;
Expand Down Expand Up @@ -268,6 +284,17 @@ function run_install() {
cmake_args+=("-DSUNSHINE_BUILD_APPIMAGE=ON")
fi

# Publisher metadata
if [ -n "$publisher_name" ]; then
cmake_args+=("-DSUNSHINE_PUBLISHER_NAME=\"${publisher_name}\"")
fi
if [ -n "$publisher_website" ]; then
cmake_args+=("-DSUNSHINE_PUBLISHER_WEBSITE=\"${publisher_website}\"")
fi
if [ -n "$publisher_issue_url" ]; then
cmake_args+=("-DSUNSHINE_PUBLISHER_ISSUE_URL=\"${publisher_issue_url}\"")
fi

# Update the package list
$package_update_command

Expand Down
5 changes: 5 additions & 0 deletions src/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ namespace crypto {
using pkey_ctx_t = util::safe_ptr<EVP_PKEY_CTX, EVP_PKEY_CTX_free>;
using bignum_t = util::safe_ptr<BIGNUM, BN_free>;

/**
* @brief Hashes the given plaintext using SHA-256.
* @param plaintext
* @return The SHA-256 hash of the plaintext.
*/
sha256_t
hash(const std::string_view &plaintext);

Expand Down
7 changes: 7 additions & 0 deletions src/entry_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ namespace lifetime {
}
} // namespace lifetime

void
log_publisher_data() {
BOOST_LOG(info) << "Package Publisher: "sv << SUNSHINE_PUBLISHER_NAME;
BOOST_LOG(info) << "Publisher Website: "sv << SUNSHINE_PUBLISHER_WEBSITE;
BOOST_LOG(info) << "Bug tracker: "sv << SUNSHINE_PUBLISHER_ISSUE_URL;
}

#ifdef _WIN32
bool
is_gamestream_enabled() {
Expand Down
6 changes: 6 additions & 0 deletions src/entry_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ namespace lifetime {
get_argv();
} // namespace lifetime

/**
* @brief Log the publisher metadata provided from CMake.
*/
void
log_publisher_data();

#ifdef _WIN32
/**
* @brief Check if NVIDIA's GameStream software is running.
Expand Down
3 changes: 3 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ main(int argc, char *argv[]) {
// the version should be printed to the log before anything else
BOOST_LOG(info) << PROJECT_NAME << " version: " << PROJECT_VER;

// Log publisher metadata
log_publisher_data();

if (!config::sunshine.cmd.name.empty()) {
auto fn = cmd_to_func.find(config::sunshine.cmd.name);
if (fn == std::end(cmd_to_func)) {
Expand Down

0 comments on commit 4cb1f70

Please sign in to comment.