a59c4a7b3ff9f41087516050aa0dda6a0b61cc01
[novacoin.git] / mingw64_deps / db / build.sh
1 #!/bin/bash
2
3 CROSS=$1
4 ROOT=$(pwd)
5 MUTEX="x86_64/gcc-assembly"
6
7 if [[ ! "${CROSS}" =~ ^(aarch64|x86_64) ]]; then
8 echo "Platform ${CROSS} is not supported"
9 echo "Expected either aarch64 or x86_64."
10 exit 1
11 fi
12
13 if [[ ! $(which ${CROSS}-w64-mingw32-clang) ]]; then
14 echo "llvm-mingw is not installed, please download it from https://github.com/mstorsjo/llvm-mingw/releases"
15 exit 1
16 fi
17
18 if [ "${CROSS}" == "aarch64" ]; then
19 MUTEX="ARM64/gcc-assembly"
20 fi
21
22 # Make build directories
23 mkdir ${ROOT}/${CROSS}-w64-mingw32-build
24
25 # Stage directory
26 mkdir ${ROOT}/${CROSS}-w64-mingw32
27
28 # Compile BerkeleyDB
29
30 cd ${ROOT}/${CROSS}-w64-mingw32-build
31 CC=${CROSS}-w64-mingw32-gcc CXX=${CROSS}-w64-mingw32-g++ ${ROOT}/libdb/dist/configure --prefix=${ROOT}/${CROSS}-w64-mingw32 --enable-smallbuild --enable-cxx --disable-shared --disable-replication --with-mutex=${MUTEX} --enable-mingw --host=${CROSS}-w64-mingw32
32 make -j 4 library_build
33 make library_install
34
35 # Remove build directore
36 cd ${ROOT}
37 rm -rf ${ROOT}/${CROSS}-w64-mingw32-build