bba42cf746a77de2d73f71ab404873b5e177daa8
[tinc] / .ci / muon / run.sh
1 #!/bin/bash
2
3 # Fetch and build
4 #   muon (a C reimplementation of the meson build system),
5 #   samurai (a C reimplementation of the ninja build tool),
6 # and then use both to build tinc.
7
8 set -euo pipefail
9
10 git_samurai=https://github.com/michaelforney/samurai
11 git_muon=https://git.sr.ht/~lattis/muon
12 prefix=/opt/tinc_muon
13
14 header() {
15   echo >&2 '################################################################################'
16   echo >&2 "# $*"
17   echo >&2 '################################################################################'
18 }
19
20 header 'Try to make sure Python is missing'
21 python --version && exit 1
22 python3 --version && exit 1
23
24 header 'Fetch and build samurai'
25
26 git clone --depth=1 $git_samurai ~/samurai
27 pushd ~/samurai
28 make -j"$(nproc)"
29 make install
30 popd
31
32 header 'Fetch and build muon'
33
34 git clone --depth=1 $git_muon ~/muon
35 pushd ~/muon
36 ./bootstrap.sh build
37 ./build/muon setup build
38 samu -C build
39 ./build/muon -C build install
40 popd
41
42 header 'Setup build directory'
43 muon setup -D prefix=$prefix -D systemd=disabled build_muon
44 samu -C build_muon
45
46 header 'Install tinc'
47 muon -C build_muon install
48
49 header 'Run smoke tests'
50 $prefix/sbin/tinc --version
51 $prefix/sbin/tincd --version
52 $prefix/sbin/tinc -c /tmp/muon_node <<EOF
53 init muon
54 set DeviceType dummy
55 set Address localhost
56 set Port 0
57 start
58 EOF