Skip to content

Commit

Permalink
Merge pull request #1 from ShadowBlip/shadowapex/rpm-build
Browse files Browse the repository at this point in the history
fix(CI): add RPM packaging to automatic releases
  • Loading branch information
ShadowApex authored Jan 24, 2024
2 parents d7124b7 + fe70e3f commit d33b392
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .releaserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,7 @@ plugins:
# Publish artifacts as a GitHub release
- - "@semantic-release/github"
- assets:
- path: dist/gamescope-dbus-*.rpm
- path: dist/gamescope-dbus-*.rpm.sha256.txt
- path: dist/gamescope-dbus.tar.gz
- path: dist/gamescope-dbus.tar.gz.sha256.txt
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@ name = "gamescope-dbus"
version = "1.0.0"
edition = "2021"
license = "GPL-3.0-or-later"
description = "Daemon for interacting with Gamescope over DBus"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[package.metadata.generate-rpm]
assets = [
{ source = "./target/release/gamescope-dbus", dest = "/usr/bin/gamescope-dbus", mode = "755" },
{ source = "./rootfs/usr/share/dbus-1/session.d/org.shadowblip.Gamescope.conf", dest = "/usr/share/dbus-1/session.d/org.shadowblip.Gamescope.conf", mode = "644" },
{ source = "./rootfs/usr/share/dbus-1/services/org.shadowblip.Gamescope.service", dest = "/usr/share/dbus-1/services/org.shadowblip.Gamescope.service", mode = "644" },
{ source = "./rootfs/usr/lib/systemd/user/gamescope-dbus.service", dest = "/usr/lib/systemd/user/gamescope-dbus.service", mode = "644" },
]

[dependencies]
log = "0.4.20"
Expand Down
22 changes: 18 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
NAME := $(shell grep 'name =' Cargo.toml | head -n 1 | cut -d'"' -f2)
VERSION := $(shell grep '^version =' Cargo.toml | cut -d'"' -f2)
ARCH := $(shell uname -m)
DBUS_NAME := org.shadowblip.Gamescope
ALL_RS := $(shell find src -name '*.rs')
PREFIX ?= /usr
Expand Down Expand Up @@ -53,12 +55,12 @@ uninstall: ## Uninstall gamescope-dbus

.PHONY: debug
debug: target/debug/$(NAME) ## Build debug build
target/debug/$(NAME): $(ALL_RS) Cargo.lock
target/debug/$(NAME): $(ALL_RS) Cargo.lock Cargo.toml
cargo build

.PHONY: build
build: target/release/$(NAME) ## Build release build
target/release/$(NAME): $(ALL_RS) Cargo.lock
target/release/$(NAME): $(ALL_RS) Cargo.lock Cargo.toml
cargo build --release

.PHONY: all
Expand Down Expand Up @@ -94,15 +96,27 @@ setup: /usr/share/dbus-1/session.d/$(DBUS_NAME).conf ## Install dbus policies
##@ Distribution

.PHONY: dist
dist: dist/gamescope-dbus.tar.gz ## Build a redistributable archive of the project
dist/gamescope-dbus.tar.gz: build
dist: dist/$(NAME).tar.gz dist/$(NAME)-$(VERSION)-1.$(ARCH).rpm ## Create all redistributable versions of the project

.PHONY: dist-archive
dist-archive: dist/$(NAME).tar.gz ## Build a redistributable archive of the project
dist/$(NAME).tar.gz: build
rm -rf $(CACHE_DIR)/gamescope-dbus
mkdir -p $(CACHE_DIR)/gamescope-dbus
$(MAKE) install PREFIX=$(CACHE_DIR)/gamescope-dbus/usr NO_RELOAD=true
mkdir -p dist
tar cvfz $@ -C $(CACHE_DIR) gamescope-dbus
cd dist && sha256sum gamescope-dbus.tar.gz > gamescope-dbus.tar.gz.sha256.txt

.PHONY: dist-rpm
dist-rpm: dist/$(NAME)-$(VERSION)-1.$(ARCH).rpm ## Build a redistributable RPM package
dist/$(NAME)-$(VERSION)-1.$(ARCH).rpm: target/release/$(NAME)
mkdir -p dist
cargo install cargo-generate-rpm
cargo generate-rpm
cp ./target/generate-rpm/$(NAME)-$(VERSION)-1.$(ARCH).rpm dist
cd dist && sha256sum $(NAME)-$(VERSION)-1.$(ARCH).rpm > $(NAME)-$(VERSION)-1.$(ARCH).rpm.sha256.txt

.PHONY: introspect
introspect: ## Generate DBus XML
echo "Generating DBus XML spec..."
Expand Down

0 comments on commit d33b392

Please sign in to comment.