-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.sh
executable file
·34 lines (28 loc) · 965 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
set -o nounset
set -o errexit
set -e
# build go shared library
ROOT_DIR=`pwd`
BUILD_DIR=$ROOT_DIR/build
mkdir -p $BUILD_DIR
cd src/ngx_http_set_backend
echo "building shared library"
CGO_CFLAGS="-I ./vendor/ngx_devel_kit-$NDK_VERSION/src" go build -o $BUILD_DIR/ngx_http_set_backend_module.a -buildmode=c-shared ngx_http_set_backend_module.go
# build nginx
cd vendor/nginx-$NGINX_VERSION
CFLAGS="-g -O0" ./configure \
--with-debug \
--prefix=$BUILD_DIR/nginx \
--conf-path=conf/nginx.conf \
--error-log-path=logs/error.log \
--http-log-path=logs/access.log \
--add-module=../ngx_devel_kit-$NDK_VERSION \
--add-module=../../
make
make install
ln -sf $ROOT_DIR/nginx.conf $BUILD_DIR/nginx/conf/nginx.conf
# build backend
echo "building backend"
cd $ROOT_DIR/src/backend
go build -o $BUILD_DIR/backend