home · contact · privacy
Server: Remove log_help(), this should be serverd by the client.
[plomrogue] / build / redo_scripts / redo
1 #!/bin/sh
2 # redo – bourne shell implementation of DJB redo
3 # Copyright © 2014  Nils Dagsson Moskopp (erlehmann)
4
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License as
7 # published by the Free Software Foundation, either version 3 of the
8 # License, or (at your option) any later version.
9
10 # Dieses Programm hat das Ziel, die Medienkompetenz der Leser zu
11 # steigern. Gelegentlich packe ich sogar einen handfesten Buffer
12 # Overflow oder eine Format String Vulnerability zwischen die anderen
13 # Codezeilen und schreibe das auch nicht dran.
14
15 set +e
16
17 bold=""
18 green=""
19 plain=""
20 red=""
21 if [ -n "$TERM" -a "$TERM" != "dumb" ] && tty <&2 >/dev/null 2>&1; then
22   bold="$(printf '\033[1m')"
23   green="$(printf '\033[32m')"
24   plain="$(printf '\033[m')"
25   red="$(printf '\033[31m')"
26 fi
27 export bold green plain red
28
29 for argument; do
30   if [ "$argument" = "-d" ] || [ "$argument" = "--debug" ]; then
31     export REDO_DEBUG='1'
32   elif [ "$argument" = "-h" ] || [ "$argument" = "--help" ]; then
33     cat <<EOF >&2
34 Usage: redo [OPTIONS] [TARGETS...]
35
36   -d, --debug          print dependency checks as they happen
37   -h, --help           print usage instructions and exit
38   -s, --shuffle        randomize build order to find dependency bugs
39   -x, --xtrace         print commands as they are executed (variables expanded)
40
41 Report bugs to <nils+redo@dieweltistgarnichtso.net>.
42 EOF
43     exit 0
44   elif [ "$argument" = "-s" ] || [ "$argument" = "--shuffle" ]; then
45     export REDO_SHUFFLE='1'
46   elif [ "$argument" = "-x" ] || [ "$argument" = "--xtrace" ]; then
47     export REDO_XTRACE='1'
48   else
49     REDO_HAS_TARGETS='1'
50     export REDO_TARGET=''
51     # If this is build directory, create .redo database directory.
52     if [ -z "$REDO_BASE" ]; then
53       export REDO_BASE="$(pwd)"
54       export REDO_DIR="$REDO_BASE/.redo"
55       LANG=C mkdir -p $REDO_DIR
56     fi
57     redo-ifchange "$argument"
58     [ "$?" = 0 ] || exit 1
59   fi
60 done
61
62 [ "$REDO_HAS_TARGETS" = "1" ] || exec redo all