-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmise.spec
107 lines (83 loc) · 3.1 KB
/
mise.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#
# spec file for package mise
#
# Copyright (c) 2024 Jo Carllyle
#
# Please submit bugfixes or comments via https://github.com/JamesBrosy/rpm-spec-templates
#
%global _build_id_links none
%global debug_package %{nil}
%global pkgname mise
Name: %{pkgname}
Version: VERSION
Release: 1%{?dist}
Summary: The front-end to your dev env
License: MIT
URL: https://github.com/jdx/%{pkgname}
Source0: %{url}/archive/v%{version}/%{pkgname}-%{version}.tar.gz
BuildRequires: gcc, curl, openssl, openssl-devel, zlib, zlib-devel
%description
The front-end to your dev env
%package bash-completion
Summary: Bash completion for %{name}
Requires: %{name} = %{version}-%{release}
Requires: bash-completion
Supplements: (%{name} and bash-completion)
%description bash-completion
Bash command line completion support for %{name}.
%package zsh-completion
Summary: Zsh completion for %{name}
Requires: %{name} = %{version}-%{release}
Requires: zsh
Supplements: (%{name} and zsh)
%description zsh-completion
Zsh command line completion support for %{name}.
%package fish-completion
Summary: Fish completion for %{name}
Requires: fish
Supplements: (%{name} and fish)
%description fish-completion
Fish command line completion support for %{name}.
%prep
%autosetup
%build
# install toolchain
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
# fetch deps
cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
# build release
cargo build --offline --release --frozen
./target/release/%{pkgname} completion zsh > target/_%{pkgname}
./target/release/%{pkgname} completion bash > target/%{pkgname}
./target/release/%{pkgname} completion fish > target/%{pkgname}.fish
touch target/empty_file
cat << 'EOF' > target/%{pkgname}.sh
# Activate mise. See https://mise.jdx.dev/installing-mise.html#shells
eval "$(mise activate $(ps -p $$ -o comm=))"
EOF
%install
install -Dsm755 -T target/release/%{pkgname} %{buildroot}%{_bindir}/%{pkgname}
install -Dm644 -T man/man1/%{pkgname}.1 %{buildroot}%{_mandir}/man1/%{pkgname}.1
install -Dm644 -T target/_%{pkgname} %{buildroot}%{_datadir}/zsh/site-functions/_%{pkgname}
install -Dm644 -T target/%{pkgname} %{buildroot}%{_datadir}/bash-completion/completions/%{pkgname}
install -Dm644 -T target/%{pkgname}.fish %{buildroot}%{_datadir}/fish/vendor_completions.d/%{pkgname}.fish
install -Dm644 -T target/empty_file %{buildroot}/usr/lib/%{pkgname}/.disable-self-update
install -Dm644 -T target/%{pkgname}.sh %{buildroot}%{_sysconfdir}/profile.d/%{pkgname}.sh
%files
%license LICENSE
%{_bindir}/%{pkgname}
%{_mandir}/man1/*
%dir /usr/lib/%{pkgname}
/usr/lib/%{pkgname}/.disable-self-update
%dir %{_sysconfdir}/profile.d
%{_sysconfdir}/profile.d/*
%files bash-completion
%{_datadir}/bash-completion/*
%files zsh-completion
%{_datadir}/zsh/*
%files fish-completion
%{_datadir}/fish/*
%changelog
* DATE Jeff Dickey <[email protected]>
- See GitHub for full changelog