kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 8f743213aad3ee13cf10d7512cace9913f287feb
parent 67cf3e872b4d09a98b6aec7eff145ad1af607c79
Author: Joris Vink <joris@coders.se>
Date:   Thu,  8 Oct 2020 13:53:48 +0200

Add my helper build scripts for building custom binaries.

Allows building Kore with several different component versions.

Eg:
	$ ./build-kore.sh 1.1.1h 3.9.0 7.72.0 1.41.0

	Will build Kore with OpenSSL 1.1.1h, Python 3.9.0, Curl 7.72.0
	and nghttp2 (for curl) 1.41.0

Diffstat:
misc/kore-build/build-curl.sh | 19+++++++++++++++++++
misc/kore-build/build-kodev.sh | 16++++++++++++++++
misc/kore-build/build-kore.sh | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
misc/kore-build/build-nghttp2.sh | 16++++++++++++++++
misc/kore-build/build-openssl.sh | 16++++++++++++++++
misc/kore-build/build-python.sh | 17+++++++++++++++++
misc/kore-build/helpers.sh | 72++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 223 insertions(+), 0 deletions(-)

diff --git a/misc/kore-build/build-curl.sh b/misc/kore-build/build-curl.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +. ./env.sh + +if [ $# -ne 3 ]; then + echo "Usage: build-curl.sh [release] [openssl] [nghttp2]" + exit 1 +fi + +export PKG_CONFIG="pkg-config --static" +export PKG_CONFIG_PATH="$FAKEROOT/openssl-$2/lib/pkgconfig:$FAKEROOT/nghttp2-$3/lib/pkgconfig" + +NAME=curl-$1 + +fetch "https://curl.haxx.se/download/$NAME.tar.gz" $NAME + +default_build $NAME --enable-shared=no diff --git a/misc/kore-build/build-kodev.sh b/misc/kore-build/build-kodev.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +. /home/build/env.sh + +if [ $# -ne 4 ]; then + echo "Usage: build-kore.sh [openssl] [python] [curl] [nghttp2]" + exit 1 +fi + +export PATH=$FAKEROOT/Python-$2/bin:$FAKEROOT/curl-$3/bin:$PATH +export OPENSSL_PATH=$FAKEROOT/openssl-$1 + +kodev clean +kodev build diff --git a/misc/kore-build/build-kore.sh b/misc/kore-build/build-kore.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +set -e + +if [ $# -ne 4 ]; then + echo "Usage: build-kore.sh [openssl] [python] [curl] [nghttp2]" + exit 1 +fi + +# Set ROOT based on the versions given. +VERSION=kore_ossl-$1_python-$2_curl-$3_nghttp2-$4 +ROOT=`pwd`/$VERSION + +# Pull in the rest of the functions. +. ./helpers.sh + +OPENSSL=openssl-$1 +PYTHON=Python-$2 +CURL=curl-$3 +NGHTTP2=nghttp2-$4 + +# Build OpenSSL +echo "Building $OPENSSL" +fetch "https://www.openssl.org/source/$OPENSSL.tar.gz" $OPENSSL +build $OPENSSL ./config no-shared --prefix=$FAKEROOT/$OPENSSL + +# Build Python +echo "Building $PYTHON" +fetch "https://www.python.org/ftp/python/$2/$PYTHON.tgz" $PYTHON +default_build $PYTHON + +# Build nghttp2 +echo "Building $NGHTTP2" +fetch \ + "https://github.com/nghttp2/nghttp2/releases/download/v$4/$NGHTTP2.tar.gz" \ + $NGHTTP2 + +default_build $NGHTTP2 --enable-lib-only --prefix=$FAKEROOT/$NGHTTP2 \ + --enable-shared=no + +# Build curl +echo "Building $CURL" +export PKG_CONFIG="pkg-config --static" +export PKG_CONFIG_PATH="$FAKEROOT/$OPENSSL/lib/pkgconfig:$FAKEROOT/$NGHTTP2/lib/pkgconfig" + +fetch "https://curl.haxx.se/download/$CURL.tar.gz" $CURL +default_build $CURL --enable-shared=no + +# Now we can build kore. +unset PKG_CONFIG +unset PKG_CONFIG_PATH + +export PATH=$FAKEROOT/bin:$PATH +export OPENSSL_PATH=$FAKEROOT/$OPENSSL + +cd $ROOT + +if [ ! -d kore ]; then + git clone https://git.kore.io/kore.git +fi + +pushd kore +make clean +LDFLAGS=-L$FAKEROOT/$NGHTTP2/lib make PYTHON=1 CURL=1 ACME=1 + +mv kore $ROOT/kore.bin +popd diff --git a/misc/kore-build/build-nghttp2.sh b/misc/kore-build/build-nghttp2.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +. ./env.sh + +if [ $# -ne 1 ]; then + echo "Usage: build-nghttp2.sh [release]" + exit 1 +fi + +NAME=nghttp2-$1 + +fetch "https://github.com/nghttp2/nghttp2/releases/download/v$1/$NAME.tar.gz" $NAME + +default_build $NAME --enable-lib-only --prefix=$FAKEROOT/$NAME --enable-shared=no diff --git a/misc/kore-build/build-openssl.sh b/misc/kore-build/build-openssl.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +. ./env.sh + +if [ $# -ne 1 ]; then + echo "Usage: build-openssl.sh [release]" + exit 1 +fi + +NAME=openssl-$1 + +fetch "https://www.openssl.org/source/$NAME.tar.gz" $NAME + +build $NAME ./config no-shared --prefix=$FAKEROOT/$NAME diff --git a/misc/kore-build/build-python.sh b/misc/kore-build/build-python.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e +set -x + +. ./env.sh + +if [ $# -ne 1 ]; then + echo "Usage: build-python.sh [release]" + exit 1 +fi + +NAME=Python-$1 + +fetch "https://www.python.org/ftp/python/$1/$NAME.tgz" $NAME + +default_build $NAME diff --git a/misc/kore-build/helpers.sh b/misc/kore-build/helpers.sh @@ -0,0 +1,72 @@ +if [ -z "$ROOT" ]; then + echo "No ROOT set" + exit 1 +fi + +SOURCES=sources +BUILD=$ROOT/build +FAKEROOT=$ROOT/fakeroot + +LASTDIR=`pwd` + +pushd() { + LASTDIR=`pwd` + cd $1 +} + +popd() { + cd $LASTDIR +} + +fetch() { + url=$1 + name=$2 + + if [ -f $SOURCES/$name.tar.gz ]; then + return + fi + + curl -L "$url" > $SOURCES/$name.tar.gz +} + +default_build() { + name=$1 + shift + config=$* + + build $name ./configure --prefix=$FAKEROOT/$NAME $config +} + +build() { + name=$1 + shift + configcmd=$* + + if [ -f $BUILD/$name/.built ]; then + return + fi + + rm -rf $BUILD/$name + rm -rf $FAKEROOT/$name + + tar -zvxf $SOURCES/$name.tar.gz -C $BUILD + + pushd $BUILD/$name + mkdir -p $FAKEROOT/$name + + $configcmd + + make -j + make install + popd + + touch $BUILD/$name/.built +} + +setup() { + mkdir -p $BUILD + mkdir -p $SOURCES + mkdir -p $FAKEROOT +} + +setup