| 1 | #!/bin/sh |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | if [ $# -ne 4 ]; then |
| 6 | echo "Usage: build-kore.sh [openssl] [python] [curl] [nghttp2]" |
| 7 | exit 1 |
| 8 | fi |
| 9 | |
| 10 | # Set ROOT based on the versions given. |
| 11 | VERSION=kore_ossl-$1_python-$2_curl-$3_nghttp2-$4 |
| 12 | ROOT=`pwd`/$VERSION |
| 13 | |
| 14 | # Pull in the rest of the functions. |
| 15 | . ./helpers.sh |
| 16 | |
| 17 | OPENSSL=openssl-$1 |
| 18 | PYTHON=Python-$2 |
| 19 | CURL=curl-$3 |
| 20 | NGHTTP2=nghttp2-$4 |
| 21 | |
| 22 | # Build OpenSSL |
| 23 | echo "Building $OPENSSL" |
| 24 | fetch "https://www.openssl.org/source/$OPENSSL.tar.gz" $OPENSSL |
| 25 | build $OPENSSL ./config no-shared --prefix=$FAKEROOT/$OPENSSL |
| 26 | |
| 27 | # Build Python |
| 28 | echo "Building $PYTHON" |
| 29 | fetch "https://www.python.org/ftp/python/$2/$PYTHON.tgz" $PYTHON |
| 30 | default_build $PYTHON |
| 31 | |
| 32 | # Build nghttp2 |
| 33 | echo "Building $NGHTTP2" |
| 34 | fetch \ |
| 35 | "https://github.com/nghttp2/nghttp2/releases/download/v$4/$NGHTTP2.tar.gz" \ |
| 36 | $NGHTTP2 |
| 37 | |
| 38 | default_build $NGHTTP2 --enable-lib-only --prefix=$FAKEROOT/$NGHTTP2 \ |
| 39 | --enable-shared=no |
| 40 | |
| 41 | # Build curl |
| 42 | echo "Building $CURL" |
| 43 | export PKG_CONFIG="pkg-config --static" |
| 44 | export PKG_CONFIG_PATH="$FAKEROOT/$OPENSSL/lib/pkgconfig:$FAKEROOT/$NGHTTP2/lib/pkgconfig" |
| 45 | |
| 46 | fetch "https://curl.haxx.se/download/$CURL.tar.gz" $CURL |
| 47 | default_build $CURL --enable-shared=no |
| 48 | |
| 49 | # Now we can build kore. |
| 50 | unset PKG_CONFIG |
| 51 | unset PKG_CONFIG_PATH |
| 52 | |
| 53 | export PATH=$FAKEROOT/bin:$PATH |
| 54 | export OPENSSL_PATH=$FAKEROOT/$OPENSSL |
| 55 | |
| 56 | cd $ROOT |
| 57 | |
| 58 | if [ ! -d kore ]; then |
| 59 | git clone https://git.kore.io/kore.git |
| 60 | fi |
| 61 | |
| 62 | pushd kore |
| 63 | make clean |
| 64 | LDFLAGS=-L$FAKEROOT/$NGHTTP2/lib make PYTHON=1 CURL=1 ACME=1 |
| 65 | |
| 66 | mv kore $ROOT/kore.bin |
| 67 | popd |