alibuild 1.17.19__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- alibuild-1.17.19.data/scripts/aliBuild +137 -0
- alibuild-1.17.19.data/scripts/aliDeps +7 -0
- alibuild-1.17.19.data/scripts/aliDoctor +7 -0
- alibuild-1.17.19.data/scripts/alienv +344 -0
- alibuild-1.17.19.data/scripts/pb +7 -0
- alibuild-1.17.19.dist-info/METADATA +78 -0
- alibuild-1.17.19.dist-info/RECORD +74 -0
- alibuild-1.17.19.dist-info/WHEEL +5 -0
- alibuild-1.17.19.dist-info/licenses/LICENSE.md +674 -0
- alibuild-1.17.19.dist-info/top_level.txt +5 -0
- alibuild_helpers/__init__.py +21 -0
- alibuild_helpers/_version.py +21 -0
- alibuild_helpers/analytics.py +120 -0
- alibuild_helpers/args.py +493 -0
- alibuild_helpers/build.py +1209 -0
- alibuild_helpers/build_template.sh +314 -0
- alibuild_helpers/clean.py +83 -0
- alibuild_helpers/cmd.py +154 -0
- alibuild_helpers/deps.py +116 -0
- alibuild_helpers/doctor.py +195 -0
- alibuild_helpers/git.py +104 -0
- alibuild_helpers/init.py +103 -0
- alibuild_helpers/log.py +132 -0
- alibuild_helpers/scm.py +31 -0
- alibuild_helpers/sl.py +62 -0
- alibuild_helpers/sync.py +693 -0
- alibuild_helpers/templating_plugin.py +18 -0
- alibuild_helpers/utilities.py +662 -0
- alibuild_helpers/workarea.py +179 -0
- debian/changelog +11 -0
- debian/compat +1 -0
- debian/control +14 -0
- debian/copyright +10 -0
- debian/files +1 -0
- debian/rules +7 -0
- docs/README.md +1 -0
- docs/SUPPORT +3 -0
- docs/docs/alice_logo.png +0 -0
- docs/docs/deps.png +0 -0
- docs/docs/index.md +75 -0
- docs/docs/quick.md +89 -0
- docs/docs/reference.md +430 -0
- docs/docs/stylesheets/extra.css +9 -0
- docs/docs/troubleshooting.md +346 -0
- docs/docs/user.md +413 -0
- docs/mkdocs.yml +37 -0
- templates/alibuild_to_please.jnj +63 -0
- tests/test_analytics.py +42 -0
- tests/test_args.py +119 -0
- tests/test_build.py +426 -0
- tests/test_clean.py +154 -0
- tests/test_cmd.py +73 -0
- tests/test_deps.py +79 -0
- tests/test_doctor.py +128 -0
- tests/test_git.py +48 -0
- tests/test_hashing.py +67 -0
- tests/test_init.py +103 -0
- tests/test_log.py +50 -0
- tests/test_packagelist.py +235 -0
- tests/test_parseRecipe.py +132 -0
- tests/test_sync.py +332 -0
- tests/test_utilities.py +383 -0
- tests/test_workarea.py +101 -0
- tests/testdist/broken1.sh +1 -0
- tests/testdist/broken2.sh +1 -0
- tests/testdist/broken3.sh +3 -0
- tests/testdist/broken4.sh +2 -0
- tests/testdist/broken5.sh +2 -0
- tests/testdist/broken6.sh +2 -0
- tests/testdist/broken7.sh +5 -0
- tests/testdist/clobber-initdotsh.sh +4 -0
- tests/testdist/defaults-o2.sh +10 -0
- tests/testdist/delete-etc.sh +4 -0
- tests/testdist/tracking-env.sh +6 -0
docs/docs/reference.md
ADDED
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
---
|
|
2
|
+
subtitle: Recipe reference manual
|
|
3
|
+
layout: main
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
1. [Recipe formats](#recipe-formats)
|
|
7
|
+
1. [The header](#the-header)
|
|
8
|
+
2. [The body](#the-body)
|
|
9
|
+
3. [Defaults, common requirements for builds](#defaults)
|
|
10
|
+
2. [Relocation](#relocation)
|
|
11
|
+
|
|
12
|
+
## Recipe formats
|
|
13
|
+
|
|
14
|
+
The recipes are found in the a separate repository. The repository can be
|
|
15
|
+
specified via the `-c` option and defaults to _alidist_.
|
|
16
|
+
|
|
17
|
+
The recipes themselves are called `<package>.sh` where `<package>` is the name
|
|
18
|
+
of the package whose build recipe is described. Please note that all recipe
|
|
19
|
+
filenames are lowercase: _e.g._ the recipe for `ROOT` will be in `root.sh`.
|
|
20
|
+
|
|
21
|
+
The recipe itself is made up of two parts: an header, and the actual build
|
|
22
|
+
script, separated by three dashes (`---`) standalone.
|
|
23
|
+
|
|
24
|
+
The header is in [YAML](https://yaml.org) format and contains metadata about the
|
|
25
|
+
package, like its name, version and where to find the sources.
|
|
26
|
+
|
|
27
|
+
The build script is a standard build script which is invoked by the tool to
|
|
28
|
+
perform the build itself. A few environment variable can be expected to be
|
|
29
|
+
defined when the script is invoked.
|
|
30
|
+
|
|
31
|
+
An example recipe for `zlib` is the following:
|
|
32
|
+
|
|
33
|
+
```yaml
|
|
34
|
+
package: zlib
|
|
35
|
+
version: v1.2.8
|
|
36
|
+
source: https://github.com/madler/zlib
|
|
37
|
+
tag: v1.2.8
|
|
38
|
+
---
|
|
39
|
+
#!/bin/bash -ex
|
|
40
|
+
./configure --prefix=$INSTALLROOT
|
|
41
|
+
make ${JOBS+-j $JOBS}
|
|
42
|
+
make install
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### The header
|
|
46
|
+
|
|
47
|
+
The following entries are mandatory in the header:
|
|
48
|
+
|
|
49
|
+
- `package`: the name of the package
|
|
50
|
+
- `version`: a mnemonic for the version which will be used in the name
|
|
51
|
+
of the package. Notice you can actually use some special formatting
|
|
52
|
+
substitutions which will be replaced with the associated value on build.
|
|
53
|
+
Valid substitutions are:
|
|
54
|
+
- `%(branch_basename)s`: the name of the current alidist branch, without
|
|
55
|
+
the leading `refs/heads/`.
|
|
56
|
+
- `%(branch_stream)s`: in case the alidist branch ends in `-patches`, the
|
|
57
|
+
name of branch without `-patches`. If the branch does not end in
|
|
58
|
+
`-patches`, the `tag` field of the recipe is used.
|
|
59
|
+
- `%(commit_hash)s`: if the `tag` field is a git tag, then the tag name.
|
|
60
|
+
If it is a branch or raw git commit hash instead, then the raw git
|
|
61
|
+
commit hash pointing to the `HEAD` of that branch, or said commit hash.
|
|
62
|
+
- `%(short_hash)s`: like `%(commit_hash)s`, but cut off after 10 characters.
|
|
63
|
+
- `%(tag)s`: the `tag` key specified in the recipe.
|
|
64
|
+
- `%(tag_basename)s` if the `tag` resembles a path, *e.g.*
|
|
65
|
+
`refs/tags/a/b/c`, returns the last part of the path, `c` in this case.
|
|
66
|
+
- `%(defaults_upper)s`: if building with `release` defaults, this is the
|
|
67
|
+
empty string; else, this is an underscore and then the name defaults,
|
|
68
|
+
uppercased, with `-` replaced by `_`. For example, if building with
|
|
69
|
+
`o2-dataflow` defaults, `%(default_upper)s` would be `_O2_DATAFLOW`.
|
|
70
|
+
- `%(year)s`
|
|
71
|
+
- `%(month)s`
|
|
72
|
+
- `%(day)s`
|
|
73
|
+
- `%(hour)s`
|
|
74
|
+
|
|
75
|
+
Month, day and hour are zero-padded to two digits.
|
|
76
|
+
|
|
77
|
+
The following entries are optional in the header:
|
|
78
|
+
|
|
79
|
+
- `source`: URL of a Git repository from which the source is downloaded.
|
|
80
|
+
It's good practice to make sure that they are already patched, so that you
|
|
81
|
+
can easily point to the actual sources used by the software.
|
|
82
|
+
- `write_repo`: in case the repository URL to be used for developing is
|
|
83
|
+
different from the `source`, set this key. It is used by `aliBuild init`,
|
|
84
|
+
which will initialise your local repository with the `upstream` remote
|
|
85
|
+
pointing at this URL instead of the one in `source`.
|
|
86
|
+
- `tag`: git reference in the above mentioned repository which points to the
|
|
87
|
+
software to be built. This can be a tag name, a branch name or a commit
|
|
88
|
+
hash.
|
|
89
|
+
- `env`: dictionary whose key-value pairs are environment variables to be set
|
|
90
|
+
after the recipe is built. The values are interpreted as the contents of a
|
|
91
|
+
double-quoted shell string, so you can reference other environment variables
|
|
92
|
+
as `$VARIABLE`, which will be substituted each time another recipe is built.
|
|
93
|
+
For example:
|
|
94
|
+
|
|
95
|
+
```yaml
|
|
96
|
+
env:
|
|
97
|
+
"$ROOTSYS": $ROOT_ROOT
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
These variables **will not** be available in the recipe itself, as they are
|
|
101
|
+
intended to be used to point to build products of the current recipe. If you
|
|
102
|
+
need to set an environment variable for use in the recipe, use
|
|
103
|
+
`export VARIABLE=value` in the recipe body.
|
|
104
|
+
- `prepend_path`: dictionary whose key-value pairs are an environment variable
|
|
105
|
+
name and a path to be prepended to it, as it happens in `LD_LIBRARY_PATH`.
|
|
106
|
+
This happens only after the package declaring the `prepend_path` in question
|
|
107
|
+
is built, so it is not available in the same recipe (just like variables
|
|
108
|
+
declared using `env`). You can append multiple paths to a single variable
|
|
109
|
+
by specifying a list too, *e.g.*:
|
|
110
|
+
|
|
111
|
+
```yaml
|
|
112
|
+
prepend_path:
|
|
113
|
+
"PATH": "$FOO_ROOT/binexec/foobar"
|
|
114
|
+
"LD_LIBRARY_PATH": [ "$FOO_ROOT/sub/lib", "$FOO_ROOT/sub/lib64" ]
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
will result in prepending `$FOO_ROOT/binexec/foobar` to `$PATH`, and both
|
|
118
|
+
`$FOO_ROOT/sub/lib` and `lib64` to `LD_LIBRARY_PATH`.
|
|
119
|
+
- `append_path`: same as `prepend_path` but paths are appended rather than
|
|
120
|
+
prepended. Like `append_path` and `env`, this **does not** affect the
|
|
121
|
+
environment of the current recipe.
|
|
122
|
+
- `requires`: a list of run-time dependencies for the package, *e.g.*:
|
|
123
|
+
|
|
124
|
+
```yaml
|
|
125
|
+
package: AliRoot
|
|
126
|
+
requires:
|
|
127
|
+
- ROOT
|
|
128
|
+
...
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
The specified dependencies will be built before building the given package.
|
|
132
|
+
You can specify platform-specific dependencies by appending `:<regexp>` to
|
|
133
|
+
the dependency name. Similarly, you can specify build default specific dependencies
|
|
134
|
+
by appending `:defaults=<regex>`.
|
|
135
|
+
|
|
136
|
+
Such a regular expression will be matched against the
|
|
137
|
+
architecture provided via `--architecture`, and if it does not match, the
|
|
138
|
+
requirement will not be included. For instance:
|
|
139
|
+
|
|
140
|
+
```yaml
|
|
141
|
+
package: AliRoot-test
|
|
142
|
+
requires:
|
|
143
|
+
- "igprof:(?!osx).*"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
will make sure that `IgProf` is only built on platforms whose name does not
|
|
147
|
+
begin with `osx`.
|
|
148
|
+
- `build_requires`: a list of build-time dependencies for the package. Like
|
|
149
|
+
`requires`, these packages will be built before the current package is
|
|
150
|
+
built.
|
|
151
|
+
|
|
152
|
+
Packages in this list are marked specially in the dependency graph
|
|
153
|
+
produced by `aliDeps`. Other tools treat these packages differently from
|
|
154
|
+
`requires`: for instance, RPMs produced for a package won't depend on its
|
|
155
|
+
`build_requires`, and `alibuild-generate-module` won't pull in build
|
|
156
|
+
requirements' modulefiles.
|
|
157
|
+
- `force_rebuild`: set it to `true` to force re-running the build recipe every
|
|
158
|
+
time you invoke alibuild on it.
|
|
159
|
+
- `prefer_system_check`: a script which is used to determine whether
|
|
160
|
+
or not the system equivalent of the package can be used. See also
|
|
161
|
+
`prefer_system`. If the `--no-system` option is specified, this key is not
|
|
162
|
+
checked. The shell exit code is used to steer the build: if the check
|
|
163
|
+
returns 0, the system package is used and the recipe is not run. If it
|
|
164
|
+
returns non-zero, our own version of the package is built through the
|
|
165
|
+
recipe.
|
|
166
|
+
- `prefer_system`: a regular expression for architectures which should
|
|
167
|
+
use the `prefer_system_check` by default to determine if the system version
|
|
168
|
+
of the tool can be used. When the rule matches, the result of
|
|
169
|
+
`prefer_system_check` determines whether to build the recipe. When the rule
|
|
170
|
+
does not match, the check is skipped and the recipe is run. Using the switch
|
|
171
|
+
`--always-prefer-system` runs the check always (even when the regular
|
|
172
|
+
expression for the architecture does not match).
|
|
173
|
+
- `relocate_paths`: a list of toplevel paths scanned recursively to perform
|
|
174
|
+
relocation of executables and dynamic libraries **on macOS only**. If not
|
|
175
|
+
specified, defaults to `bin`, `lib` and `lib64`.
|
|
176
|
+
|
|
177
|
+
### The body
|
|
178
|
+
|
|
179
|
+
This is the build script executed to effectively build and install your
|
|
180
|
+
software. Being a shell script you can be as flexible as you want in its
|
|
181
|
+
definition.
|
|
182
|
+
|
|
183
|
+
Some environment variables are made available to the script.
|
|
184
|
+
|
|
185
|
+
- `INSTALLROOT`: the installation prefix. This is commonly passed in the form
|
|
186
|
+
`./configure --prefix=$INSTALLROOT` or
|
|
187
|
+
`cmake -DCMAKE_INSTALL_PREFIX=$INSTALLROOT`. The build tool will create an
|
|
188
|
+
archive based on the sole content of this directory.
|
|
189
|
+
- `PKGNAME`: name of the current package.
|
|
190
|
+
- `PKGVERSION`: package version, as defined in the recipe's `version:` field.
|
|
191
|
+
- `PKGREVISION`: the "build iteration", automatically incremented by the build
|
|
192
|
+
script.
|
|
193
|
+
- `PKGHASH`: SHA1 checksum of the recipe.
|
|
194
|
+
- `ARCHITECTURE`: an arbitrary string summarizing the current build platform.
|
|
195
|
+
This is passed using the `--architecture` (or `-a`) argument to the build
|
|
196
|
+
script.
|
|
197
|
+
- `SOURCE0`: URL of the source code. Note: if `source:` is not provided in the
|
|
198
|
+
recipe, the variable will be empty.
|
|
199
|
+
- `GIT_TAG`: the Git reference to checkout.
|
|
200
|
+
- `JOBS`: number of parallel jobs to use during compilation. This is passed on
|
|
201
|
+
the command line to the build script, and should be used in a context like
|
|
202
|
+
`make -j$JOBS`.
|
|
203
|
+
- `BUILDDIR`: the working directory. This is, *e.g.*, the "build directory"
|
|
204
|
+
for CMake, *i.e.* the directory from where you invoke `cmake`. You should not
|
|
205
|
+
write files outside this directory.
|
|
206
|
+
- `BUILDROOT`: it contains `BUILDDIR` and the log file for the build.
|
|
207
|
+
- `SOURCEDIR`: where the sources are cloned.
|
|
208
|
+
- `REQUIRES`: space-separated list of all dependencies, both runtime and build
|
|
209
|
+
only.
|
|
210
|
+
- `BUILD_REQUIRES`: space-separated list of all build dependencies, not needed
|
|
211
|
+
at runtime.
|
|
212
|
+
- `RUNTIME_REQUIRES`: space-separated list of all runtime dependencies only.
|
|
213
|
+
|
|
214
|
+
For each dependency already built, the corresponding environment file is loaded.
|
|
215
|
+
This will include, apart from custom variables and the usual `PATH` and library
|
|
216
|
+
paths, the following specific variables (`<PACKAGE>` is the package name,
|
|
217
|
+
uppercased):
|
|
218
|
+
|
|
219
|
+
- `<PACKAGE>_ROOT`: package installation directory.
|
|
220
|
+
- `<PACKAGE>_VERSION`: package version.
|
|
221
|
+
- `<PACKAGE>_REVISION`: package build number.
|
|
222
|
+
- `<PACKAGE>_HASH`: hash of the recipe used to build the package.
|
|
223
|
+
|
|
224
|
+
### Defaults
|
|
225
|
+
|
|
226
|
+
aliBuild uses a special file, called `defaults-release.sh` which will be
|
|
227
|
+
included as a build requires of any recipe. This is in general handy to
|
|
228
|
+
specify common options like `CXXFLAGS` or dependencies. It's up to the
|
|
229
|
+
recipe handle correctly the presence of these options.
|
|
230
|
+
|
|
231
|
+
It is also possible to specify on the command line a different set of
|
|
232
|
+
defaults, for example if you want to include code coverage. This is
|
|
233
|
+
done via the `--defaults <default-name>` option which will change the
|
|
234
|
+
defaults included to be `defaults-<default-name>.sh`.
|
|
235
|
+
|
|
236
|
+
An extra variable `%(defaults_upper)s` can be used to form the version
|
|
237
|
+
string accordingly. For example you could trigger a debug build by
|
|
238
|
+
adding `--defaults debug`, which will pick up `defaults-debug.sh`, and
|
|
239
|
+
then have:
|
|
240
|
+
|
|
241
|
+
```yaml
|
|
242
|
+
version: %(tag)s%(defaults_upper)s
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
in one of your recipes, which will expand to:
|
|
246
|
+
|
|
247
|
+
```yaml
|
|
248
|
+
version: SOME_TAG_DEBUG
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
If you want to add your own default, you should at least provide:
|
|
252
|
+
|
|
253
|
+
- `CXXFLAGS`: the `CXXFLAGS` to use
|
|
254
|
+
- `CFLAGS`: the `CFLAGS` to use
|
|
255
|
+
- `LDFLAGS`: the `LDFLAGS` to use
|
|
256
|
+
- `CMAKE_BUILD_TYPE`: the build type which needs to be used by cmake projects
|
|
257
|
+
|
|
258
|
+
Besides specifying extra global variables, starting from aliBuild
|
|
259
|
+
1.4.0, it's also possible to use defaults to override metadata of other
|
|
260
|
+
packages . This is done by specifying the `overrides` dictionary in the
|
|
261
|
+
metadata of your defaults file. For example to switch between ROOT6 and
|
|
262
|
+
ROOT5 you should do something like:
|
|
263
|
+
|
|
264
|
+
```yaml
|
|
265
|
+
...
|
|
266
|
+
overrides:
|
|
267
|
+
ROOT:
|
|
268
|
+
version: "v6-06-04"
|
|
269
|
+
tag: "v6-06-04"
|
|
270
|
+
...
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
this will replace the `version` and `tag` metadata of `root.sh` with the
|
|
274
|
+
one specified in the override. Notice that is also possible to override
|
|
275
|
+
completely a recipe, picking it up from a given commit hash, branch or
|
|
276
|
+
tag in alidist. You can do so by adding such git reference after the name
|
|
277
|
+
of the external to override. For example:
|
|
278
|
+
|
|
279
|
+
```yaml
|
|
280
|
+
overrides:
|
|
281
|
+
ROOT@abcedf123456:
|
|
282
|
+
...
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
will pick `root.sh` as found in the commit `abcedf123456`.
|
|
286
|
+
|
|
287
|
+
For a more complete example see
|
|
288
|
+
[defaults-o2.sh](https://github.com/alisw/alidist/blob/master/defaults-o2.sh).
|
|
289
|
+
|
|
290
|
+
You can limit which defaults can be applied to a given package by using the
|
|
291
|
+
`valid_defaults` key.
|
|
292
|
+
|
|
293
|
+
### Architecture defaults
|
|
294
|
+
|
|
295
|
+
Architecture defaults are similar to normal defaults but they are
|
|
296
|
+
always sourced, if available in alidist, and should never be provided on the
|
|
297
|
+
command line.
|
|
298
|
+
|
|
299
|
+
Their filename is always:
|
|
300
|
+
|
|
301
|
+
defaults-<arch>.sh
|
|
302
|
+
|
|
303
|
+
where `<arch>` is the current architecture. They have precedence over normal
|
|
304
|
+
defaults.
|
|
305
|
+
|
|
306
|
+
## Relocation
|
|
307
|
+
|
|
308
|
+
aliBuild supports relocating binary packages so that the scratch space used for
|
|
309
|
+
builds (*e.g.* `/build`) and the actual installation folder (*i.e.*
|
|
310
|
+
`/cvmfs/alice.cern.ch`) do not need to be the same. By design this is done
|
|
311
|
+
automatically, and the user should not have to care about it. The procedure
|
|
312
|
+
takes care of relocating scripts and, on macOS, to embed the correct paths for
|
|
313
|
+
the dynamic libraries dependencies, so that SIP does not need to be disabled.
|
|
314
|
+
The internal procedure is roughly as follows:
|
|
315
|
+
|
|
316
|
+
* The build happens in `BUILD/<package>-latest/<package>` and installs
|
|
317
|
+
byproducts in
|
|
318
|
+
`INSTALLROOT=<work-dir>/INSTALLROOT/<package-hash>/<architecture>/<package>/<version>-<revisions>`.
|
|
319
|
+
This way we know that every file which contains `<package-hash>` needs to be
|
|
320
|
+
relocated.
|
|
321
|
+
* Once the build is completed, aliBuild looks for the above mentioned
|
|
322
|
+
`<package-hash>` and generates a script in the `$INSTALLROOT/relocate-me.sh`
|
|
323
|
+
which can be used to relocate the binary installation, once it has been
|
|
324
|
+
unpacked.
|
|
325
|
+
* The path under `<work-dir>/INSTALLROOT/<package-hash>` is tarred up in a
|
|
326
|
+
binary tarball.
|
|
327
|
+
|
|
328
|
+
When a tarball is installed, either because it was downloaded by aliBuild or by
|
|
329
|
+
some other script (*e.g.* the CVMFS publisher, the following happens:
|
|
330
|
+
|
|
331
|
+
* The tarball is expanded.
|
|
332
|
+
* The relocation script `relocate-me.sh` is executed with something similar to:
|
|
333
|
+
|
|
334
|
+
```bash
|
|
335
|
+
WORK_DIR=<new-installation-workdir> relocate-me.sh
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
which will take the path up to the `<package-hash>` and re-map it to the newly
|
|
339
|
+
specified `WORK_DIR`.
|
|
340
|
+
|
|
341
|
+
Notice that the special variable `@@PKGREVISION@$PKGHASH@@` can be used to have
|
|
342
|
+
the actual revision of the package in the relocated file.
|
|
343
|
+
|
|
344
|
+
## Build environment
|
|
345
|
+
|
|
346
|
+
Before each package is built, aliBuild will populate the environment with build
|
|
347
|
+
related information. For a complete list of those see
|
|
348
|
+
[the body section](#the-body). After the build is done the user has access to
|
|
349
|
+
the environment of the build by sourcing the
|
|
350
|
+
`<work-dir>/<architecture>/<package>/<version>/etc/profile.d/init.sh` file.
|
|
351
|
+
For example:
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
WORK_DIR=<work-dir> source <work-dir>/<architecture>/<package>/<version>/etc/profile.d/init.sh
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
Notice that for development packages, we also generate a `.envrc` file in
|
|
358
|
+
`<work-dir>/BUILD/<package>-<version>/<package>/.envrc` which can be used to
|
|
359
|
+
load the build environment via [direnv](https://direnv.net), *e.g.* for easy
|
|
360
|
+
[IDE integration](https://aliceo2group.github.io/advanced/ides.html).
|
|
361
|
+
|
|
362
|
+
## Runtime environment
|
|
363
|
+
|
|
364
|
+
Runtime environment is usually provided via
|
|
365
|
+
[environment modules](https://modules.readthedocs.io/en/latest/).
|
|
366
|
+
|
|
367
|
+
While the build environment is automatically generated, it is responsibility of
|
|
368
|
+
the recipe to create a module file in `$INSTALLROOT/etc/modulefiles/$PKGNAME`.
|
|
369
|
+
For example:
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
# ModuleFile
|
|
373
|
+
mkdir -p etc/modulefiles
|
|
374
|
+
cat > etc/modulefiles/$PKGNAME <<EoF
|
|
375
|
+
#%Module1.0
|
|
376
|
+
proc ModulesHelp { } {
|
|
377
|
+
global version
|
|
378
|
+
puts stderr "ALICE Modulefile for $PKGNAME $PKGVERSION-@@PKGREVISION@$PKGHASH@@"
|
|
379
|
+
}
|
|
380
|
+
set version $PKGVERSION-@@PKGREVISION@$PKGHASH@@
|
|
381
|
+
module-whatis "ALICE Modulefile for $PKGNAME $PKGVERSION-@@PKGREVISION@$PKGHASH@@"
|
|
382
|
+
# Dependencies
|
|
383
|
+
module load BASE/1.0 \\
|
|
384
|
+
${BOOST_REVISION:+boost/$BOOST_VERSION-$BOOST_REVISION} \\
|
|
385
|
+
${FAIRLOGGER_REVISION:+FairLogger/$FAIRLOGGER_VERSION-$FAIRLOGGER_REVISION} \\
|
|
386
|
+
${ZEROMQ_REVISION:+ZeroMQ/$ZEROMQ_VERSION-$ZEROMQ_REVISION} \\
|
|
387
|
+
${ASIOFI_REVISION:+asiofi/$ASIOFI_VERSION-$ASIOFI_REVISION} \\
|
|
388
|
+
${DDS_REVISION:+DDS/$DDS_VERSION-$DDS_REVISION}
|
|
389
|
+
# Our environment
|
|
390
|
+
set FAIRMQ_ROOT \$::env(BASEDIR)/$PKGNAME/\$version
|
|
391
|
+
prepend-path PATH \$FAIRMQ_ROOT/bin
|
|
392
|
+
prepend-path LD_LIBRARY_PATH \$FAIRMQ_ROOT/lib
|
|
393
|
+
EoF
|
|
394
|
+
MODULEDIR="$INSTALLROOT/etc/modulefiles"
|
|
395
|
+
mkdir -p $MODULEDIR && rsync -a --delete etc/modulefiles/ $MODULEDIR
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
Please keep in mind the following recommendation when writing the modulefile:
|
|
399
|
+
|
|
400
|
+
* Do not use runtime environment variables which are usually not set by a given
|
|
401
|
+
tool. For example avoid exposing `<package>_ROOT`. This is because if we build
|
|
402
|
+
in a mode where system dependencies are used, we cannot rely on their
|
|
403
|
+
presence.
|
|
404
|
+
* Use `<package>_REVISION` to guard inclusion of extra dependencies. This will
|
|
405
|
+
make sure that only dependencies which were actually built via `aliBuild` will
|
|
406
|
+
be included in the modulefile.
|
|
407
|
+
|
|
408
|
+
It's also now possible to generate automatically the initial part of the
|
|
409
|
+
modulefile, up to the `# Our environment` line, by using the
|
|
410
|
+
`alibuild-recipe-tools` helper scripts. In order to do this you need to add
|
|
411
|
+
`alibuild-recipe-tools` as a `build_requires` of your package and substitute the
|
|
412
|
+
module creation with:
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
#ModuleFile
|
|
416
|
+
mkdir -p etc/modulefiles
|
|
417
|
+
alibuild-generate-module > etc/modulefiles/$PKGNAME
|
|
418
|
+
mkdir -p $INSTALLROOT/etc/modulefiles && rsync -a --delete etc/modulefiles/ $INSTALLROOT/etc/modulefiles
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
One can also make sure that `PATH` and `LD_LIBRARY_PATH` are properly amended by
|
|
422
|
+
passing the option `--bin` and `--lib` (respectively). Or you can simply append
|
|
423
|
+
extra information via:
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
alibuild-generate-module > etc/modulefiles/$PKGNAME
|
|
427
|
+
cat >> etc/modulefiles/$PKGNAME <<EoF
|
|
428
|
+
prepend-path ROOT_INCLUDE_PATH \$PKG_ROOT/include
|
|
429
|
+
EoF
|
|
430
|
+
```
|