Dependencies build scripts unification
[novacoin.git] / mingw64_deps / boost / build.sh
1 #!/bin/bash
2
3 TARGET_CPU=$1
4 TARGET_OS=$2
5 ROOT=$(pwd)
6
7 if [[ ! "${TARGET_CPU}" =~ ^(aarch64|x86_64) ]]; then
8 echo "Platform ${TARGET_CPU} is not supported"
9 echo "Expected either aarch64 or x86_64."
10 exit 1
11 fi
12
13 if [[ ! "${TARGET_OS}" =~ ^(w64\-mingw32|linux\-gnu) ]]; then
14 echo "Operation sysrem ${TARGET_OS} is not supported"
15 echo "Expected either w64-mingw32 or linux-gnu."
16 exit 1
17 fi
18
19 # Cross-building prefix
20 CROSS=${TARGET_CPU}-${TARGET_OS}
21
22 if [[ ! $(which ${CROSS}-gcc) ]]; then
23 echo "Target C compiler ${CROSS}-gcc is not found"
24 exit 1
25 fi
26
27 if [[ ! $(which ${CROSS}-g++) ]]; then
28 echo "Target C++ compiler ${CROSS}-g++ is not found"
29 exit 1
30 fi
31
32 if [ "${TARGET_OS}" == "w64-mingw32" ]; then
33 MINGW32_PARAMS="target-os=windows"
34 fi
35
36 # Create stage directory
37 mkdir ${ROOT}/${CROSS}
38
39 cd ${ROOT}/boost
40
41 # Create compiler settings
42 echo "using gcc : : ${CROSS}-g++ ;" > user-config-${CROSS}.jam
43
44 # Build boost
45 ./b2 --user-config=user-config-${CROSS}.jam cxxflags="-fstack-protector-strong -D_FORTIFY_SOURCE=2" linkflags=-fstack-protector-strong --build-type=minimal --layout=system --with-chrono --with-filesystem --with-program_options --with-system --with-thread ${MINGW32_PARAMS} address-model=64 variant=release link=static threading=multi runtime-link=static stage --prefix=${ROOT}/${CROSS} install
46
47 cd ${ROOT}
48
49 # Remove build directories
50 rm -rf ${ROOT}/boost/stage ${ROOT}/boost/bin.v2 ${ROOT}/boost/user-config-${CROSS}.jam