diff --git a/.releaserc.yaml b/.releaserc.yaml index 4a1fe088..44eff805 100644 --- a/.releaserc.yaml +++ b/.releaserc.yaml @@ -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 @@ -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" @@ -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 diff --git a/Makefile b/Makefile index e1ab5a30..cf342a79 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 @@ -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 diff --git a/docker/Dockerfile b/docker/Dockerfile index 8229d7b9..a73f3491 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -34,6 +34,7 @@ RUN pacman --noconfirm -Syyu && pacman -S --needed --noconfirm \ libxres \ libxtst \ squashfs-tools \ + rpm-tools \ fontconfig \ zip \ jq \ diff --git a/package/.gdignore b/package/.gdignore new file mode 100644 index 00000000..e69de29b diff --git a/package/rpm/opengamepadui.spec b/package/rpm/opengamepadui.spec new file mode 100644 index 00000000..55ac8dd4 --- /dev/null +++ b/package/rpm/opengamepadui.spec @@ -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 diff --git a/rootfs/Makefile b/rootfs/Makefile index 811cab95..c817be7b 100644 --- a/rootfs/Makefile +++ b/rootfs/Makefile @@ -1,4 +1,5 @@ PREFIX ?= $(HOME)/.local +INSTALL_PREFIX ?= $(PREFIX) ##@ General @@ -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 \ diff --git a/rootfs/usr/bin/opengamepadui b/rootfs/usr/bin/opengamepadui index e5ebb431..a253578d 100755 --- a/rootfs/usr/bin/opengamepadui +++ b/rootfs/usr/bin/opengamepadui @@ -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 diff --git a/rootfs/usr/share/opengamepadui/scripts/make_nice b/rootfs/usr/share/opengamepadui/scripts/make_nice index 7894d65a..bd730ec1 100755 --- a/rootfs/usr/share/opengamepadui/scripts/make_nice +++ b/rootfs/usr/share/opengamepadui/scripts/make_nice @@ -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" diff --git a/rootfs/usr/share/opengamepadui/scripts/manage_input b/rootfs/usr/share/opengamepadui/scripts/manage_input index 3ded343b..d659772d 100755 --- a/rootfs/usr/share/opengamepadui/scripts/manage_input +++ b/rootfs/usr/share/opengamepadui/scripts/manage_input @@ -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 diff --git a/rootfs/usr/share/opengamepadui/scripts/powertools b/rootfs/usr/share/opengamepadui/scripts/powertools index 6d3fcd81..5f1f8ed9 100755 --- a/rootfs/usr/share/opengamepadui/scripts/powertools +++ b/rootfs/usr/share/opengamepadui/scripts/powertools @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/bash set -eu