7 if [[ ! "${TARGET_CPU}" =~ ^(aarch64|x86_64) ]]; then
8 echo "Platform ${TARGET_CPU} is not supported"
9 echo "Expected either aarch64 or x86_64."
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."
19 # Cross-building prefix
20 CROSS=${TARGET_CPU}-${TARGET_OS}
22 if [[ ! $(which ${CROSS}-gcc) ]]; then
23 echo "Target C compiler ${CROSS}-gcc is not found"
27 if [[ ! $(which ${CROSS}-g++) ]]; then
28 echo "Target C++ compiler ${CROSS}-g++ is not found"
32 if [[ ! $(which make) ]]; then
33 echo "make is not installed, please install buld-essential package"
37 if [ "${TARGET_CPU}" == "aarch64" ]; then
38 MUTEX="ARM64/gcc-assembly"
41 if [ "${TARGET_OS}" == "w64-mingw32" ]; then
42 TARGET_PARAMS="mingw64"
44 TARGET_PARAMS="linux-generic64"
47 # Make build directories
48 mkdir ${ROOT}/${CROSS}-build
51 mkdir ${ROOT}/${CROSS}
55 cd ${ROOT}/${CROSS}-build
56 export CFLAGS="-fstack-protector-all -D_FORTIFY_SOURCE=2"
57 export LDFLAGS="-fstack-protector-all"
58 ${ROOT}/openssl/Configure --cross-compile-prefix=${CROSS}- --prefix=${ROOT}/${CROSS} no-shared no-asm ${TARGET_PARAMS} --api=1.1.1
62 # Create symlink for compatibility
64 if [[ -d lib64 ]]; then
68 # Remove build directore
70 rm -rf ${ROOT}/${CROSS}-build