f53a927982babd811fe6a37c5bee4b0d2a451794
[novacoin.git] / mingw64_deps / openssl / build.sh
1 #!/bin/bash
2
3 CROSS=$1
4 ROOT=$(pwd)
5
6 if [[ ! "${CROSS}" =~ ^(aarch64|x86_64) ]]; then
7 echo "Platform ${CROSS} is not supported"
8 echo "Expected either aarch64 or x86_64."
9 exit 1
10 fi
11
12 if [[ ! $(which ${CROSS}-w64-mingw32-clang) ]]; then
13 echo "llvm-mingw is not installed, please download it from https://github.com/mstorsjo/llvm-mingw/releases"
14 exit 1
15 fi
16
17 if [[ ! $(which make) ]]; then
18 echo "make is not installed, please install buld-essential package"
19 exit 1
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 export CFLAGS="-fstack-protector-all -D_FORTIFY_SOURCE=2"
32 export LDFLAGS="-fstack-protector-all"
33 ${ROOT}/openssl/Configure --cross-compile-prefix=${CROSS}-w64-mingw32- --prefix=${ROOT}/${CROSS}-w64-mingw32 no-shared no-asm mingw64 --api=1.1.1
34 make -j 4 build_libs
35 make install_dev
36
37 # Create symlink for compatibility
38 cd ${ROOT}/${CROSS}-w64-mingw32
39 ln -s lib64 lib
40
41 # Remove build directore
42 cd ${ROOT}
43 rm -rf ${ROOT}/${CROSS}-w64-mingw32-build