update libev build compile configuration(do not build documentation)

by default, compiled mbedtls latest version

Signed-off-by: Teddysun <i@teddysun.com>
This commit is contained in:
Teddysun 2017-07-16 19:01:19 +09:00
parent c09c168297
commit c10ee1b45d
No known key found for this signature in database
GPG Key ID: 09BD4C080AD6C46D

View File

@ -15,6 +15,9 @@ cur_dir=`pwd`
libsodium_file="libsodium-1.0.12"
libsodium_url="https://github.com/jedisct1/libsodium/releases/download/1.0.12/libsodium-1.0.12.tar.gz"
mbedtls_file="mbedtls-2.5.1"
mbedtls_url="https://tls.mbed.org/download/mbedtls-2.5.1-gpl.tgz"
# Make sure only root can run our script
rootness(){
if [[ $EUID -ne 0 ]]; then
@ -245,28 +248,58 @@ pre_install(){
char=`get_char`
#Install necessary dependencies
yum install -y epel-release
yum install -y gcc gettext-devel unzip autoconf automake make zlib-devel libtool xmlto asciidoc udns-devel libev-devel
yum install -y pcre pcre-devel perl perl-devel cpio expat-devel openssl-devel mbedtls-devel
yum install -y gcc gettext-devel unzip autoconf automake make zlib-devel libtool udns-devel libev-devel
yum install -y pcre pcre-devel perl perl-devel cpio expat-devel openssl-devel
}
download() {
local filename=$(basename $1)
if [ -f ${1} ]; then
echo "${filename} [found]"
else
echo "${filename} not found, download now..."
wget --no-check-certificate -c -t3 -T60 -O ${1} ${2}
if [ $? -ne 0 ]; then
echo "Error: Download ${filename} failed."
exit 1
fi
fi
}
# Download latest shadowsocks-libev
download_files(){
cd ${cur_dir}
if ! wget --no-check-certificate -O ${shadowsocks_libev_ver}.tar.gz ${download_link}; then
echo "Failed to download ${shadowsocks_libev_ver}.tar.gz"
exit 1
fi
download "${shadowsocks_libev_ver}.tar.gz" "${download_link}"
download "${libsodium_file}.tar.gz" "${libsodium_url}"
download "${mbedtls_file}-gpl.tgz" "${mbedtls_url}"
download "/etc/init.d/shadowsocks" "${init_script_link}"
}
if ! wget --no-check-certificate -O ${libsodium_file}.tar.gz ${libsodium_url}; then
echo "Failed to download ${libsodium_file}.tar.gz"
exit 1
install_libsodium() {
if [ ! -f /usr/lib/libsodium.a ]; then
cd ${cur_dir}
tar zxf ${libsodium_file}.tar.gz
cd ${libsodium_file}
./configure --prefix=/usr && make && make install
if [ $? -ne 0 ]; then
echo "Error: ${libsodium_file} install failed."
exit 1
fi
else
echo "Info: ${libsodium_file} already installed."
fi
}
# Download init script
if ! wget --no-check-certificate -O /etc/init.d/shadowsocks ${init_script_link}; then
echo "Failed to download shadowsocks-libev init script!"
exit 1
install_mbedtls() {
if [ ! -f /usr/lib/libmbedtls.a ]; then
cd ${cur_dir}
tar xf ${mbedtls_file}-gpl.tgz
cd ${mbedtls_file}
make SHARED=1 CFLAGS=-fPIC
make DESTDIR=/usr install
else
echo "Info: ${mbedtls_file} already installed."
fi
}
@ -334,22 +367,14 @@ firewall_set(){
# Install Shadowsocks-libev
install_shadowsocks(){
if [ ! -f /usr/lib/libsodium.a ]; then
cd ${cur_dir}
tar zxf ${libsodium_file}.tar.gz
cd ${libsodium_file}
./configure --prefix=/usr && make && make install
if [ $? -ne 0 ]; then
echo "${libsodium_file} install failed!"
exit 1
fi
fi
install_libsodium
install_mbedtls
ldconfig
cd ${cur_dir}
tar zxf ${shadowsocks_libev_ver}.tar.gz
cd ${shadowsocks_libev_ver}
./configure
./configure --disable-documentation
make && make install
if [ $? -eq 0 ]; then
chmod +x /etc/init.d/shadowsocks