commit 406c37b01d5d00a6f8bfc5d9f46e33aca2c2f8b8 Author: Michael Rennecke Date: Sun Mar 10 15:09:24 2019 +0100 build script for haproxy diff --git a/build-haproxy.sh b/build-haproxy.sh new file mode 100755 index 0000000..598f4ad --- /dev/null +++ b/build-haproxy.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +set -e + + +HAPROXY_VERSION=1.9.4 +HAPROXY_URL=https://www.haproxy.org/download/1.9/src/haproxy-${HAPROXY_VERSION}.tar.gz +HAPROXY_SHA256=8483fe12b30256f83d542b3f699e165d8f71bf2dfac8b16bb53716abce4ba74f +HAPROXY_SRC=/tmp/haproxy + +OPENSSL_VERSION=1.1.1b +OPENSSL_URL=https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz +OPENSSL_SHA256_URL=https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz.sha256 +OPENSSL_SRC=/tmp/openssl + +[ -d "$OPENSSL_SRC" ] && rm -rf "$OPENSSL_SRC" +[ -d "$HAPROXY_SRC" ] && rm -rf "$HAPROXY_SRC" + +# +# build openssl +# +OPENSSL_SHA256=$(wget -O - "$OPENSSL_SHA256_URL") +wget -O openssl.tar.gz "$OPENSSL_URL" +echo "$OPENSSL_SHA256 *openssl.tar.gz" | sha256sum -c + +mkdir -p "$OPENSSL_SRC" +tar xfz openssl.tar.gz -C "$OPENSSL_SRC" --strip-components=1 +rm openssl.tar.gz + +pushd "$OPENSSL_SRC" +./config --prefix="$OPENSSL_SRC" no-ssl3 no-idea no-weak-ssl-ciphers no-shared +make -j "$(nproc)" +#make install +popd + +# +# build haproxy +# +wget -O haproxy.tar.gz "$HAPROXY_URL" +echo "$HAPROXY_SHA256 *haproxy.tar.gz" | sha256sum -c + +mkdir -p "$HAPROXY_SRC" +tar xfz haproxy.tar.gz -C "$HAPROXY_SRC" --strip-components=1 +rm haproxy.tar.gz + +# needed for static openssl +sed -e 's/OPTIONS_LDFLAGS += -lpthread/OPTIONS_LDFLAGS += -pthread/' -i "$HAPROXY_SRC/Makefile" + +HAPROXY_OPTIONS=" \ + TARGET=linux2628 \ + USE_LUA=1 \ + LUA_INC=/usr/include/lua5.3 \ + USE_OPENSSL=1 \ + SSL_LIB=$OPENSSL_SRC/ \ + SSL_INC=$OPENSSL_SRC/include/ \ + USE_PCRE=1 \ + USE_PCRE_JIT=1 \ + PCREDIR= \ + USE_ZLIB=1" + +make -C "$HAPROXY_SRC" -j "$(nproc)" all $HAPROXY_OPTIONS + +# +# copy files to ansible +# +cp -r "$HAPROXY_SRC/examples/errorfiles" roles/haproxy/files/ +cp "$HAPROXY_SRC/haproxy" roles/haproxy/files/