forked from tenstorrent/luwen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrust-luwen.spec
246 lines (202 loc) · 6.94 KB
/
rust-luwen.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
%bcond_without check
#% bcond_with check
%global crate luwen
%global path_luwen_if %{cargo_registry}/luwen-if-%{version_no_tilde}
%global path_luwen_ref %{cargo_registry}/luwen-ref-%{version_no_tilde}
%global path_ttkmd_if %{cargo_registry}/ttkmd-if-%{version_no_tilde}
Name: rust-luwen
Version: 0.3.7
Release: %autorelease.git.142.499b83b
Summary: High-level interface for safe and efficient access Tenstorrent AI accelerators
License: Apache-2.0
URL: https://crates.io/crates/luwen
Source: rust-luwen-git-142.499b83b.tar.gz
BuildRequires: cargo-rpm-macros >= 24
BuildRequires: python%{python3_pkgversion}-devel
#BuildRequires: rust-bincode+default-devel
#BuildRequires: rust-bitfield+default-devel
#BuildRequires: rust-cbindgen+default-devel
#BuildRequires: rust-clap+default-devel
#BuildRequires: rust-clap+derive-devel
#BuildRequires: rust-indicatif+default-devel
#BuildRequires: rust-memmap2+default-devel
#BuildRequires: rust-nix+default-devel
#BuildRequires: rust-nom+default-devel
#BuildRequires: rust-once_cell+default-devel
#BuildRequires: rust-prometheus+default-devel
#BuildRequires: rust-prometheus+process-devel
#BuildRequires: rust-pyo3+default-devel
#BuildRequires: rust-pyo3+extension-module-devel
#BuildRequires: rust-pyo3+multiple-pymethods-devel
#BuildRequires: rust-rand+default-devel
#BuildRequires: rust-rust-embed+default-devel
#BuildRequires: rust-rust-embed+interpolate-folder-path-devel
#BuildRequires: rust-serde+default-devel
#BuildRequires: rust-serde+derive-devel
#BuildRequires: rust-serde_yaml+default-devel
#BuildRequires: rust-thiserror+default-devel
#BuildRequires: rust-tracing+default-devel
#BuildRequires: rust-memmap2_0.7+default-devel
#BuildRequires: rust-nix0.26+default-devel
#BuildRequires: rust-pyo3_0.19+default-devel
#BuildRequires: rust-pyo3_0.19+extension-module-devel
#BuildRequires: rust-pyo3_0.19+multiple-pymethods-devel
# we need to manipulate the Cargo.toml files in flight
BuildRequires: tomcli
BuildRequires: maturin
%global _description %{expand:
A high-level interface for safe and efficient access Tenstorrent AI
accelerators.}
%description
%{_description}
%package -n %{crate}
Summary: %{summary}
# FIXME: paste output of %%cargo_license_summary here
#License: # FIXME
License: Apache-2.0
# LICENSE.dependencies contains a full license breakdown
%description -n %{crate}
%{_description}
%files -n %{crate}
%license LICENSE
%license LICENSE.dependencies
%doc README.md
%doc SUMMARY.md
%doc TODO.md
%{_bindir}/detect_test
%{_bindir}/druken_monkey
%{_bindir}/ethernet_benchmark
%{_bindir}/generate_names
%{_bindir}/luwen-cem
%{_bindir}/luwen-demo
%{_bindir}/reset-test
%{_bindir}/spi-test
############################
# rust-luwen-if
############################
%package -n rust-luwen-if-devel
Summary: Python bindings for the Tenstorrent Luwen library
%description -n rust-luwen-if-devel
This package contains library source intended for building other packages which
use the "internal_metrics" feature of the "%{crate}" crate.
%files -n rust-luwen-if-devel
%{cargo_registry}/luwen-if-%{version_no_tilde}
############################
# rust-luwen-ref
############################
%package -n rust-luwen-ref-devel
Summary: Python bindings for the Tenstorrent Luwen library
%description -n rust-luwen-ref-devel
This package contains library source intended for building other packages which
use the "internal_metrics" feature of the "%{crate}" crate.
%files -n rust-luwen-ref-devel
%{cargo_registry}/luwen-ref-%{version_no_tilde}
############################
# rust-ttkmd-if
############################
%package -n rust-ttkmd-if-devel
Summary: Python bindings for the Tenstorrent Luwen library
%description -n rust-ttkmd-if-devel
This package contains library source intended for building other packages which
use the "internal_metrics" feature of the "%{crate}" crate.
%files -n rust-ttkmd-if-devel
%{cargo_registry}/ttkmd-if-%{version_no_tilde}
############################
# PyLuwen
############################
%package -n python3-pyluwen
Summary: Python bindings for the Tenstorrent Luwen library
%description -n python3-pyluwen
%{_description}
This package contains library source intended for building other packages which
use the "internal_metrics" feature of the "%{crate}" crate.
%files -n python3-pyluwen
%{python3_sitearch}/pyluwen-*.dist-info
%{python3_sitearch}/pyluwen/
############################
# Main package
############################
%prep
%autosetup -p1 -n rust-luwen-git-142.499b83b -p1
%cargo_prep
%generate_buildrequires
%cargo_generate_buildrequires
%build
# This builds everything but luwencpp and pyluwen, the former has a bug, the later we build independently
%cargo_build '--workspace' '--exclude' 'luwencpp' '--exclude' 'pyluwen'
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies
# build pyluwen
cd crates/pyluwen
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" \
LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" \
maturin build --release %{?py_setup_args} %{?*}
%install
%cargo_install
#%{__cp} -av LICENSE % {crate_instdir}/LICENSE
#%{__cp} -av README.md % {crate_instdir}/README.md
#
# Install PyLuwen
# Do this as a pip install, there's not really a 'better' way
#
(
# this is all cribbed from py3_install macro
cd crates/pyluwen
/usr/bin/pip install . --root %{buildroot} --prefix %{_prefix}
rm -rfv %{buildroot}%{_bindir}/__pycache__
)
mkdir -p %{buildroot}%{cargo_registry}
%{__cp} -av crates/luwen-if %{buildroot}%{path_luwen_if}
# Modify the existing Cargo.toml to remove the path for luwen-core as we are moving it out to it's own place on the system
tomcli \
set \
%{buildroot}%{path_luwen_if}/Cargo.toml \
str \
dependencies.luwen-core \
"$( \
tomcli \
get \
%{buildroot}%{path_luwen_if}/Cargo.toml \
dependencies.luwen-core.version \
)"
echo "--- luwen-if Cargo.toml ---"
cat %{buildroot}%{path_luwen_if}/Cargo.toml
echo "--- /luwen-if Cargo.toml ---"
%{__cp} -av crates/luwen-ref %{buildroot}%{path_luwen_ref}
# Modify the existing Cargo.toml to remove the path for luwen-core as we are moving it out to it's own place on the system
for x in luwen-core luwen-if ttkmd-if
do
tomcli \
set \
%{buildroot}%{path_luwen_ref}/Cargo.toml \
str \
dependencies.${x} \
"$( \
tomcli \
get \
%{buildroot}%{path_luwen_ref}/Cargo.toml \
dependencies.${x}.version \
)"
done
%{__cp} -av crates/ttkmd-if %{buildroot}%{path_ttkmd_if}
# Modify the existing Cargo.toml to remove the path for luwen-core as we are moving it out to it's own place on the system
# luwen-core pathfix
tomcli \
set \
%{buildroot}%{path_ttkmd_if}/Cargo.toml \
str \
dependencies.luwen-core \
"$( \
tomcli \
get \
%{buildroot}%{path_ttkmd_if}/Cargo.toml \
dependencies.luwen-core.version \
)"
%if %{with check}
%check
%cargo_test
%endif
%changelog
%autochangelog
* Wed Apr 03 2024 John 'Warthog9' Hawley <[email protected]> 0.3.7-1
- new package built with tito