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

Feature request: RPM SPEC file #1171

Open
Thulium-Drake opened this issue Jul 28, 2024 · 2 comments
Open

Feature request: RPM SPEC file #1171

Thulium-Drake opened this issue Jul 28, 2024 · 2 comments
Labels
enhancement New feature or request PRs welcome jtroo has no plans to work on this at present, but PRs are welcome

Comments

@Thulium-Drake
Copy link

Is your feature request related to a problem? Please describe.

To make the tool easier to install/update, I'd really like to have an RPM for Fedora. So I wrote a RPM SPEC file

Feedback to the file appreciated :)

Describe the solution you'd like.

Name:           kanata
Version:        %{version}
Release:        1%{?dist}
Summary:        Improve keyboard comfort and usability with advanced customization
BuildArch:      x86_64
License:        LGPL-3.0
%undefine _disable_source_fetch
Source0:        https://github.com/jtroo/kanata/archive/refs/tags/v%{version}.tar.gz
BuildRequires: rustup
BuildRequires: gcc

%description
This is a cross-platform software keyboard remapper for Linux, macOS and Windows. A short summary of the features:

*  multiple layers of key functionality
*  advanced key behaviour customization (e.g. tap-hold, macros, unicode)
*  cross-platform human readable configuration file

%prep
%autosetup -n %{name}-%{version}

%build
rustup-init -y
. "$HOME/.cargo/env"
rustup update stable
cargo update -p time  # needs to be updated for some reason
cargo build --release

%install
# Install binary
mkdir -p %{buildroot}/%{_bindir}
cp %{_builddir}/%{name}-%{version}/target/release/%{name} %{buildroot}/%{_bindir}

# Install config examples, systemd user unit and README
mkdir -p %{buildroot}/%{_docdir}/%{name}
cp -r %{_builddir}/%{name}-%{version}/cfg_samples %{buildroot}/%{_docdir}/%{name}
cp %{_builddir}/%{name}-%{version}/README.md %{buildroot}/%{_docdir}/%{name}

%{__cat} << EOF > %{buildroot}/%{_docdir}/%{name}/%{name}.service
[Unit]
Description=Kanata keyboard remapper
Documentation=https://github.com/jtroo/kanata

[Service]
Environment=DISPLAY=:0
Type=simple
ExecStart=/usr/bin/kanata --cfg ${HOME}/.config/kanata/config.kbd
Restart=no

[Install]
WantedBy=default.target
EOF

# Install udev rule
mkdir -p %{buildroot}/%{_sysconfdir}/udev/rules.d
%{__cat} << EOF > %{buildroot}/%{_sysconfdir}/udev/rules.d/90-kanata-uinput.rules
KERNEL=="uinput", MODE="0660", GROUP="uinput", OPTIONS+="static_node=uinput"
EOF

%clean
rm -rf %{buildroot}

%pre
/usr/bin/getent group uinput || /usr/sbin/groupadd -r uinput

%postun
/usr/sbin/groupdel uinput

%files
%{_bindir}/%{name}
%{_docdir}/%{name}/README.md
%{_docdir}/%{name}/%{name}.service
%{_docdir}/%{name}/cfg_samples/*
%{_sysconfdir}/udev/rules.d/90-kanata-uinput.rules

%changelog
* Mon Jan 29 2024 Jeffrey van Pelt <jeff@vanpelt.one> - 0.0.1
- Initial RPM package

Once you've set up rpmbuild, you can build it with:

dnf builddep -D 'version 1.0' -y SPECS/kanata.spec  # version doesn't matter for this command
rpmbuild -bb -D '%version 1.6.1' SPECS/kanata.spec

Describe alternatives you've considered.

Additional context

No response

@Thulium-Drake Thulium-Drake added the enhancement New feature or request label Jul 28, 2024
@newsve
Copy link

newsve commented Jul 31, 2024

Remember it's just one guy maintaining it and there would be just too many distros/package managers to support on each build. I'd like to let him focus on what matters, and a git clone/pull + cargo build isn't a too big ask and done in few secs.

@jtroo
Copy link
Owner

jtroo commented Jul 31, 2024

If the steps to make an RPM can be added as a part of the Linux build steps in the top-level justfile, and it can be made simple to run, then I'd be happy to accept a PR for this. I don't have the expertise to review an rpm SPEC file though.

@jtroo jtroo added the PRs welcome jtroo has no plans to work on this at present, but PRs are welcome label Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PRs welcome jtroo has no plans to work on this at present, but PRs are welcome
Projects
None yet
Development

No branches or pull requests

3 participants