This repository has been archived by the owner on Sep 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.sh
executable file
·86 lines (71 loc) · 1.66 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
#
# Copyright: 2017-2019 sel-project
# License: MIT
#
COMPILER=
BUILD=debug
ARCH=
CONFIG=default
PLUGINS=
PORTABLE=
while [[ $# -gt 0 ]]; do
case "$1" in
-h | --help)
echo "Usage: ./build.sh [-h] [--dmd|--ldc|-c COMPILER] [debug|release] [-a ARCH] [default|hub|node] [-np] [--clean]"
echo ""
echo "Optional aguments:"
echo " -h, --help Show this message and exit"
echo " --dmd, --ldc Compile using the DMD or LDC compiler"
echo " -c COMPILER Compile using the spcified compiler"
echo " debug, release Compile using DUB's debug or release mode"
echo " -a ARCH Specify the architecture to build for"
echo " default, hub, node Compile the specified configuration for Selery"
echo " -np, --no-plugins Compile without plugins"
echo " --clean Remove dub.selections.json files"
exit 0
;;
--dmd)
COMPILER=dmd
;;
--ldc | --ldc2)
COMPILER=ldc2
;;
-c)
COMPILER=$2
shift
;;
debug | release)
BUILD=$1
;;
default | classic | hub | node)
CONFIG=$1
;;
-a)
ARCH="--arch=$2"
shift
;;
-np | --no-plugins)
PLUGINS=--no-plugins
;;
--portable)
PORTABLE=--portable
;;
--clean)
rm -f dub.selections.json
rm -f builder/dub.selections.json
rm -f builder/init/dub.selections.json
;;
esac
shift
done
if [ "$COMPILER" = "" ] ; then
case $(uname -m) in
arm*) COMPILER=ldc2;;
*) COMPILER=dmd;;
esac
fi
cd builder/init
dub run --compiler=$COMPILER --build=$BUILD $ARCH -- $CONFIG $PLUGINS $PORTABLE || exit 1
cd ..
dub build --compiler=$COMPILER --build=$BUILD $ARCH