-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmise.spec
126 lines (100 loc) · 3.7 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#
# 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: %{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}
Group: System/Shells
Requires: %{name} = %{version}-%{release}
Requires: bash-completion, usage
Supplements: (%{name} and bash-completion)
BuildArch: noarch
%description bash-completion
Bash command line completion support for %{name}.
%package zsh-completion
Summary: Zsh completion for %{name}
Group: System/Shells
Requires: %{name} = %{version}-%{release}
Requires: zsh, usage
Supplements: (%{name} and zsh)
BuildArch: noarch
%description zsh-completion
Zsh command line completion support for %{name}.
%package fish-completion
Summary: Fish completion for %{name}
Group: System/Shells
Requires: %{name} = %{version}-%{release}
Requires: fish, usage
Supplements: (%{name} and fish)
BuildArch: noarch
%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
[ "$SHELL" == "/bin/bash" ] && eval "$(mise activate bash)"
[ "$ZSH_NAME" == "zsh" ] && eval "$(mise activate zsh)"
EOF
cat << 'EOF' > target/%{pkgname}_cf.fish
# Activate mise. See https://mise.jdx.dev/installing-mise.html#shells
if [ "$MISE_FISH_AUTO_ACTIVATE" != "0" ]
mise activate fish | source
end
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
install -Dm644 -T target/%{pkgname}_cf.fish %{buildroot}%{_sysconfdir}/fish/conf.d/%{pkgname}.fish
%files
%license LICENSE
%{_bindir}/%{pkgname}
%{_mandir}/man1/*
%dir /usr/lib/%{pkgname}
/usr/lib/%{pkgname}/.disable-self-update
%dir %{_sysconfdir}/profile.d
%{_sysconfdir}/profile.d/*
%dir %{_sysconfdir}/fish
%{_sysconfdir}/fish/*
%files bash-completion
%{_datadir}/bash-completion/*
%files zsh-completion
%{_datadir}/zsh/*
%files fish-completion
%{_datadir}/fish/*
%changelog
* DATE Jeff Dickey <216188+jdx@users.noreply.github.com>
- See GitHub for full changelog