Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(Packaging): add Fedora-compatible RPM builds #313

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 27 additions & 20 deletions .releaserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ branches:
- name: main
#- name: 'v+([0-9])?(.{+([0-9]),x}).x'

# These plugins will run when a release is triggered. They will analyze commit
# These plugins will run when a release is triggered. They will analyze commit
# messages to determine what kind of release this is and publish a new release.
plugins:
# Analyze commit messages to determine next version
Expand All @@ -15,25 +15,30 @@ plugins:
# Generate release notes
- "@semantic-release/release-notes-generator"

# Replace version strings in the project. The 'git' plugin is needed to
# Replace version strings in the project. The 'git' plugin is needed to
# commit the version strings to the repository.
- - "@google/semantic-release-replace-plugin"
- replacements:
- files:
- core/global/version.tres
from: "core = .*"
to: "core = \"${nextRelease.version}\""
#results:
# - file: core/global/version.tres
# hasChanged: true
# numMatches: 1
# numReplacements: 1
#countMatches: true
- files:
- core/global/version.tres
from: "core = .*"
to: 'core = "${nextRelease.version}"'
#results:
# - file: core/global/version.tres
# hasChanged: true
# numMatches: 1
# numReplacements: 1
#countMatches: true
- files:
- package/rpm/opengamepadui.spec
from: "Version: .*"
to: "Version: ${nextRelease.version}"

# Commit the following changes to git after other plugins have run
- - "@semantic-release/git"
- assets:
- core/global/version.tres
- core/global/version.tres
- package/rpm/opengamepadui.spec

# Execute commands to build the project
- - "@semantic-release/exec"
Expand All @@ -43,10 +48,12 @@ plugins:
# Publish artifacts as a GitHub release
- - "@semantic-release/github"
- assets:
- path: dist/opengamepadui.raw
- path: dist/opengamepadui.raw.sha256.txt
- path: dist/opengamepadui.tar.gz
- path: dist/opengamepadui.tar.gz.sha256.txt
- path: dist/update.zip
- path: dist/update.zip.sha256.txt
- path: docs/install/opengamepadui_deck_installer.desktop
- path: dist/opengamepadui-*.rpm
- path: dist/opengamepadui-*.rpm.sha256.txt
- path: dist/opengamepadui.raw
- path: dist/opengamepadui.raw.sha256.txt
- path: dist/opengamepadui.tar.gz
- path: dist/opengamepadui.tar.gz.sha256.txt
- path: dist/update.zip
- path: dist/update.zip.sha256.txt
- path: docs/install/opengamepadui_deck_installer.desktop
26 changes: 11 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,20 @@ rootfs: build/opengamepad-ui.x86_64


.PHONY: dist
dist: dist/opengamepadui.tar.gz dist/opengamepadui.raw dist/update.zip ## Create all redistributable versions of the project
dist: dist/opengamepadui.tar.gz dist/opengamepadui.raw dist/update.zip dist/opengamepadui-$(OGUI_VERSION)-1.x86_64.rpm ## Create all redistributable versions of the project
cd dist && sha256sum opengamepadui-$(OGUI_VERSION)-1.x86_64.rpm > opengamepadui-$(OGUI_VERSION)-1.x86_64.rpm.sha256.txt
cd dist && sha256sum opengamepadui.tar.gz > opengamepadui.tar.gz.sha256.txt
cd dist && sha256sum opengamepadui.raw > opengamepadui.raw.sha256.txt
cd dist && sha256sum update.zip > update.zip.sha256.txt

.PHONY: dist-rpm
dist-rpm: dist/opengamepadui-$(OGUI_VERSION)-1.x86_64.rpm ## Create a redistributable RPM
dist/opengamepadui-$(OGUI_VERSION)-1.x86_64.rpm: dist/opengamepadui.tar.gz
@echo "Building redistributable RPM package"
mkdir -p dist $(HOME)/rpmbuild/SOURCES
cp dist/opengamepadui.tar.gz $(HOME)/rpmbuild/SOURCES
rpmbuild -bb package/rpm/opengamepadui.spec
cp $(HOME)/rpmbuild/RPMS/x86_64/opengamepadui-$(OGUI_VERSION)-1.x86_64.rpm dist

.PHONY: dist-archive
dist-archive: dist/opengamepadui.tar.gz ## Create a redistributable tar.gz of the project
Expand All @@ -303,7 +312,7 @@ dist/update.zip: build/metadata.json
# https://blogs.igalia.com/berto/2022/09/13/adding-software-to-the-steam-deck-with-systemd-sysext/
.PHONY: dist-ext
dist-ext: dist/opengamepadui.raw ## Create a systemd-sysext extension archive
dist/opengamepadui.raw: dist/opengamepadui.tar.gz $(CACHE_DIR)/gamescope-session.tar.gz $(CACHE_DIR)/gamescope-session-opengamepadui.tar.gz $(CACHE_DIR)/RyzenAdj/build/ryzenadj $(CACHE_DIR)/powerstation.tar.gz
dist/opengamepadui.raw: dist/opengamepadui.tar.gz $(CACHE_DIR)/gamescope-session.tar.gz $(CACHE_DIR)/gamescope-session-opengamepadui.tar.gz $(CACHE_DIR)/powerstation.tar.gz
@echo "Building redistributable systemd extension"
mkdir -p dist
rm -rf dist/opengamepadui.raw $(CACHE_DIR)/opengamepadui.raw
Expand All @@ -325,25 +334,12 @@ dist/opengamepadui.raw: dist/opengamepadui.tar.gz $(CACHE_DIR)/gamescope-session
cd $(CACHE_DIR) && tar xvfz powerstation.tar.gz
cp -r $(CACHE_DIR)/powerstation/usr/* $(CACHE_DIR)/opengamepadui/usr

@# Copy ryzenadj files into the extension
install -Dsm 755 $(CACHE_DIR)/RyzenAdj/build/ryzenadj $(CACHE_DIR)/opengamepadui/usr/bin/ryzenadj
install -Dsm 744 $(CACHE_DIR)/RyzenAdj/build/libryzenadj.so $(CACHE_DIR)/opengamepadui/usr/lib/libryzenadj.so
install -Dm 644 $(CACHE_DIR)/RyzenAdj/lib/ryzenadj.h $(CACHE_DIR)/opengamepadui/usr/include/ryzenadj.h

@# Build the extension archive
cd $(CACHE_DIR) && mksquashfs opengamepadui opengamepadui.raw
rm -rf $(CACHE_DIR)/opengamepadui $(CACHE_DIR)/gamescope-session-opengamepadui-main $(CACHE_DIR)/gamescope-session-main
mv $(CACHE_DIR)/opengamepadui.raw $@


$(CACHE_DIR)/RyzenAdj/build/ryzenadj:
rm -Rf $(CACHE_DIR)/RyzenAdj
@# Copy ryzenadj into the extension
git clone https://github.com/FlyGoat/RyzenAdj.git $(CACHE_DIR)/RyzenAdj
mkdir -p $(CACHE_DIR)/RyzenAdj/build
cd $(CACHE_DIR)/RyzenAdj/build && cmake -DCMAKE_BUILD_TYPE=Release .. && make


$(CACHE_DIR)/gamescope-session.tar.gz:
wget -O $@ https://github.com/ChimeraOS/gamescope-session/archive/refs/heads/main.tar.gz

Expand Down
1 change: 1 addition & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ RUN pacman --noconfirm -Syyu && pacman -S --needed --noconfirm \
libxres \
libxtst \
squashfs-tools \
rpm-tools \
fontconfig \
zip \
jq \
Expand Down
Empty file added package/.gdignore
Empty file.
45 changes: 45 additions & 0 deletions package/rpm/opengamepadui.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Name: opengamepadui
Version: 0.29.2
Release: 1
Summary: A free and open source game launcher and overlay written using the Godot Game Engine 4 designed with a gamepad native experience in mind
License: GPL-3.0-only
URL: https://github.com/ShadowBlip/OpenGamepadUI

Source: https://github.com/ShadowBlip/OpenGamepadUI/releases/download/v%{version}/opengamepadui.tar.gz

Requires: gamescope

BuildRequires: make
BuildRequires: systemd-rpm-macros

%description
A free and open source game launcher and overlay written using the Godot Game Engine 4 designed with a gamepad native experience in mind

%define debug_package %{nil}
%define _build_id_links none

%prep
%autosetup -p1 -n opengamepadui

%install
make install PREFIX=%{buildroot}%{_prefix} INSTALL_PREFIX=%{_prefix}

%files
/usr/bin/opengamepadui
/usr/share/opengamepadui/*.so
/usr/share/opengamepadui/scripts/make_nice
/usr/share/opengamepadui/scripts/manage_input
/usr/share/opengamepadui/scripts/powertools
/usr/share/opengamepadui/opengamepad-ui.x86_64
/usr/share/applications/opengamepadui.desktop
/usr/share/icons/hicolor/scalable/apps/opengamepadui.svg
/usr/share/polkit-1/actions/org.shadowblip.manage_input.policy
/usr/share/polkit-1/actions/org.shadowblip.powertools.policy
/usr/share/polkit-1/actions/org.shadowblip.setcap.policy
/usr/lib/udev/hwdb.d/59-opengamepadui-handheld.hwdb
/usr/lib/udev/rules.d/61-opengamepadui-handheld.rules
/usr/lib/systemd/user/systemd-sysext-updater.service
/usr/lib/systemd/user/ogui-overlay-mode.service

%changelog
%autochangelog
3 changes: 2 additions & 1 deletion rootfs/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PREFIX ?= $(HOME)/.local
INSTALL_PREFIX ?= $(PREFIX)

##@ General

Expand All @@ -15,7 +16,7 @@ install: ## Install OpenGamepadUI (default: ~/.local)
mkdir -p $(PREFIX)/share/applications
install -Dm644 usr/share/applications/opengamepadui.desktop \
$(PREFIX)/share/applications/opengamepadui.desktop
sed -i 's|Exec=opengamepadui|Exec=$(PREFIX)/bin/opengamepadui|g' \
sed -i 's|Exec=opengamepadui|Exec=$(INSTALL_PREFIX)/bin/opengamepadui|g' \
$(PREFIX)/share/applications/opengamepadui.desktop
mkdir -p $(PREFIX)/share/icons/hicolor/scalable/apps
install -Dm644 usr/share/icons/hicolor/scalable/apps/opengamepadui.svg \
Expand Down
6 changes: 3 additions & 3 deletions rootfs/usr/bin/opengamepadui
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
PREFIX=$(dirname -- "${SCRIPT_DIR}")

OGUI_BIN=${OGUI_BIN:-"${PREFIX}/share/opengamepadui/opengamepad-ui.x86_64"}
GAMESCOPE_CMD=${GAMESCOPE_CMD:-gamescope -w 1920 -h 1080 -f -e --xwayland-count 2}
GAMESCOPE_CMD=${GAMESCOPE_CMD:-gamescope -w 1920 -h 1080 -f --xwayland-count 2}

# Launch normally if gamescope is not running
if ls /run/user/${UID}/gamescope* > /dev/null 2>&1; then
if ls /run/user/${UID}/gamescope* >/dev/null 2>&1; then
echo "Executing: ${OGUI_BIN} $@"
exec ${OGUI_BIN} "$@"
fi
Expand Down
4 changes: 2 additions & 2 deletions rootfs/usr/share/opengamepadui/scripts/make_nice
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
#!/usr/bin/bash
set -eu

if [[ $EUID -ne 0 ]]; then
exec pkexec --disable-internal-agent "$0" "$HOME" "$@"
exec pkexec --disable-internal-agent "$0" "$HOME" "$@"
fi

USER_HOME="$1"
Expand Down
52 changes: 26 additions & 26 deletions rootfs/usr/share/opengamepadui/scripts/manage_input
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
#!/bin/bash
#!/usr/bin/bash

set -eu

if [[ $EUID -ne 0 ]]; then
exec pkexec --disable-internal-agent "$0" "$@"
exec pkexec --disable-internal-agent "$0" "$@"
fi

ensure_hidden_exists() {
if [[ ! -d "/dev/input/.hidden" ]]; then
mkdir /dev/input/.hidden
fi
if [[ ! -d "/dev/input/.hidden" ]]; then
mkdir /dev/input/.hidden
fi
}

hide() {
mv /dev/input/${1} /dev/input/.hidden/${1}
mv /dev/input/${1} /dev/input/.hidden/${1}
}

restore() {
mv /dev/input/.hidden/${1} /dev/input/${1}
mv /dev/input/.hidden/${1} /dev/input/${1}
}

turbo_takeover() {
value=${1}
echo ${value} > /sys/devices/platform/oxp-platform/tt_toggle
value=${1}
echo ${value} >/sys/devices/platform/oxp-platform/tt_toggle
}

ensure_hidden_exists

if [[ $1 == "hide" ]]; then
if [[ ! -e "/dev/input/${2}" ]]; then
echo "UInput device ${2} does not exist."
exit 1
fi
hide $2
if [[ ! -e "/dev/input/${2}" ]]; then
echo "UInput device ${2} does not exist."
exit 1
fi
hide $2

elif [[ $1 == "restore" ]]; then
if [[ ! -e "/dev/input/.hidden/${2}" ]]; then
echo "UInput device ${2} is not hidden."
exit 1
fi
restore $2
if [[ ! -e "/dev/input/.hidden/${2}" ]]; then
echo "UInput device ${2} is not hidden."
exit 1
fi
restore $2

elif [[ $1 == "turbo_takeover" ]]; then
if [[ ! -f /sys/devices/platform/oxp-platform/tt_toggle ]]; then
echo "Turbo toggle does not exist."
exit 1
fi
turbo_takeover $2
fi
if [[ ! -f /sys/devices/platform/oxp-platform/tt_toggle ]]; then
echo "Turbo toggle does not exist."
exit 1
fi
turbo_takeover $2
fi
2 changes: 1 addition & 1 deletion rootfs/usr/share/opengamepadui/scripts/powertools
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/bash

set -eu

Expand Down
Loading