Skip to content

Instantly share code, notes, and snippets.

@bltb
Forked from codingtony/buildHAProxy.sh
Created December 10, 2016 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bltb/b9a88b22cd9b397bb167a0fcb110882b to your computer and use it in GitHub Desktop.
Save bltb/b9a88b22cd9b397bb167a0fcb110882b 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
#!/bin/bash -e
DIR=$PWD
LIBRESSL=libressl-2.5.0
HAPROXY=haproxy-1.6.9
PCRE=pcre-8.39
LUA=lua-5.3.0
READLINE=readline-6.3
NCURSES=ncurses-6.0
cd ${DIR}
export STATIC_NCURSES=/tmp/${NCURSES}
wget https://ftp.gnu.org/pub/gnu/ncurses/${NCURSES}.tar.gz
tar xvzf ${NCURSES}.tar.gz
cd ${NCURSES}
./configure --prefix=${STATIC_NCURSES} --enable-shared=no
make && make install
export LD_LIBRARY_PATH=${STATIC_NCURSES}/lib:${LD_LIBRARY_PATH}
cd ${DIR}
rm -rf ${READLINE}
export STATIC_READLINE=/tmp/${READLINE}
wget ftp://ftp.cwru.edu/pub/bash/${READLINE}.tar.gz
tar xvzf ${READLINE}.tar.gz
cd ${READLINE}
./configure --prefix=${STATIC_READLINE} --enable-static=true
make && make install
export LD_LIBRARY_PATH=${STATIC_READLINE}/lib:${LD_LIBRARY_PATH}
cd ${DIR}
wget http://www.lua.org/ftp/${LUA}.tar.gz
export STATIC_LUA=/tmp/${LUA}
tar xvzf ${LUA}.tar.gz
cd ${LUA}
make MYCFLAGS="-I${STATIC_READLINE}/include" MYLDFLAGS="-L${STATIC_READLINE}/lib -L${STATIC_NCURSES}/lib -lreadline -lncurses" linux
make INSTALL_TOP=/tmp/${LUA} install
export LD_LIBRARY_PATH=${STATIC_LUA}/lib:${LD_LIBRARY_PATH}
cd ${DIR}
wget http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/${LIBRESSL}.tar.gz
export STATICLIBSSL=/tmp/${LIBRESSL}
tar xvzf ${LIBRESSL}.tar.gz
cd ${LIBRESSL}
./configure --prefix=$STATICLIBSSL --enable-shared=no
make && make install
cd ${DIR}
export STATICLIBPCRE=/tmp/staticlibpcre
wget 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
make && make install
cd ${DIR}
wget http://www.haproxy.org/download/1.6/src/${HAPROXY}.tar.gz
tar xvzf ${HAPROXY}.tar.gz
cd ${HAPROXY}
make TARGET=linux2628 USE_PCRE_JIT=1 USE_LUA=1 USE_STATIC_PCRE=1 USE_OPENSSL=1 PCRE_LIB=$STATICLIBPCRE/lib PCRE_INC=$STATICLIBPCRE/include SSL_INC=$STATICLIBSSL/include SSL_LIB=$STATICLIBSSL/lib LUA_INC=${STATIC_LUA}/include LUA_LIB=${STATIC_LUA}/lib ADDLIB="-ldl -lrt" USE_ZLIB=1
make DESTDIR=/tmp/haproxy/ install
cd ${DIR}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment