forked from fasrc/helmod
-
Notifications
You must be signed in to change notification settings - Fork 1
/
HDFView-2.11.0-fasrc01.spec
339 lines (274 loc) · 10.2 KB
/
HDFView-2.11.0-fasrc01.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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
#------------------- package info ----------------------------------------------
#
#
# enter the simple app name, e.g. myapp
#
Name: %{getenv:NAME}
#
# enter the app version, e.g. 0.0.1
#
Version: %{getenv:VERSION}
#
# enter the release; start with fasrc01 (or some other convention for your
# organization) and increment in subsequent releases
#
# the actual "Release", %%{release_full}, is constructed dynamically; for Comp
# and MPI apps, it will include the name/version/release of the apps used to
# build it and will therefore be very long
#
%define release_short %{getenv:RELEASE}
#
# enter your FIRST LAST <EMAIL>
#
Packager: %{getenv:FASRCSW_AUTHOR}
#
# enter a succinct one-line summary (%%{summary} gets changed when the debuginfo
# rpm gets created, so this stores it separately for later re-use); do not
# surround this string with quotes
#
%define summary_static Viewer for HDF5 files
Summary: %{summary_static}
#
# enter the url from where you got the source; change the archive suffix if
# applicable
#
URL: http://www.hdfgroup.org/ftp/HDF5/hdf-java/current/bin/HDFView-2.11-centos6-x64.tar.gz
Source: %{name}-%{version}.tar.gz
#
# there should be no need to change the following
#
#these fields are required by RPM
Group: fasrcsw
License: see COPYING file or upstream packaging
#this comes here since it uses Name and Version but dynamically computes Release, Prefix, etc.
%include fasrcsw_defines.rpmmacros
Release: %{release_full}
Prefix: %{_prefix}
#
# Macros for setting app data
# The first set can probably be left as is
# the nil construct should be used for empty values
#
%define modulename %{name}-%{version}-%{release_short}
%define appname %(test %{getenv:APPNAME} && echo "%{getenv:APPNAME}" || echo "%{name}")
%define appversion %(test %{getenv:APPVERSION} && echo "%{getenv:APPVERSION}" || echo "%{version}")
%define appdescription %{summary_static}
%define type %{getenv:TYPE}
%define specauthor %{getenv:FASRCSW_AUTHOR}
%define builddate %(date)
%define buildhost %(hostname)
%define buildhostversion 1
%define compiler %( if [[ %{getenv:TYPE} == "Comp" || %{getenv:TYPE} == "MPI" ]]; then if [[ -n "%{getenv:FASRCSW_COMPS}" ]]; then echo "%{getenv:FASRCSW_COMPS}"; fi; else echo "system"; fi)
%define mpi %(if [[ %{getenv:TYPE} == "MPI" ]]; then if [[ -n "%{getenv:FASRCSW_MPIS}" ]]; then echo "%{getenv:FASRCSW_MPIS}"; fi; else echo ""; fi)
%define builddependencies %{nil}
%define rundependencies %{builddependencies}
%define buildcomments Tarball is a repackaging of the archive that was unpacked by the shell script from the download
%define requestor Miriam Johnston <[email protected]>
%define requestref RCRT:99815
# apptags
# For aci-ref database use aci-ref-app-category and aci-ref-app-tag namespaces and separate tags with a semi-colon
# aci-ref-app-category:Programming Tools; aci-ref-app-tag:Compiler
%define apptags %{nil}
%define apppublication %{nil}
#
# enter a description, often a paragraph; unless you prefix lines with spaces,
# rpm will format it, so no need to worry about the wrapping
#
# NOTE! INDICATE IF THERE ARE CHANGES FROM THE NORM TO THE BUILD!
#
%description
HDFView is a visual tool for browsing and editing HDF4 and HDF5 files. Using HDFView, you can
- view a file hierarchy in a tree structure
- create new files, add or delete groups and datasets
- view and modify the content of a dataset
- add, delete and modify attributes
#------------------- %%prep (~ tar xvf) ---------------------------------------
%prep
#
# FIXME
#
# unpack the sources here. The default below is for standard, GNU-toolchain
# style things -- hopefully it'll just work as-is.
#
umask 022
cd "$FASRCSW_DEV"/rpmbuild/BUILD
rm -rf %{name}-%{version}
tar xvf "$FASRCSW_DEV"/rpmbuild/SOURCES/%{name}-%{version}.tar.*
cd %{name}-%{version}
chmod -Rf a+rX,u+w,g-w,o-w .
#------------------- %%build (~ configure && make) ----------------------------
%build
cd "$FASRCSW_DEV"/rpmbuild/BUILD/%{name}-%{version}
sed -i -e 's?^export INSTALLDIR.*?export INSTALLDIR=%{_prefix}?' bin/hdfview.sh
#------------------- %%install (~ make install + create modulefile) -----------
%install
#(leave this here)
%include fasrcsw_module_loads.rpmmacros
#
# FIXME
#
# make install here. The default below is for standard GNU-toolchain style
# things -- hopefully it'll just work as-is.
#
# Note that DESTDIR != %{prefix} -- this is not the final installation.
# Rpmbuild does a temporary installation in the %{buildroot} and then
# constructs an rpm out of those files. See the following hack if your app
# does not support this:
#
# https://github.com/fasrc/fasrcsw/blob/master/doc/FAQ.md#how-do-i-handle-apps-that-insist-on-writing-directly-to-the-production-location
#
# %%{buildroot} is usually ~/rpmbuild/BUILDROOT/%{name}-%{version}-%{release}.%{arch}.
# (A spec file cannot change it, thus it is not inside $FASRCSW_DEV.)
#
umask 022
cd "$FASRCSW_DEV"/rpmbuild/BUILD/%{name}-%{version}
echo %{buildroot} | grep -q %{name}-%{version} && rm -rf %{buildroot}
mkdir -p %{buildroot}/%{_prefix}
cp -r * %{buildroot}/%{_prefix}
#(this should not need to be changed)
#these files are nice to have; %%doc is not as prefix-friendly as I would like
#if there are other files not installed by make install, add them here
for f in COPYING AUTHORS README INSTALL ChangeLog NEWS THANKS TODO BUGS; do
test -e "$f" && ! test -e '%{buildroot}/%{_prefix}/'"$f" && cp -a "$f" '%{buildroot}/%{_prefix}/'
done
#(this should not need to be changed)
#this is the part that allows for inspecting the build output without fully creating the rpm
%if %{defined trial}
set +x
echo
echo
echo "*************** fasrcsw -- STOPPING due to %%define trial yes ******************"
echo
echo "Look at the tree output below to decide how to finish off the spec file. (\`Bad"
echo "exit status' is expected in this case, it's just a way to stop NOW.)"
echo
echo
tree '%{buildroot}/%{_prefix}'
echo
echo
echo "Some suggestions of what to use in the modulefile:"
echo
echo
generate_setup.sh --action echo --format lmod --prefix '%%{_prefix}' '%{buildroot}/%{_prefix}'
echo
echo
echo "******************************************************************************"
echo
echo
#make the build stop
false
set -x
%endif
#
# FIXME (but the above is enough for a "trial" build)
#
# This is the part that builds the modulefile. However, stop now and run
# `make trial'. The output from that will suggest what to add below.
#
# - uncomment any applicable prepend_path things (`--' is a comment in lua)
#
# - do any other customizing of the module, e.g. load dependencies -- make sure
# any dependency loading is in sync with the %%build section above!
#
# - in the help message, link to website docs rather than write anything
# lengthy here
#
# references on writing modules:
# http://www.tacc.utexas.edu/tacc-projects/lmod/advanced-user-guide/writing-module-files
# http://www.tacc.utexas.edu/tacc-projects/lmod/system-administrator-guide/initial-setup-of-modules
# http://www.tacc.utexas.edu/tacc-projects/lmod/system-administrator-guide/module-commands-tutorial
#
mkdir -p %{buildroot}/%{_prefix}
cat > %{buildroot}/%{_prefix}/modulefile.lua <<EOF
local helpstr = [[
%{name}-%{version}-%{release_short}
%{summary_static}
%{buildcomments}
]]
help(helpstr,"\n")
whatis("Name: %{name}")
whatis("Version: %{version}-%{release_short}")
whatis("Description: %{summary_static}")
---- prerequisite apps (uncomment and tweak if necessary)
for i in string.gmatch("%{rundependencies}","%%S+") do
if mode()=="load" then
a = string.match(i,"^[^/]+")
if not isloaded(a) then
load(i)
end
end
end
---- environment changes (uncomment what is relevant)
setenv("HDFVIEW_HOME", "%{_prefix}")
prepend_path("PATH", "%{_prefix}/bin")
EOF
#------------------- App data file
cat > $FASRCSW_DEV/appdata/%{modulename}.%{type}.dat <<EOF
appname : %{appname}
appversion : %{appversion}
description : %{appdescription}
tags : %{apptags}
publication : %{apppublication}
modulename : %{modulename}
type : %{type}
compiler : %{compiler}
mpi : %{mpi}
specauthor : %{specauthor}
builddate : %{builddate}
buildhost : %{buildhost}
buildhostversion : %{buildhostversion}
builddependencies : %{builddependencies}
rundependencies : %{rundependencies}
buildcomments : %{buildcomments}
requestor : %{requestor}
requestref : %{requestref}
EOF
#------------------- %%files (there should be no need to change this ) --------
%files
%defattr(-,root,root,-)
%{_prefix}/*
#------------------- scripts (there should be no need to change these) --------
%pre
#
# everything in fasrcsw is installed in an app hierarchy in which some
# components may need creating, but no single rpm should own them, since parts
# are shared; only do this if it looks like an app-specific prefix is indeed
# being used (that's the fasrcsw default)
#
echo '%{_prefix}' | grep -q '%{name}.%{version}' && mkdir -p '%{_prefix}'
#
%post
#
# symlink to the modulefile installed along with the app; we want all rpms to
# be relocatable, hence why this is not a proper %%file; as with the app itself,
# modulefiles are in an app hierarchy in which some components may need
# creating
#
mkdir -p %{modulefile_dir}
ln -s %{_prefix}/modulefile.lua %{modulefile}
#
%preun
#
# undo the module file symlink done in the %%post; do not rmdir
# %%{modulefile_dir}, though, since that is shared by multiple apps (yes,
# orphans will be left over after the last package in the app family
# is removed)
#
test -L '%{modulefile}' && rm '%{modulefile}'
#
%postun
#
# undo the last component of the mkdir done in the %%pre (yes, orphans will be
# left over after the last package in the app family is removed); also put a
# little protection so this does not cause problems if a non-default prefix
# (e.g. one shared with other packages) is used
#
test -d '%{_prefix}' && echo '%{_prefix}' | grep -q '%{name}.%{version}' && rmdir '%{_prefix}'
#
%clean
#
# wipe out the buildroot, but put some protection to make sure it isn't
# accidentally / or something -- we always have "rpmbuild" in the name
#
echo '%{buildroot}' | grep -q 'rpmbuild' && rm -rf '%{buildroot}'
#