-
-
Save taomaree/2c5473f441e209e48263 to your computer and use it in GitHub Desktop.
Compile of Haproxy using LibreSSL static. See https://github.com/codingtony/docker-build-haproxy for how to use with a Docker Image (libressl 2.2.3, libpcre 8.37 and haproxy 1.5.14)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
DIR=$PWD | |
yum install -y gcc-c++ gcc make zlib-devel bzip2-devel systemd-devel | |
#Compile static version of libressl | |
export STATICLIBSSL=/app/libssl | |
LIBRESSL=libressl-2.2.5 | |
HAPROXY=haproxy-1.6.3 | |
PCRE=pcre-8.38 | |
test -f ${LIBRESSL}.tar.gz || wget -c http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/${LIBRESSL}.tar.gz | |
tar xvzf ${LIBRESSL}.tar.gz | |
cd ${LIBRESSL} | |
./configure --prefix=$STATICLIBSSL --enable-shared=no | |
make && make install | |
cd ${DIR} | |
export STATICLIBPCRE=/app/pcre | |
test -f ${PCRE}.tar.gz || wget -c ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/${PCRE}.tar.gz | |
tar xvzf ${PCRE}.tar.gz | |
cd ${PCRE} | |
./configure --prefix=$STATICLIBPCRE --enable-shared=no --enable-utf8 --enable-jit \ | |
--enable-pcre8 --enable-pcre16 --enable-pcre32 --enable-unicode-properties --enable-pcregrep-libz --enable-pcregrep-libbz2 | |
make && make install | |
cd ${DIR} | |
test -f ${HAPROXY}.tar.gz || wget -c http://www.haproxy.org/download/1.5/src/${HAPROXY}.tar.gz | |
# kernel >= 3.7,support TCP_FAST_OPEN. we support kernel >= 4.0 enable TCP_FAST_OPEN | |
USE_TFO='' | |
test `uname -r|awk -F'.' {'print $1'}` -gt '3' && USE_TFO='USE_TFO=1' | |
USE_SYSTEMD='' | |
which systemd && USE_SYSTEMD='USE_SYSTEMD=1' | |
tar xvzf ${HAPROXY}.tar.gz | |
cd ${HAPROXY} | |
make clean | |
make TARGET=linux2628 USE_PCRE_JIT=1 USE_STATIC_PCRE=1 USE_OPENSSL=1 \ | |
PCRE_LIB=$STATICLIBPCRE/lib PCRE_INC=$STATICLIBPCRE/include \ | |
SSL_INC=$STATICLIBSSL/include SSL_LIB=$STATICLIBSSL/lib ADDLIB="-ldl -lrt" USE_ZLIB=1 \ | |
$USE_TFO $USE_SYSTEMD | |
# make TARGET=linux2628 USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_CRYPT_H=1 USE_LIBCRYPT=1 | |
make install DESTDIR=/app/haproxy PREFIX="" | |
cd ${DIR} | |
/app/haproxy/sbin/haproxy -vv | |
## build rpm package | |
yum install -y rubygems ruby ruby-devel gcc rpm-build redhat-lsb-core | |
gem sources --remove https://rubygems.org/ | |
gem sources --remove http://rubygems.org/ | |
gem sources --add https://ruby.taobao.org/ | |
gem install cabin -v 0.7.2 --no-rdoc --no-ri | |
gem install fpm --no-rdoc --no-ri | |
# centos 6 ,ruby 1.8.7 ,you need older cabin | |
test `ruby -v | awk -F' ' {'print $2'}|awk -F'.' {'print $1'}` -lt 2 && \ | |
gem uninstall cabin --ignore-dependencies --executables && gem install cabin -v 0.7.2 --no-rdoc --no-ri | |
HAPROXY_VERSION=`echo $HAPROXY|awk -F"-" {'print $2'}` | |
rm -rf ${HAPROXY}_*rpm | |
fpm -s dir -t rpm -n haproxy -v ${HAPROXY_VERSION} -C /app/haproxy \ | |
-p ${HAPROXY}_$(lsb_release -si)$(lsb_release -sr)_ARCH.rpm --prefix /app/haproxy | |
rpm -qlp ${HAPROXY}_*_x86_64.rpm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment