forked from bog2k3/boglfw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-deps.sh
129 lines (115 loc) · 3.37 KB
/
install-deps.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
#!/bin/bash
set -e # immediately exit on error
# select makefile generator for CMake based on operating system type
if [[ "$OSTYPE" == "msys" ]]; then
MAKEFILE_GENERATOR="MinGW Makefiles" # this is for windows/mingw/msys
MAKE_EXECUTABLE="mingw32-make"
elif [[ "$OSTYPE" == "linux-gnu" ]] || [[ "$OSTYPE" == "darwin"* ]]; then
MAKEFILE_GENERATOR="Unix Makefiles" # standard linux
MAKE_EXECUTABLE="make"
else
echo "Unknown OS type $OSTYPE, don't know which makefile generator to use!"
exit 1
fi
function getMinGWPath() {
local GDB_SUFFIX=/bin/gdb
local GDB_PATH=`which gdb`
local PATH_LEN=$((${#GDB_PATH} - ${#GDB_SUFFIX}))
local MINGW_PATH=${GDB_PATH:0:PATH_LEN}
echo $MINGW_PATH
}
function getInstallPrefix() {
if [[ "$OSTYPE" == "msys" ]]; then
echo $(getMinGWPath)
else
echo "/usr/local"
fi
}
mkdir -p deps/include
mkdir -p deps/lib
mkdir -p deps/bin
cd deps
# ZLIB
if [ ! -f "$(getInstallPrefix)/include/zlib.h" ]; then
printf "\nBuilding zlib-1.2.13... +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n"
if [ ! -d ./zlib-1.2.13 ]; then
tar -xpf ../3rd-party/zlib-1.2.13.tar.gz
fi
cd zlib-1.2.13
./configure --prefix=$(getInstallPrefix)
${MAKE_EXECUTABLE} install
cd ../
else
printf "\nzlib-1.2.13 already installed\n\n"
fi
# PostgreSQL
if [ ! -f "$(getInstallPrefix)/include/pg_config.h" ]; then
printf "\nBuilding postgresql-15.0... +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n"
if [ ! -d ./postgresql-15.0 ]; then
tar -xpf ../3rd-party/postgresql-15.0.tar.gz
fi
cd postgresql-15.0
./configure --with-includes=../include/ --with-libraries=../lib/ --prefix=$(getInstallPrefix)
${MAKE_EXECUTABLE} install
cd ../
else
printf "\npostgresql-15.0 already installed\n\n"
fi
# AMQP-CPP
if [ ! -f "$(getInstallPrefix)/include/amqpcpp.h" ]; then
printf "\nBuilding AMQP-CPP...+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n"
if [ ! -d ./AMQP-CPP ]; then
git clone https://github.com/CopernicaMarketingSoftware/AMQP-CPP.git
fi
cd AMQP-CPP
if [ ! -d build ]; then
mkdir build
fi
cd build
cmake .. -G "${MAKEFILE_GENERATOR}" -DCMAKE_INSTALL_PREFIX=$(getInstallPrefix)
${MAKE_EXECUTABLE} install
cd ../../
else
printf "\nAMQP-CPP already installed\n\n"
fi
# ASIO
if [ ! -f "$(getInstallPrefix)/include/asio.hpp" ]; then
printf "\nBuilding ASIO...+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n"
if [ ! -d ./asio ]; then
git clone https://github.com/chriskohlhoff/asio
fi
cd asio/asio
git checkout asio-1-14-0
if [[ "$OSTYPE" == "linux-gnu" ]] || [[ "$OSTYPE" == "darwin"* ]]; then
./autogen.sh
./configure --prefix=$(getInstallPrefix)
make install
else
cp -r include/* $(getInstallPrefix)/include/
fi
cd ../../
else
printf "\nASIO already installed\n\n"
fi
# JSON
if [ ! -d ./json ]; then
printf "\nBuilding JSON...+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n"
if [ ! -d ./json ]; then
git clone https://github.com/nlohmann/json
fi
cd json
git checkout v3.7.3
if [ ! -d build ]; then
mkdir build
fi
cd build
cmake .. -G "${MAKEFILE_GENERATOR}" -DJSON_BuildTests=OFF -DCMAKE_INSTALL_PREFIX=$(getInstallPrefix)
${MAKE_EXECUTABLE} install
cd ../../
else
printf "\nJSON already installed\n\n"
fi
printf "\n=====================================================\nDependencies installed.\n\n";
# get out of ./deps/
cd ../
rm -rf deps/