termux-packages/packages/nginx/build.sh

91 lines
3.2 KiB
Bash
Raw Normal View History

2017-03-20 21:00:48 +01:00
TERMUX_PKG_HOMEPAGE=https://www.nginx.org
TERMUX_PKG_DESCRIPTION="Lightweight HTTP server"
TERMUX_PKG_LICENSE="BSD 2-Clause"
2018-12-28 00:51:57 +01:00
TERMUX_PKG_VERSION=1.15.8
TERMUX_PKG_SHA256=a8bdafbca87eb99813ae4fcac1ad0875bf725ce19eb265d28268c309b2b40787
2017-03-20 21:00:48 +01:00
TERMUX_PKG_SRCURL=http://nginx.org/download/nginx-$TERMUX_PKG_VERSION.tar.gz
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_DEPENDS="libandroid-glob, libcrypt, pcre, openssl"
TERMUX_PKG_CONFFILES="etc/nginx/fastcgi.conf etc/nginx/fastcgi_params etc/nginx/koi-win etc/nginx/koi-utf
etc/nginx/mime.types etc/nginx/nginx.conf etc/nginx/scgi_params etc/nginx/uwsgi_params etc/nginx/win-utf"
TERMUX_PKG_MAINTAINER="Vishal Biswas @vishalbiswas"
termux_step_pre_configure() {
2017-03-20 21:00:48 +01:00
CPPFLAGS="$CPPFLAGS -DIOV_MAX=1024"
LDFLAGS="$LDFLAGS -landroid-glob"
# remove config from previouse installs
rm -rf "$TERMUX_PREFIX/etc/nginx"
}
termux_step_configure() {
2017-03-20 21:00:48 +01:00
DEBUG_FLAG=""
Add fixes for debug builds (#2296) * build-package.sh: add possibility for debug patches and TERMUX_PKG_HAS_DEBUG Setting TERMUX_PKG_HAS_DEBUG=no disables attempt to build debug build of package. Useful for example if a debug build doesn't make sense, as for python-packages and texlive. * aapt: skip D_FORTIFY_SOURCE=2 for libandroid-cutils when doing debug build * lftp: skip D_FORTIFY_SOURCE=2 for debug build * libflac: don't use -g3 for debug build Configure script removes it otherwise. * nano: skip -D_FORTIFY_SOURCE=2 for debug build * vifm: skip -D_FORTIFY_SOURCE=2 for debug build * mc: skip -D_FORTIFY_SOURCE=2 for debug build * dropbear: add __attribute__((overloadable)) to XMEMSET and XMEMCPY if debug * gdb: add __attribute__((overloadable)) to strchr if debug * gnuit: add __attribute__((overloadable)) to strchr and strcpy if debug * gperf: add __attribute__((overloadable)) to strlen if debug * inetutils: add __attribute__((overloadable)) to strrchr and strchr if debug * readline: add __attribute__((overloadable)) to strchr if debug * tsocks: add __attribute__((overloadable)) to poll if debug * units: add __attribute__((overloadable)) to strchr if debug * liblua: fix bug in loslib.c that emerged in debug build Use strncpy instead of strcpy. Original error message: loslib.c:169:3: error: 'strcpy' called with string bigger than buffer lua_tmpnam(buff, err); ^ loslib.c:122:37: note: expanded from macro 'lua_tmpnam' strcpy(b, LUA_TMPNAMTEMPLATE); \ ^ * alpine: include our getpass.h in imap's mtest.c to declare getpass Debug build complained about the previous implicit declaration. * nginx: use --with-debug instead of --debug * cboard: skip -D_FORTIFY_SOURCE=2 for debug build * gettext: add __attribute__((overloadable)) to getcwd if debug * oathtool: skip -D_FORTIFY_SOURCE=2 for debug build * php: add __attribute__((overloadable)) to strlcpy and strlcat if debug * expect: add __attribute__((overloadable)) to strchr if debug * texlive: set TERMUX_PKG_HAS_DEBUG=no * asciinema: set TERMUX_PKG_HAS_DEBUG=no * libllvm: set TERMUX_PKG_HAS_DEBUG=no Debug build fails with: home/builder/.termux-build/libllvm/src/lib/Support/Unix/Path.inc:740:19: error: no matching function for call to 'RetryAfterSignal' if ((ResultFD = sys::RetryAfterSignal(-1, open, P.begin(), OpenFlags)) < 0) * build-package.sh: set TERMUX_PKG_REPLACES=package if debug build Hopefully allows us to install debug packages without breaking dependecies. Should be looked over and be made more similar to how debian does this in any case * Update build.sh
2018-06-13 02:12:36 +02:00
test -n "$TERMUX_DEBUG" && DEBUG_FLAG="--with-debug"
2017-03-20 21:00:48 +01:00
./configure \
--prefix=$TERMUX_PREFIX \
--crossbuild="Linux:3.16.1:$TERMUX_ARCH" \
--crossfile="$TERMUX_PKG_SRCDIR/auto/cross/Android" \
--with-cc=$CC \
--with-cpp=$CPP \
--with-cc-opt="$CPPFLAGS $CFLAGS" \
--with-ld-opt="$LDFLAGS" \
--with-pcre \
--with-pcre-jit \
--with-threads \
--with-ipv6 \
--sbin-path="$TERMUX_PREFIX/bin/nginx" \
--conf-path="$TERMUX_PREFIX/etc/nginx/nginx.conf" \
--http-log-path="$TERMUX_PREFIX/var/log/nginx/access.log" \
--pid-path="$TERMUX_PREFIX/tmp/nginx.pid" \
--lock-path="$TERMUX_PREFIX/tmp/nginx.lock" \
--error-log-path="$TERMUX_PREFIX/var/log/nginx/error.log" \
--http-client-body-temp-path="$TERMUX_PREFIX/var/lib/nginx/client-body" \
--http-proxy-temp-path="$TERMUX_PREFIX/var/lib/nginx/proxy" \
--http-fastcgi-temp-path="$TERMUX_PREFIX/var/lib/nginx/fastcgi" \
--http-scgi-temp-path="$TERMUX_PREFIX/var/lib/nginx/scgi" \
--http-uwsgi-temp-path="$TERMUX_PREFIX/var/lib/nginx/uwsgi" \
--with-http_auth_request_module \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_gunzip_module \
$DEBUG_FLAG
}
termux_step_post_make_install() {
2017-03-20 21:00:48 +01:00
# many parts are taken directly from Arch PKGBUILD
# https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/nginx
# set default port to 8080
sed -i "s| 80;| 8080;|" "$TERMUX_PREFIX/etc/nginx/nginx.conf"
cp conf/mime.types "$TERMUX_PREFIX/etc/nginx/"
rm "$TERMUX_PREFIX"/etc/nginx/*.default
# move default html dir
sed -e "44s|html|$TERMUX_PREFIX/share/nginx/html|" \
-e "54s|html|$TERMUX_PREFIX/share/nginx/html|" \
-i "$TERMUX_PREFIX/etc/nginx/nginx.conf"
rm -rf "$TERMUX_PREFIX/share/nginx"
mkdir -p "$TERMUX_PREFIX/share/nginx"
mv "$TERMUX_PREFIX/html/" "$TERMUX_PREFIX/share/nginx"
# install vim contrib
for i in ftdetect indent syntax; do
install -Dm644 "$TERMUX_PKG_SRCDIR/contrib/vim/${i}/nginx.vim" \
"$TERMUX_PREFIX/share/vim/vimfiles/${i}/nginx.vim"
done
# install man pages
mkdir -p "$TERMUX_PREFIX/share/man/man8"
cp "$TERMUX_PKG_SRCDIR/man/nginx.8" "$TERMUX_PREFIX/share/man/man8/"
}
termux_step_post_massage() {
2017-03-20 21:00:48 +01:00
# keep empty dirs which were deleted in massage
mkdir -p "$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/var/log/nginx"
for dir in client-body proxy fastcgi scgi uwsgi; do
mkdir -p "$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/var/lib/nginx/$dir"
done
}