forked from haywire/haywire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·84 lines (76 loc) · 2.43 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
#!/bin/bash
OS=`uname -s`
PLATFORM_WINDOWS="Windows_NT"
PLATFORM_LINUX="Linux"
PLATFORM_MACOSX="Darwin"
GYP=./lib/libuv/build/gyp/gyp
CONFIGURATION="debug"
# Parse command line arguments
while getopts ":o:c:" option
do
case $option in
o)
OS=$OPTARG
;;
c)
CONFIGURATION=$OPTARG
;;
?)
echo "invalid option provided"
exit
;;
esac
done
echo "----------------------------------------"
echo "Cloning submodules"
echo "----------------------------------------"
# Getting Wrk
if [ ! -d "bin/wrk" ]; then
echo "git clone https://github.com/wg/wrk.git bin/wrk"
git clone https://github.com/wg/wrk.git bin/wrk
fi
# Getting Wrk2
if [ ! -d "bin/wrk2" ]; then
echo "git clone https://github.com/giltene/wrk2.git bin/wrk2"
git clone https://github.com/giltene/wrk2.git bin/wrk2
fi
# Getting libuv
if [ ! -d "lib/libuv" ]; then
echo "git clone https://github.com/libuv/libuv.git lib/libuv"
git clone https://github.com/libuv/libuv.git lib/libuv
fi
# Getting Gyp build environment.
if [ ! -d "bin/gyp" ]; then
echo "git clone https://chromium.googlesource.com/external/gyp.git bin/gyp"
git clone https://chromium.googlesource.com/external/gyp.git bin/gyp
fi
if [ ! -d "lib/libuv/build" ]; then
mkdir lib/libuv/build
cp -Rf bin/gyp lib/libuv/build/gyp
fi
if [ $OS = $PLATFORM_WINDOWS ]; then
echo "----------------------------------------"
echo "Configuring for ${OS} & Visual Studio"
echo "----------------------------------------"
$GYP --depth=. -Icommon.gypi -Dlibrary=static_library -Duv_library=static_library -Dtarget_arch=x64 --build=$CONFIGURATION haywire.gyp
msbuild /p:Configuration=$CONFIGURATION haywire.sln
else
# Compiling wrk
echo "----------------------------------------"
echo "Compiling wrk"
echo "----------------------------------------"
cd bin/wrk
make
cd ../../
# Compiling wrk2
echo "----------------------------------------"
echo "Compiling wrk2"
echo "----------------------------------------"
cd bin/wrk2
make
cd ../../
echo "----------------------------------------"
echo "Configuring and compiling for ${OS}"
echo "----------------------------------------"
$GYP --depth=. -Goutput_dir=./builds/unix -Icommon.gypi -Dlibrary=static_library -Duv_library=static_library -Dtarget_arch=x64 --build=$CONFIGURATION -f make haywire.gyp
fi