Skip to content

Commit 795fa35

Browse files
committed
hell, world! tutorial added
1 parent b156a64 commit 795fa35

1 file changed

Lines changed: 71 additions & 0 deletions

File tree

src/Tutorials.adoc

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,74 @@
11
= *TUTORIALS*
22

3+
== Step-by-step guide to build a 'Hello, world!' module
4+
5+
1. Download a stub for a new build-block
6+
+
7+
[source,shell]
8+
----
9+
wget --output-document=stub.tgz https://github.com/Pmodules/buildblock_stub/archive/refs/tags/1.0.0.tar.gz
10+
----
11+
1. Unpack the stub into the directory `hello_world`
12+
+
13+
[source,shell]
14+
----
15+
mkdir hello_world
16+
tar --strip-components 1 -xvf ../stub.tgz
17+
chmod 0755 build
18+
----
19+
1. Edit `files/config.yaml`
20+
+
21+
[source,yaml]
22+
----
23+
format: 1
24+
hello_world: # <1>
25+
defaults: # <2>
26+
group: Tools # <3>
27+
relstage: stable # <4>
28+
systems: [.*] # <5>
29+
docfiles: [LICENSE]
30+
compile_in_sourcetree: true # <6>
31+
urls: # <7>
32+
- url: https://github.com/Pmodules/$P/archive/refs/tags/$V.tar.gz
33+
name: $P-$V.tar.gz
34+
35+
shasums: # <8>
36+
hello_world-1.0.0.tar.gz: bc1cfd90ac55e9f3babab0a426ed4b3c7edf15266363ab1b595d234797fbce7b
37+
38+
versions:
39+
1.0.0:
40+
config: # <9>
41+
relstage: unstable # <10>
42+
----
43+
+
44+
<1> The name of the module.
45+
<2> Default configuration for all version. This can be overwritten in the 'versions' section.
46+
<3> The group the module will be installed in.
47+
<4> If not otherwise specified in the version specific configuration, the release stage is set to `stable`.
48+
<5> The module is available on all systems. Availability can be restricted to hostname patterns and/or OS/Linux distribution (like rhel8, sles15)
49+
<6> Usually the software is compiled in a dedicated build directory. Here we have to compile in the source tree.
50+
<7> Download URL and filename. `$P` will be substituted by the module name and `$V` by the version.
51+
<8> SHA256 hash sums for each source file.
52+
<9> Configuration for version 1.0.0.
53+
<10> Overwrite the default release stage.
54+
55+
1. Edit the build script
56+
+
57+
[source,shell]
58+
----
59+
#!/usr/bin/env modbuild
60+
61+
pbuild::configure() { # <1>
62+
:
63+
}
64+
65+
pbuild::install() { # <2>
66+
mkdir -p "${PREFIX}/bin"
67+
install --mode=0755 "${SRC_DIR}/hello_world" "${PREFIX}/bin"
68+
}
69+
----
70+
<1> Don't use the default `pbuild::configure()`` function!
71+
There is nothing to configure. :)
72+
<2> The Makefile doesn't have an 'install' target. Therefore we have to code it ourself.
73+
374

0 commit comments

Comments
 (0)