-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbootstrap-mingw.bash
executable file
·55 lines (47 loc) · 2.18 KB
/
bootstrap-mingw.bash
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
SRC=$(pwd)/src
LIB=$(pwd)/bootstrap/lib
BIN=$(pwd)/bootstrap/bin
AR=${AR:-ar}
CC=${CC:-gcc}
CXX=${CXX:-g++}
cc() {
for file in $1; do
echo $file...
local DEFINES="-DBUILD_VARIANT_DEBUG -DBUILD_VERSION=\"bootstrap\" -DBOOST_ALL_NO_LIB -D_WIN32_WINNT=0x0a00"
local INCLUDE_DIRS="-I $SRC -I $SRC/lua/src -I $SRC/boost"
local FLAGS="-x c -g"
$CC $DEFINES $INCLUDE_DIRS $FLAGS -o $file.o -c $file
done
}
cxx() {
for file in $1; do
echo $file...
local DEFINES="-DBUILD_VARIANT_DEBUG -DBUILD_VERSION=\"bootstrap\" -DBOOST_ALL_NO_LIB -D_WIN32_WINNT=0x0a00"
local INCLUDE_DIRS="-I $SRC -I $SRC/lua/src -I $SRC/boost"
local FLAGS="-x c++ -std=c++11 -fexceptions -frtti -fPIC -march=native -g -Wno-deprecated-declarations"
$CXX $DEFINES $INCLUDE_DIRS $FLAGS -o $file.o -c $file
done
}
archive() {
$AR -rcs $1 *.o
}
link_forge() {
$CXX *.o -g -L $LIB -lforge -lforge_lua -lprocess -lcmdline -lluaxx -lerror -llua -lassert -lboost_filesystem -lboost_system -o $BIN/forge
}
link_forge_hooks() {
$CXX *.o -shared -g -L $LIB -lassert -o $BIN/libforge_hooks.dll
}
mkdir -p $LIB
echo boost_system; pushd $SRC/boost/libs/system/src; cxx "*.cpp"; archive $LIB/libboost_system.a; popd
echo boost_filesystem; pushd $SRC/boost/libs/filesystem/src; cxx "*.cpp"; archive $LIB/libboost_filesystem.a; popd
echo lua; pushd $SRC/lua/src; cc '*.c'; archive $LIB/liblua.a; popd
echo assert; pushd $SRC/assert; cxx '*.cpp'; archive $LIB/libassert.a; popd
echo forge; pushd $SRC/forge; cxx '*.cpp'; archive $LIB/libforge.a; popd
echo forge/forge_lua; pushd $SRC/forge/forge_lua; cxx '*.cpp'; archive $LIB/libforge_lua.a; popd
echo cmdline; pushd $SRC/cmdline; cxx '*.cpp'; archive $LIB/libcmdline.a; popd
echo error; pushd $SRC/error; cxx '*.cpp'; archive $LIB/liberror.a; popd
echo luaxx; pushd $SRC/luaxx; cxx '*.cpp'; archive $LIB/libluaxx.a; popd
echo process; pushd $SRC/process; cxx '*.cpp'; archive $LIB/libprocess.a; popd
mkdir -p $BIN
echo forge/forge; pushd $SRC/forge/forge; cxx '*.cpp'; link_forge; popd
echo forge/forge_hooks; pushd $SRC/forge/forge_hooks; cxx 'forge_hooks_windows.cpp ImportDescriptor.cpp'; link_forge_hooks; popd