1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-25 04:20:41 +01:00
build/pkg/nginx/build
David Oberhollenzer f2928212e9 Bump nginx version
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-08-03 21:36:54 +02:00

96 lines
2.5 KiB
Text
Executable file

VERSION="1.17.2"
SRCDIR="nginx-${VERSION}"
TARBALL="${SRCDIR}.tar.gz"
URL="https://nginx.org/download"
SHA256SUM="5e333687464e1d6dfb86fc22d653b99a6798dda40093b33186eeeec5a97e69ec"
DEPENDS="zlib-dev openssl-dev pcre-dev toolchain"
prepare() {
apply_patches
}
build() {
cp -r ${1}/* ${PKGBUILDDIR}
local cflags="-O2 -Os"
local ldflags=""
if [ "x$TC_HARDENING" = "xyes" ]; then
cflags="$cflags -fstack-protector-all"
ldflags="$ldflags -z noexecstack -z relro -z now"
fi
./configure --prefix="" --sbin-path=/bin/nginx \
--modules-path=/lib/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=stderr \
--http-log-path=/dev/null \
--pid-path=/run/nginx.pid \
--lock-path=/run/nginx.lock \
--user=nginx --group=nginx \
--crossbuild=${TARGET} \
--with-cc=${TCDIR}/bin/${TARGET}-gcc \
--with-cpp=${TCDIR}/bin/${TARGET}-cpp \
--with-cc-opt="$cflags" --with-ld-opt="$ldflags" \
--with-poll_module --without-select_module \
--with-threads --with-http_ssl_module \
--with-http_sub_module --with-http_gunzip_module \
--with-http_gzip_static_module --with-http_slice_module
if [ "x$CPU_IS_64BIT" == "xyes" ]; then
cat <<_EOF >> objs/ngx_auto_config.h
#define NGX_PTR_SIZE (8)
#define NGX_SIZE_T_SIZE (8)
#define NGX_SIZE_T_LEN (sizeof("-9223372036854775807") - 1)
#define NGX_MAX_SIZE_T_VALUE ULONG_MAX
_EOF
else
cat <<_EOF >> objs/ngx_auto_config.h
#define NGX_PTR_SIZE (4)
#define NGX_SIZE_T_SIZE (4)
#define NGX_SIZE_T_LEN (sizeof("-2147483647") - 1)
#define NGX_MAX_SIZE_T_VALUE UINT_MAX
_EOF
fi
cat <<_EOF >> objs/ngx_auto_config.h
#define NGX_SIG_ATOMIC_T_SIZE (4)
#define NGX_TIME_T_SIZE (8)
#define NGX_TIME_T_LEN (sizeof("-9223372036854775807") - 1)
#define NGX_MAX_TIME_T_VALUE LONG_MAX
#define NGX_OFF_T_LEN (sizeof("-9223372036854775807") - 1)
#define NGX_MAX_OFF_T_VALUE LONG_MAX
_EOF
make -j $NUMJOBS
}
deploy() {
local SOURCE="$1"
local wwwroot=$(file_path_override "wwwroot")
make DESTDIR="$PKGDEPLOYDIR" install
cp $SCRIPTDIR/pkg/$PKGNAME/*.{files,desc} "$PKGDEPLOYDIR"
if [ ! -z "$wwwroot" ] && [ -d "$wwwroot" ]; then
mkdir -p "$PKGDEPLOYDIR/srv"
cp -r "$wwwroot" "$PKGDEPLOYDIR/srv/www"
echo "dir srv 0755 0 0" >> "$PKGDEPLOYDIR/nginx.files"
echo "dir srv/www 0755 0 0" >> "$PKGDEPLOYDIR/nginx.files"
pkg_scan_dir "$PKGDEPLOYDIR/srv/www" |\
sed "s#$PKGDEPLOYDIR/##g" >> "$PKGDEPLOYDIR/nginx.files"
fi
cat_file_override "nginx.conf" > "$PKGDEPLOYDIR/etc/nginx/nginx.conf"
}
check_update() {
check_update_simple "$URL" "nginx" "tar.gz"
}