simplify node-exporter
[buildscripts] / mu4e
1 #!/bin/bash
2
3 if [[ -s ~/.bashrc ]];then . ~/.bashrc;fi
4
5
6 cd /a/opt/mu
7
8 recompile=false
9 dryrun=false
10
11 while [[ $1 == -* ]]; do
12 case $1 in
13 -n) dryrun=true ;;
14 -r) recompile=true ;;
15 --no-r) recompile=false ;;
16 --) break ;;
17 *) echo "$0: error: bad arg: $1" >&2; exit 1 ;;
18 esac
19 shift
20 done
21
22 bootstrap=false
23
24 #git repo
25 dir=/a/opt/mu-$(distro-name)$(distro-num)
26 last_build=$dir/iank-mu-build
27
28 if [[ -e $dir ]]; then
29 m cd $dir
30 rev=$(cat $last_build 2>/dev/null) ||:
31 head=$(git rev-parse HEAD)
32 if ! $recompile && ! $bootstrap && [[ $rev == "$head" ]]; then
33 echo "already compiled, exiting"
34 exit 0
35 fi
36 echo rev=$rev head=$head
37 if [[ $rev != "$head" ]]; then
38 bootstrap=true
39 fi
40 else
41 head=$(git rev-parse HEAD)
42 bootstrap=true
43 fi
44
45 if $dryrun; then
46 e recompile=$recompile bootstrap=$bootstrap
47 exit 0
48 fi
49
50 if $bootstrap; then
51 m rsync --delete -ra /a/opt/mu/ $dir
52 recompile=true
53 cd $dir
54 fi
55
56
57 if [[ $(debian-codename) == flidas ]]; then
58 # use the flidas branch, stuck behind because
59 # needs newer crypt libraries that are too troublesome.
60 cd /a/opt/muflidas
61 else
62 # libgmime-3.0-dev is a newer version than build-dep installs for buster
63 # note, currently, need newer meson than t10
64 m pi libgmime-3.0-dev meson
65 fi
66 if $recompile; then
67 m git clean -xfffd
68 m ./autogen.sh && make -j`nproc`
69 # note uninstall is implemented
70 m sudo make install
71 else
72 # Workaround for some indecipherable build error
73 # that only happens after syncing the mu dir and not building from
74 # scratch. It seems there is some state somewhere, like ~/.local
75 # that doesn't get copied. Found the workaround by reading the Makefile,
76 # then doing a more verbose build with:
77 # ninja -C $PWD/build -v -d explain
78 sudo touch -d @$(($(stat -c%Y build/build.ninja) - 100)) /usr/local/bin/emacs
79 m sudo make install
80 fi
81 echo $head >$last_build