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

feat: add alternative headless and libadwaita builds #227

Merged
merged 14 commits into from
Dec 9, 2023
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
12 changes: 9 additions & 3 deletions .github/workflows/build-packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ jobs:
build-packages:
strategy:
matrix:
target-os: [debian-12, ubuntu-2204, fedora-38, fedora-39, arch]
target-os: [ debian-12, ubuntu-2204, fedora-38, fedora-39, arch ]
recipe: [ lact, lact-headless ]
include:
- target-os: fedora-39
recipe: lact-libadwaita
- target-os: arch
recipe: lact-libadwaita
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -19,9 +25,9 @@ jobs:
run: |
curl -L -o /tmp/pkger.deb https://github.com/vv9k/pkger/releases/download/0.11.0/pkger-0.11.0-0.amd64.deb
sudo apt -y install /tmp/pkger.deb

- name: Build packages
run: pkger -c .pkger.yml build lact -i ${{ matrix.target-os }}
run: pkger -c .pkger.yml build ${{ matrix.recipe }} -i ${{ matrix.target-os }}

- name: Copy release files
run: |
Expand Down
37 changes: 35 additions & 2 deletions Cargo.lock

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

8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ DESTDIR ?= /
PREFIX ?= /usr/local

build-release:
cargo build --release
cargo build -p lact --release

build-release-libadwaita:
cargo build -p lact --release --features=adw

build-release-headless:
cargo build -p lact --release --no-default-features --features=drm

install:
install -Dm755 target/release/lact $(DESTDIR)$(PREFIX)/bin/lact
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ Minimal build (no GUI!):
cargo build --no-default-features -p lact
```

Build GUI with libadwaita support:
```
make build-release-libadwaita
```

# API

There is an API available over a unix socket. See [here](API.md) for more information.
Expand Down
3 changes: 3 additions & 0 deletions lact-gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ gtk = { version = "0.7", package = "gtk4", features = ["v4_6", "blueprint"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
anyhow = "1.0"
adw = { package = "libadwaita", version = "0.5.3", features = [
"v1_4",
], optional = true }

[dev-dependencies]
pretty_assertions = "1.4.0"
4 changes: 4 additions & 0 deletions lact-gui/src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ pub struct App {

impl App {
pub fn new(daemon_client: DaemonClient) -> Self {
#[cfg(feature = "adw")]
let application: Application =
adw::Application::new(Some(APP_ID), ApplicationFlags::default()).upcast();
#[cfg(not(feature = "adw"))]
let application = Application::new(Some(APP_ID), ApplicationFlags::default());

let header = Header::new();
Expand Down
1 change: 1 addition & 0 deletions lact/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ edition = "2021"
[features]
default = ["lact-gui", "drm"]
drm = ["lact-daemon/drm"]
adw = ["lact-gui/adw"]

[dependencies]
lact-daemon = { path = "../lact-daemon", default-features = false }
Expand Down
36 changes: 36 additions & 0 deletions pkg/recipes/lact-headless/recipe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
metadata:
name: lact-headless
description: AMDGPU control utility
arch: x86_64
license: MIT
version: 0.5.1
maintainer: ilya-zlobintsev
url: https://github.com/ilya-zlobintsev/lact
source:
- '../../..'
provides: [ lact ]
conflicts: [ lact, lact-libadwaita ]
depends:
all: [ hwdata ]
debian-12+ubuntu-2204: [ libdrm-amdgpu1 ]
fedora-38+fedora-39: [ libdrm ]
arch: [ libdrm ]
build_depends:
all: [ curl, make, dbus, clang ]
debian-12+ubuntu-2204: [ pkg-config, build-essential, libdrm-dev ]
fedora-38+fedora-39: [ gcc, libdrm-devel ]
arch: [ libdrm ]
all_images: true
env:
RUSTUP_URL: https://sh.rustup.rs
configure:
steps:
- cmd: curl -o /tmp/install_rust.sh $RUSTUP_URL
- cmd: sh /tmp/install_rust.sh -y --default-toolchain stable
build:
steps:
- cmd: bash -c "source $HOME/.cargo/env && make build-release-headless"
install:
steps:
- cmd: bash -c "cd $PKGER_BLD_DIR && DESTDIR=$PKGER_OUT_DIR PREFIX=/usr make install"

38 changes: 38 additions & 0 deletions pkg/recipes/lact-libadwaita/recipe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
metadata:
name: lact-libadwaita
description: AMDGPU control utility
arch: x86_64
license: MIT
version: 0.5.1
maintainer: ilya-zlobintsev
url: https://github.com/ilya-zlobintsev/lact
source:
- '../../..'
provides: [ lact ]
conflicts: [ lact, lact-headless ]
depends:
all: [ hwdata ]
fedora-39: [ gtk4, libdrm, libadwaita ]
arch: [ gtk4, libadwaita ]
build_depends:
all: [ curl, make, dbus, clang ]
fedora-39: [ gtk4-devel, gcc, libdrm-devel, blueprint-compiler, libadwaita-devel ]
arch: [ gtk4, blueprint-compiler, libadwaita ]
all_images: true
env:
RUSTUP_URL: https://sh.rustup.rs
configure:
steps:
- cmd: curl -o /tmp/install_rust.sh $RUSTUP_URL
- cmd: sh /tmp/install_rust.sh -y --default-toolchain stable
- cmd: >-
curl -o /tmp/blueprint-compiler.deb http://de.archive.ubuntu.com/ubuntu/pool/universe/b/blueprint-compiler/blueprint-compiler_0.10.0-3_all.deb &&
apt install -y /tmp/blueprint-compiler.deb
deb: true
build:
steps:
- cmd: bash -c "source $HOME/.cargo/env && make build-release-libadwaita"
install:
steps:
- cmd: bash -c "cd $PKGER_BLD_DIR && DESTDIR=$PKGER_OUT_DIR PREFIX=/usr make install"

3 changes: 2 additions & 1 deletion pkg/recipes/lact/recipe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
source:
- '../../..'
provides: [ lact ]
conflicts: [ lact-headless, lact-libadwaita ]
depends:
all: [ hwdata ]
debian-12+ubuntu-2204: [ libgtk-4-1 ]
Expand All @@ -32,7 +33,7 @@ configure:
deb: true
build:
steps:
- cmd: bash -c "source $HOME/.cargo/env && make"
- cmd: bash -c "source $HOME/.cargo/env && make build-release"
install:
steps:
- cmd: bash -c "cd $PKGER_BLD_DIR && DESTDIR=$PKGER_OUT_DIR PREFIX=/usr make install"
Expand Down