aria2-static-builds/build-scripts/gnu-linux-config/aria2-x86_64-gnu-linux-build-libs

118 lines
4.0 KiB
Bash
Executable File

#!/bin/bash
# In this configuration, the following dependent libraries are compiled:
#
# * zlib
# * c-ares
# * expat
# * sqlite3
# * openSSL
# * libssh2
#COMPILER AND PATH
PREFIX=/opt/aria2/build_libs
C_COMPILER="gcc"
CXX_COMPILER="g++"
## 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.2d.tar.gz
EXPAT=http://sourceforge.net/projects/expat/files/expat/2.1.0/expat-2.1.0.tar.gz
SQLITE3=https://www.sqlite.org/2015/sqlite-autoconf-3090100.tar.gz
C_ARES=http://c-ares.haxx.se/download/c-ares-1.10.0.tar.gz
SSH2=http://www.libssh2.org/download/libssh2-1.6.0.tar.gz
## CONFIG ##
BUILD_DIRECTORY=/tmp/
## BUILD ##
cd $BUILD_DIRECTORY
#
# zlib build
wget -c $ZLIB
tar zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8/
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig/ LD_LIBRARY_PATH=$PREFIX/lib/ CC="$C_COMPILER" CXX="$CXX_COMPILER" ./configure --prefix=$PREFIX --static
make
make install
#
# expat build
cd ..
wget -c $EXPAT
tar zxvf expat-2.1.0.tar.gz
cd expat-2.1.0/
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig/ LD_LIBRARY_PATH=$PREFIX/lib/ CC="$C_COMPILER" CXX="$CXX_COMPILER" ./configure --prefix=$PREFIX --enable-static --disable-shared
make
make install
#
# c-ares build
cd ..
wget -c $C_ARES
tar zxvf c-ares-1.10.0.tar.gz
cd c-ares-1.10.0/
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig/ LD_LIBRARY_PATH=$PREFIX/lib/ CC="$C_COMPILER" CXX="$CXX_COMPILER" ./configure --prefix=$PREFIX --enable-static --disable-shared
make
make install
#
# Openssl build
cd ..
wget -c $OPENSSL
tar zxvf openssl-1.0.2d.tar.gz
cd openssl-1.0.2d/
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig/ LD_LIBRARY_PATH=$PREFIX/lib/ CC="$C_COMPILER" CXX="$CXX_COMPILER" ./Configure --prefix=$PREFIX linux-x86_64
make
make install
#
# sqlite3
cd ..
wget -c $SQLITE3
tar zxvf sqlite-autoconf-3090100.tar.gz
cd sqlite-autoconf-3090100/
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig/ LD_LIBRARY_PATH=$PREFIX/lib/ CC="$C_COMPILER" CXX="$CXX_COMPILER" ./configure --prefix=$PREFIX --enable-static --disable-shared
make
make install
#
# libssh2
cd ..
wget -c $SSH2
tar zxvf libssh2-1.6.0.tar.gz
cd libssh2-1.6.0/
rm -rf $PREFIX/lib/pkgconfig/libssh2.pc
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig/ LD_LIBRARY_PATH=$PREFIX/lib/ CC="$C_COMPILER" CXX="$CXX_COMPILER" ./configure --without-libgcrypt --with-openssl --without-wincng --prefix=$PREFIX --enable-static --disable-shared
make
make install
if [ -f $PREFIX/lib/pkgconfig/libssh2.pc ] ; then
echo "$PREFIX/lib/pkgconfig/libssh2.pc"
else
echo "################################" > $PREFIX/lib/pkgconfig/libssh2.pc
echo "# libssh2 installation details #" >> $PREFIX/lib/pkgconfig/libssh2.pc
echo "#################################" >> $PREFIX/lib/pkgconfig/libssh2.pc
echo "" >> $PREFIX/lib/pkgconfig/libssh2.pc
echo "prefix=$PREFIX" >> $PREFIX/lib/pkgconfig/libssh2.pc
echo "exec_prefix=$PREFIX" >> $PREFIX/lib/pkgconfig/libssh2.pc
echo "libdir=$PREFIX/lib" >> $PREFIX/lib/pkgconfig/libssh2.pc
echo "includedir=$PREFIX/include" >> $PREFIX/lib/pkgconfig/libssh2.pc
echo "" >> $PREFIX/lib/pkgconfig/libssh2.pc
echo "Name: libssh2" >> $PREFIX/lib/pkgconfig/libssh2.pc
echo "URL: http://www.libssh2.org/" >> $PREFIX/lib/pkgconfig/libssh2.pc
echo "Description: Library for SSH-based communication" >> $PREFIX/lib/pkgconfig/libssh2.pc
echo "Version: 1.6.0" >> $PREFIX/lib/pkgconfig/libssh2.pc
echo "Requires.private: zlib" >> $PREFIX/lib/pkgconfig/libssh2.pc
echo "Libs: -L$PREFIX/lib -lssh2 -lssl -lcrypto -lz" >> $PREFIX/lib/pkgconfig/libssh2.pc
echo "Libs.private: -lssl -lcrypto -lz" >> $PREFIX/lib/pkgconfig/libssh2.pc
echo "Cflags: -I$PREFIX/include" >> $PREFIX/lib/pkgconfig/libssh2.pc
echo "$PREFIX/lib/pkgconfig/libssh2.pc created!"
cp -rf include/*.h $PREFIX/include
fi
#
#cleaning
cd ..
rm -rf c-ares*
rm -rf sqlite-autoconf*
rm -rf zlib-*
rm -rf expat-*
rm -rf openssl-*
rm -rf libssh2-*
#
echo "finished!"