-
Notifications
You must be signed in to change notification settings - Fork 4
/
configure
executable file
·179 lines (156 loc) · 4.45 KB
/
configure
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#!/bin/bash
. ./BUILDDEFS
shopt -s extglob
shopt -s nullglob
if [ $# -eq 0 ]; then
FILTER=@(release)
elif [ "$1" == all ]; then
FILTER="*"
else
FILTER="$1"
fi
if [ ! -e $BUILDDIR ]; then
mkdir $BUILDDIR
fi
create_build_dir() {
local dname=$1
local btype=$2
local desc=$3
echo
echo "=== build/$dname ($btype, $desc) ==="
if [ ! -e $BUILDDIR/$dname ]; then
mkdir $BUILDDIR/$dname
fi
if [ ! -e $BUILDDIR/$dname/test ]; then
mkdir $BUILDDIR/$dname/test
fi
cp $SOURCEDIR/test/*.eel $BUILDDIR/$dname/test
cp $SOURCEDIR/test/wc-input.txt $BUILDDIR/$dname/test
cp $SOURCEDIR/test/*.json $BUILDDIR/$dname/test
cp -r $SOURCEDIR/test/eelium $BUILDDIR/$dname/test/eelium
}
setup_header() {
local dname=$1
local desc=$2
echo
echo "=========================================================="
echo "Setting up build dirs for ${dname} ($desc)"
echo "=========================================================="
}
setup_footer() {
echo
echo "=========================================================="
echo "Done!"
echo "=========================================================="
echo
}
setup_native() {
local dname=$1
local btype=$2
local desc=$3
local prefix=$4
local opts="$5"
setup_header $dname "$desc"
create_build_dir $dname $btype "$desc"
cd $BUILDDIR/$dname
cmake $opts $SOURCEDIR -DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_BUILD_TYPE="$btype"
cd $SOURCEDIR
setup_footer
}
setup_cross() {
local dname=$1
local btype=$2
local desc=$3
local target=$4
local opts="$5"
setup_header $dname "$desc"
if [ -e $MXEPATH ]; then
if [ ! -e "$MXEPATH/usr/$target" ]; then
echo "MXE target $target not available!"
echo "Skipping target ${dname} ($desc)."
echo
return
fi
local cmk="$MXEPATH/usr/bin/$target-cmake"
if [ ! -e "$cmk" ]; then
echo "Could not find CMake for MXE target $target!"
echo "Skipping target ${dname} ($desc)."
echo
return
fi
create_build_dir $dname $btype "$desc"
cd $BUILDDIR/$dname
"$cmk" $opts $SOURCEDIR -DCMAKE_BUILD_TYPE="$btype"
cd $SOURCEDIR
setup_footer
else
echo "MXE not found!"
echo "Skipping target ${dname} ($desc)."
echo
fi
}
update_builtin_c() {
# FIXME: This should probably be handled by CMake instead.
echo
cd $SOURCEDIR/src/core
if [ -e builtin.c ]; then
if [ builtin.c -nt builtin.eel ] ; then
echo "(builtin.c already up to date.)"
return
fi
rm builtin.c
fi
echo "=== Generating builtin.c from builtin.eel ==="
eel strip builtin.eel -q
if [ ! -e builtin.c ]; then
echo "No EEL or strip tool? Trying sed..."
sed -f text2c.sed builtin.eel > builtin.c
fi
if [ ! -e builtin.c ]; then
echo "ERROR: Could not generate builtin.c!"
cd $SOURCEDIR
exit 1
fi
cd $SOURCEDIR
echo "-- Done!"
}
update_builtin_c
if [[ "release" = ${FILTER} ]] ; then
setup_native release Release "host native" /usr
fi
if [[ "static" = ${FILTER} ]] ; then
setup_native static Release "host native static" /usr "-DBUILD_SHARED_LIBS=OFF"
fi
if [[ "static-noalsa" = ${FILTER} ]] ; then
setup_native static-noalsa Release "host native static" /usr "-DBUILD_SHARED_LIBS=OFF -DUSE_ALSA=OFF"
fi
if [[ "maintainer" = ${FILTER} ]] ; then
setup_native maintainer Maintainer "host native maintainer" /usr
fi
if [[ "debug" = ${FILTER} ]] ; then
setup_native debug Debug "host native debug" /usr
fi
if [[ "mingw-release" = ${FILTER} ]] ; then
setup_cross mingw-release Release "MXE cross 32 bit" i686-w64-mingw32.shared
fi
if [[ "mingw-debug" = ${FILTER} ]] ; then
setup_cross mingw-debug Debug "MXE cross 32 bit debug" i686-w64-mingw32.shared
fi
if [[ "mingw-64-release" = ${FILTER} ]] ; then
setup_cross mingw-64-release Release "MXE cross 64 bit" x86_64-w64-mingw32.shared
fi
if [[ "mingw-64-debug" = ${FILTER} ]] ; then
setup_cross mingw-64-debug Debug "MXE cross 64 bit debug" x86_64-w64-mingw32.shared
fi
if [[ "mingw-release-static" = ${FILTER} ]] ; then
setup_cross mingw-release-static Release "MXE cross 32 bit static" i686-w64-mingw32.static "-DBUILD_SHARED_LIBS=OFF"
fi
if [[ "mingw-debug-static" = ${FILTER} ]] ; then
setup_cross mingw-debug-static Debug "MXE cross 32 bit debug static" i686-w64-mingw32.static "-DBUILD_SHARED_LIBS=OFF"
fi
if [[ "mingw-64-release-static" = ${FILTER} ]] ; then
setup_cross mingw-64-release-static Release "MXE cross 64 bit static" x86_64-w64-mingw32.static "-DBUILD_SHARED_LIBS=OFF"
fi
if [[ "mingw-64-debug-static" = ${FILTER} ]] ; then
setup_cross mingw-64-debug-static Debug "MXE cross 64 bit debug static" x86_64-w64-mingw32.static "-DBUILD_SHARED_LIBS=OFF"
fi