aria2-static-builds/build-scripts/mingw-config/aria2-x86_64-w64-mingw-build-libs
2016-10-15 22:30:00 +02:00

102 lines
2.5 KiB
Bash
Executable File

#!/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
#CHECK TOOL FOR DOWNLOAD
aria2c --help > /dev/null
if [ "$?" -eq 0 ] ; then
DOWNLOADER="aria2c --check-certificate=false"
else
DOWNLOADER="wget -c"
fi
## DEPENDENCES ##
ZLIB=http://sourceforge.net/projects/libpng/files/zlib/1.2.8/zlib-1.2.8.tar.gz
OPENSSL=http://www.openssl.org/source/openssl-1.0.2j.tar.gz
EXPAT=https://sourceforge.net/projects/expat/files/expat/2.2.0/expat-2.2.0.tar.bz2
SQLITE3=http://www.sqlite.org/2016/sqlite-autoconf-3150000.tar.gz
C_ARES=http://c-ares.haxx.se/download/c-ares-1.12.0.tar.gz
SSH2=https://www.libssh2.org/download/libssh2-1.7.0.tar.gz
## 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.2.8.tar.gz
cd zlib-1.2.8/
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.2.0.tar.bz2
cd expat-2.2.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.12.0.tar.gz
cd c-ares-1.12.0/
CC=$HOST-gcc CXX=$HOST-g++ AR=$HOST-ar RANLIB=$HOST-ranlib ./configure --prefix=$PREFIX --host=$HOST --enable-static --disable-shared
make
make install
#
# Openssl build
cd ..
$DOWNLOADER $OPENSSL
tar zxvf openssl-1.0.2j.tar.gz
cd openssl-1.0.2j/
./Configure mingw64 --cross-compile-prefix=$HOST- --prefix=$PREFIX shared
make
make install
#
# sqlite3
cd ..
$DOWNLOADER $SQLITE3
tar zxvf sqlite-autoconf-3150000.tar.gz
cd sqlite-autoconf-3150000/
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.7.0.tar.gz
cd libssh2-1.7.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
#
#cleaning
cd ..
rm -rf c-ares*
rm -rf sqlite-autoconf*
rm -rf zlib-*
rm -rf expat-*
rm -rf openssl-*
rm -rf libssh2-*
#
echo "finished!"