6 MUTEX="x86_64/gcc-assembly"
8 if [[ ! "${TARGET_CPU}" =~ ^(aarch64|x86_64) ]]; then
9 echo "Platform ${TARGET_CPU} is not supported"
10 echo "Expected either aarch64 or x86_64."
14 if [[ ! "${TARGET_OS}" =~ ^(w64\-mingw32|linux\-gnu) ]]; then
15 echo "Operation sysrem ${TARGET_OS} is not supported"
16 echo "Expected either w64-mingw32 or linux-gnu."
20 # Cross-building prefix
21 CROSS=${TARGET_CPU}-${TARGET_OS}
23 if [[ ! $(which ${CROSS}-gcc) ]]; then
24 echo "Target C compiler ${CROSS}-gcc is not found"
28 if [[ ! $(which ${CROSS}-g++) ]]; then
29 echo "Target C++ compiler ${CROSS}-g++ is not found"
33 if [[ ! $(which make) ]]; then
34 echo "make is not installed, please install buld-essential package"
38 if [ "${TARGET_CPU}" == "aarch64" ]; then
39 MUTEX="ARM64/gcc-assembly"
42 if [ "${TARGET_OS}" == "w64-mingw32" ]; then
43 MINGW32_PARAMS="--enable-mingw"
46 # Make build directories
47 mkdir ${ROOT}/${CROSS}-build
50 mkdir ${ROOT}/${CROSS}
54 cd ${ROOT}/${CROSS}-build
55 export CFLAGS="-fstack-protector-all -D_FORTIFY_SOURCE=2"
56 export CXXFLAGS=${CFLAGS}
57 export LDFLAGS="-fstack-protector-all"
58 ${ROOT}/libdb/dist/configure --prefix=${ROOT}/${CROSS} --enable-smallbuild --enable-cxx --disable-shared --disable-replication --with-mutex=${MUTEX} ${MINGW32_PARAMS} --host=${CROSS}
59 make -j 4 library_build
62 # Remove build directore
64 rm -rf ${ROOT}/${CROSS}-build