#!/bin/bash # In this configuration, the following dependent libraries are compiled: # # * zlib # * c-ares # * expat # * sqlite3 # * openSSL # * libssh2 #IMPORTANT: Require install gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 # cp -rfv /usr/lib/x86_64-linux-gnu/libdl.a /usr/x86_64-w64-mingw32/lib/ #CHECK TOOL FOR DOWNLOAD aria2c --help > /dev/null if [ "$?" -eq 0 ] ; then DOWNLOADER="aria2c --check-certificate=false" else DOWNLOADER="wget -c" fi ## DEPENDENCES ## ZLIB=https://www.zlib.net/zlib-1.3.tar.gz OPENSSL=https://www.openssl.org/source/openssl-1.1.1w.tar.gz EXPAT=https://github.com/libexpat/libexpat/releases/download/R_2_5_0/expat-2.5.0.tar.bz2 SQLITE3=https://www.sqlite.org/2023/sqlite-autoconf-3440200.tar.gz C_ARES=https://c-ares.org/download/c-ares-1.24.0.tar.gz SSH2=https://libssh2.org/download/libssh2-1.11.0.tar.gz GPG_ERROR=https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.47.tar.bz2 ## CONFIG ## BUILD_DIRECTORY=/tmp/ HOST=x86_64-w64-mingw32 PREFIX=/usr/x86_64-w64-mingw32 ## BUILD ## cd $BUILD_DIRECTORY # # zlib build $DOWNLOADER $ZLIB tar zxvf zlib-1.3.tar.gz cd zlib-1.3/ CC=$HOST-gcc CXX=$HOST-g++ AR=$HOST-ar RANLIB=$HOST-ranlib ./configure --prefix=$PREFIX --static make make install # # expat build cd .. $DOWNLOADER $EXPAT tar jxvf expat-2.5.0.tar.bz2 cd expat-2.5.0/ CC=$HOST-gcc CXX=$HOST-g++ AR=$HOST-ar RANLIB=$HOST-ranlib ./configure --prefix=$PREFIX --host=$HOST --enable-static --enable-shared make make install # # c-ares build cd .. $DOWNLOADER $C_ARES tar zxvf c-ares-1.24.0.tar.gz cd c-ares-1.24.0/ CC=$HOST-gcc CXX=$HOST-g++ AR=$HOST-ar RANLIB=$HOST-ranlib ./configure --prefix=$PREFIX --host=$HOST --disable-tests --enable-static --disable-shared make make install # # Openssl build cd .. $DOWNLOADER $OPENSSL tar zxvf openssl-1.1.1w.tar.gz cd openssl-1.1.1w/ ./Configure mingw64 --cross-compile-prefix=$HOST- --prefix=$PREFIX shared make make install # # sqlite3 cd .. $DOWNLOADER $SQLITE3 tar zxvf sqlite-autoconf-3440200.tar.gz cd sqlite-autoconf-3440200/ CC=$HOST-gcc CXX=$HOST-g++ AR=$HOST-ar RANLIB=$HOST-ranlib ./configure --prefix=$PREFIX --host=$HOST --enable-static --enable-shared make make install # # libssh2 cd .. $DOWNLOADER $SSH2 tar zxvf libssh2-1.11.0.tar.gz cd libssh2-1.11.0/ rm -rf $PREFIX/lib/pkgconfig/libssh2.pc CC=$HOST-gcc CXX=$HOST-g++ AR=$HOST-ar RANLIB=$HOST-ranlib ./configure --prefix=$PREFIX --host=$HOST --enable-static --disable-shared make make install # # gpg-error cd .. $DOWNLOADER $GPG_ERROR tar jxvf libgpg-error-1.47.tar.bz2 cd libgpg-error-1.47/ rm -rf $PREFIX/lib/pkgconfig/gpg-error.pc CC=$HOST-gcc CXX=$HOST-g++ AR=$HOST-ar RANLIB=$HOST-ranlib ./configure --host=$HOST --prefix=$PREFIX --enable-static make make install # #cleaning cd .. rm -rf c-ares* rm -rf sqlite-autoconf* rm -rf zlib-* rm -rf expat-* rm -rf openssl-* rm -rf libssh2-* rm -rf libgpg-error* # echo "finished!"