forked from olofson/eel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cfg-all
executable file
·133 lines (116 loc) · 3.48 KB
/
cfg-all
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
#!/bin/sh
SOURCEDIR=$(pwd)
BUILDDIR=$SOURCEDIR/build
if [ ! -e $BUILDDIR ]; then
mkdir $BUILDDIR
fi
# MinGW32 cross build using MXE (http://mxe.cc/)
if [ -z $MXEPATH ]; then
# This is where Dave keeps his MXE.
MXEPATH=~/src/mxe
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_native() {
local dname=$1
local btype=$2
local desc=$3
local prefix=$4
local opts=$5
create_build_dir $dname $btype $desc
cd $BUILDDIR/$dname
cmake "$opts" $SOURCEDIR -DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_BUILD_TYPE="$btype"
cd $SOURCEDIR
}
setup_cross() {
local dname=$1
local btype=$2
local desc=$3
local target=$4
local opts=$5
create_build_dir $dname $btype $desc
cd $BUILDDIR/$dname
cmake "$opts" -DCMAKE_TOOLCHAIN_FILE=$SOURCEDIR/mingw32-cross.cmake $SOURCEDIR -DCMAKE_BUILD_TYPE="$btype" -DCMAKE_TOOLCHAIN_FILE=$MXEPATH/usr/$target/share/cmake/mxe-conf.cmake -DBUILD_SHARED_LIBS=OFF
cd $SOURCEDIR
}
# FIXME: This doesn't belong here...
echo
echo "=== Generating builtin.c from builtin.eel ==="
cd $SOURCEDIR/src/core
if [ -e builtin.c ]; then
rm builtin.c
fi
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 "No sed either!? Hoping builtin-bootstrap.c is up to date..."
cp builtin-bootstrap.c builtin.c
fi
cd $SOURCEDIR
echo "-- Done!"
# FIXME: This doesn't belong here...
echo
echo "=== Generating builtin-loader.c from builtin-loader.eel ==="
cd $SOURCEDIR/src/modules/loader
if [ -e builtin-loader.c ]; then
rm builtin-loader.c
fi
eel strip builtin-loader.eel -q
if [ ! -e builtin-loader.c ]; then
echo "No EEL or strip tool? Trying sed..."
sed -f ../../core/text2c.sed builtin-loader.eel > builtin-loader.c
fi
if [ ! -e builtin-loader.c ]; then
echo "No sed either!? Hoping builtin-loader-bootstrap.c is up to date..."
cp builtin-loader-bootstrap.c builtin-loader.c
fi
cd $SOURCEDIR
echo "-- Done!"
echo
echo "=========================================================="
echo "Setting up build directories for native targets..."
echo "=========================================================="
setup_native release Release "host native" /usr
setup_native maintainer Maintainer "host native" /usr
setup_native debug Debug "host native" /usr
echo
echo "=========================================================="
echo "Done!"
echo "=========================================================="
echo
echo -n "Looking for MXE in '$MXEPATH'... "
if [ -e $MXEPATH ]; then
echo "Found!"
echo
echo "=========================================================="
echo "Setting up build directories for MXE cross-compiling..."
echo "=========================================================="
setup_cross mingw-release Release "MXE cross" i686-w64-mingw32.shared
setup_cross mingw-debug Debug "MXE cross" i686-w64-mingw32.shared
echo
echo "=========================================================="
echo "Done!"
echo "=========================================================="
else
echo "Not found!"
echo "(Please install MXE and set MXEPATH to cross-compile!)"
fi
echo