Skip to content

Commit

Permalink
Refactor installation and binary naming
Browse files Browse the repository at this point in the history
  • Loading branch information
BlakeGardner committed Sep 27, 2024
1 parent e700691 commit 06e7349
Showing 1 changed file with 52 additions and 13 deletions.
65 changes: 52 additions & 13 deletions xremap.spec
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,19 @@ cargo build --release --features wlroots --target-dir target-wlroots
rm -rf %{buildroot}

# Install vanilla variant
install -D -m 0755 target-vanilla/release/xremap %{buildroot}%{_bindir}/xremap
install -D -m 0755 target-vanilla/release/xremap %{buildroot}%{_bindir}/xremap-vanilla

# Install GNOME variant
install -D -m 0755 target-gnome/release/xremap %{buildroot}%{_bindir}/xremap
install -D -m 0755 target-gnome/release/xremap %{buildroot}%{_bindir}/xremap-gnome

# Install X11 variant
install -D -m 0755 target-x11/release/xremap %{buildroot}%{_bindir}/xremap
install -D -m 0755 target-x11/release/xremap %{buildroot}%{_bindir}/xremap-x11

# Install KDE variant
install -D -m 0755 target-kde/release/xremap %{buildroot}%{_bindir}/xremap
install -D -m 0755 target-kde/release/xremap %{buildroot}%{_bindir}/xremap-kde

# Install wlroots variant
install -D -m 0755 target-wlroots/release/xremap %{buildroot}%{_bindir}/xremap
install -D -m 0755 target-wlroots/release/xremap %{buildroot}%{_bindir}/xremap-wlroots

# Install udev rules
install -D -m 0644 %{SOURCE1} %{buildroot}/usr/lib/udev/rules.d/00-xremap-input.rules
Expand All @@ -98,41 +98,80 @@ install -D -m 0644 %{SOURCE1} %{buildroot}/usr/lib/udev/rules.d/00-xremap-input.
getent group input >/dev/null || groupadd -r input

%post
# Reload udev rules
udevadm control --reload-rules
udevadm trigger
# Vanilla variant
alternatives --install /usr/bin/xremap xremap %{_bindir}/xremap-vanilla 10

%preun
if [ $1 -eq 0 ]; then
alternatives --remove xremap %{_bindir}/xremap-vanilla
fi

%post gnome
alternatives --install /usr/bin/xremap xremap %{_bindir}/xremap-gnome 20

%preun gnome
if [ $1 -eq 0 ]; then
alternatives --remove xremap %{_bindir}/xremap-gnome
fi

%post x11
alternatives --install /usr/bin/xremap xremap %{_bindir}/xremap-x11 20

%preun x11
if [ $1 -eq 0 ]; then
alternatives --remove xremap %{_bindir}/xremap-x11
fi

%post kde
alternatives --install /usr/bin/xremap xremap %{_bindir}/xremap-kde 20

%preun kde
if [ $1 -eq 0 ]; then
alternatives --remove xremap %{_bindir}/xremap-kde
fi

%post wlroots
alternatives --install /usr/bin/xremap xremap %{_bindir}/xremap-wlroots 20

%preun wlroots
if [ $1 -eq 0 ]; then
alternatives --remove xremap %{_bindir}/xremap-wlroots
fi

%files
%license LICENSE
%doc README.md
%{_bindir}/xremap
%{_bindir}/xremap-vanilla
/usr/lib/udev/rules.d/00-xremap-input.rules

%files gnome
%license LICENSE
%doc README.md
%{_bindir}/xremap
%{_bindir}/xremap-gnome
/usr/lib/udev/rules.d/00-xremap-input.rules

%files x11
%license LICENSE
%doc README.md
%{_bindir}/xremap
%{_bindir}/xremap-x11
/usr/lib/udev/rules.d/00-xremap-input.rules

%files kde
%license LICENSE
%doc README.md
%{_bindir}/xremap
%{_bindir}/xremap-kde
/usr/lib/udev/rules.d/00-xremap-input.rules

%files wlroots
%license LICENSE
%doc README.md
%{_bindir}/xremap
%{_bindir}/xremap-wlroots
/usr/lib/udev/rules.d/00-xremap-input.rules

%changelog
* Tue Sep 27 2024 Blake Gardner <[email protected]> - 0.10.1-3
- Use alternatives system to manage multiple xremap binaries

* Tue Sep 27 2024 Blake Gardner <[email protected]> - 0.10.1-3
- Re-enabled debug rpms and debug symbols in Rust binaries

Expand Down

0 comments on commit 06e7349

Please sign in to comment.