forked from mangosR2/mangos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
project_utils_cross-complile.sh
executable file
·157 lines (146 loc) · 4.59 KB
/
project_utils_cross-complile.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
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
#!/bin/bash
################################################################################################
# bash script for compilation mangosR2 utility in MINGW32/MINGW64 environment. by /dev/rsa
################################################################################################
#check path of running
if [ ! -d ./.git ]; then
echo $"Please, run this script in mangos root folder!"
exit 2
fi;
case "$1" in
win32|32)
PLATFORM=i686
;;
win64|64)
PLATFORM=x86_64
;;
plain|none)
PLATFORM=build
;;
*)
echo $"Usage: $0 {win32|win64|plain}"
exit 2
esac
################################################################################################
#make binary storage
BINARY_PATH=bin
if [ ! -d ./$BINARY_PATH ]; then
mkdir $BINARY_PATH
fi;
if [ ! -d ./$BINARY_PATH/$PLATFORM ]; then
mkdir $BINARY_PATH/$PLATFORM
fi;
################################################################################################
# Make extractor
cd contrib/extractor
make clean
if [ ! -d ./$PLATFORM ]; then
mkdir $PLATFORM
fi;
cd $PLATFORM
if [ "$PLATFORM" != "build" ]; then
cmake -DCMAKE_TOOLCHAIN_FILE=../../../cmake/mingw32-$PLATFORM.cmake ..
else
cmake ..
fi
make
if [ "$PLATFORM" != "build" ]; then
cp ./ad.exe ../../../$BINARY_PATH/$PLATFORM/
cp /usr/$PLATFORM-w64-mingw32/sys-root/mingw/bin/zlib1.dll ../../../$BINARY_PATH/$PLATFORM/
cp /usr/$PLATFORM-w64-mingw32/sys-root/mingw/bin/libgcc_s_sjlj-1.dll ../../../$BINARY_PATH/$PLATFORM/
cp /usr/$PLATFORM-w64-mingw32/sys-root/mingw/bin/libstdc++-6.dll ../../../$BINARY_PATH/$PLATFORM/
else
cp ./ad ../../../$BINARY_PATH/$PLATFORM
fi
cd ../../..
################################################################################################
# Make libmpq
cd dep/libmpq
make clean
. ./autogen.sh
if [ "$PLATFORM" != "build" ]; then
if [ "$PLATFORM" == "i686" ]; then
mingw32-configure --host=$PLATFORM-w64-mingw32
else
mingw64-configure --host=$PLATFORM-w64-mingw32
fi
else
./configure
fi
make
make install
cd ../..
################################################################################################
# Make extractor
cd contrib/vmap_extractor_v3
make clean
if [ ! -d ./$PLATFORM ]; then
mkdir $PLATFORM
fi;
cd $PLATFORM
if [ "$PLATFORM" != "build" ]; then
cmake -DCMAKE_TOOLCHAIN_FILE=../../../cmake/mingw32-$PLATFORM.cmake ..
else
cmake ..
fi
make
if [ "$PLATFORM" != "build" ]; then
cp ./vmapextract/vmapExtractor3.exe ../../../$BINARY_PATH/$PLATFORM/
cp /usr/$PLATFORM-w64-mingw32/sys-root/mingw/bin/libbz2-1.dll ../../../$BINARY_PATH/$PLATFORM/
else
cp ./vmapextract/vmapExtractor3 ../../../$BINARY_PATH/$PLATFORM/
fi
cd ../../..
################################################################################################
# Make external ACE (need run only after ACE version on build server change)
#if [ "$PLATFORM" != "build" ]; then
# build_prefix="/usr/local/src"
# ACE_ROOT=$build_prefix/ACE_wrappers; export ACE_ROOT
# MINGW_BASE=/usr/$PLATFORM-w64-mingw32; export MINGW_BASE
# export PATH=$MINGW_BASE/bin:$PATH
# CROSS_COMPILE=$PLATFORM-; export CROSS_COMPILE
#fi
#cd $ACE_ROOT
#echo '#include "ace/config-win32.h"' > $ACE_ROOT/ace/config.h
#echo 'include $(ACE_ROOT)/include/makeinclude/platform_mingw32.GNU' > $ACE_ROOT/include/makeinclude/platform_macros.GNU
#mingw32-make ACE TP_Reactor
#mingw32-make install ACE TP_Reactor
################################################################################################
# Make vmap assembler
cd contrib/vmap_assembler
if [ ! -d ./$PLATFORM ]; then
mkdir $PLATFORM
fi;
cd $PLATFORM
if [ "$PLATFORM" != "build" ]; then
cmake -DCMAKE_TOOLCHAIN_FILE=../../../cmake/mingw32-$PLATFORM.cmake ..
else
cmake ..
fi
make
if [ "$PLATFORM" != "build" ]; then
cp ./vmap_assembler.exe ../../../$BINARY_PATH/$PLATFORM/
cp /usr/$PLATFORM-w64-mingw32/sys-root/mingw/lib/libACE.dll ../../../$BINARY_PATH/$PLATFORM/
else
cp ./vmap_assembler ../../../$BINARY_PATH/$PLATFORM/
fi
cd ../../..
################################################################################################
# Make mmap extractor
cd contrib/mmap
if [ ! -d ./$PLATFORM ]; then
mkdir $PLATFORM
fi;
cd $PLATFORM
if [ "$PLATFORM" != "build" ]; then
cmake -DCMAKE_TOOLCHAIN_FILE=../../../cmake/mingw32-$PLATFORM.cmake ..
else
cmake ..
fi
make
if [ "$PLATFORM" != "build" ]; then
cp ./MoveMapGen.exe ../../../$BINARY_PATH/$PLATFORM/
else
cp ./MoveMapGen ../../../$BINARY_PATH/$PLATFORM/
fi
################################################################################################