2019-07-07 16:44:16 +02:00
|
|
|
VERSION="1.17.1"
|
2018-10-03 16:29:25 +02:00
|
|
|
SRCDIR="nginx-${VERSION}"
|
|
|
|
TARBALL="${SRCDIR}.tar.gz"
|
|
|
|
URL="https://nginx.org/download"
|
2019-07-07 16:44:16 +02:00
|
|
|
SHA256SUM="6f1825b4514e601579986035783769c456b888d3facbab78881ed9b58467e73e"
|
2019-03-30 23:28:30 +01:00
|
|
|
DEPENDS="zlib-dev openssl-dev pcre-dev toolchain"
|
2018-10-03 16:29:25 +02:00
|
|
|
|
|
|
|
prepare() {
|
|
|
|
apply_patches
|
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
|
|
|
cp -r ${1}/* ${PKGBUILDDIR}
|
|
|
|
|
2018-10-20 19:27:23 +02:00
|
|
|
local cflags="-O2 -Os"
|
2018-10-19 13:02:06 +02:00
|
|
|
local ldflags=""
|
|
|
|
|
|
|
|
if [ "x$TC_HARDENING" = "xyes" ]; then
|
2018-10-20 19:27:23 +02:00
|
|
|
cflags="$cflags -fstack-protector-all"
|
|
|
|
ldflags="$ldflags -z noexecstack -z relro -z now"
|
2018-10-19 13:02:06 +02:00
|
|
|
fi
|
2018-10-14 18:47:20 +02:00
|
|
|
|
2018-10-03 16:29:25 +02:00
|
|
|
./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 \
|
2018-10-07 16:35:05 +02:00
|
|
|
--user=nginx --group=nginx \
|
2018-10-03 16:29:25 +02:00
|
|
|
--crossbuild=${TARGET} \
|
|
|
|
--with-cc=${TCDIR}/bin/${TARGET}-gcc \
|
|
|
|
--with-cpp=${TCDIR}/bin/${TARGET}-cpp \
|
2018-10-14 18:47:20 +02:00
|
|
|
--with-cc-opt="$cflags" --with-ld-opt="$ldflags" \
|
2018-10-03 16:29:25 +02:00
|
|
|
--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")
|
|
|
|
|
2019-03-06 10:03:12 +01:00
|
|
|
make DESTDIR="$PKGDEPLOYDIR" install
|
|
|
|
cp $SCRIPTDIR/pkg/$PKGNAME/*.{files,desc} "$PKGDEPLOYDIR"
|
2018-10-03 16:29:25 +02:00
|
|
|
|
|
|
|
if [ ! -z "$wwwroot" ] && [ -d "$wwwroot" ]; then
|
2019-03-06 10:03:12 +01:00
|
|
|
mkdir -p "$PKGDEPLOYDIR/srv"
|
|
|
|
cp -r "$wwwroot" "$PKGDEPLOYDIR/srv/www"
|
2018-10-03 16:29:25 +02:00
|
|
|
|
2019-03-06 10:03:12 +01:00
|
|
|
echo "dir srv 0755 0 0" >> "$PKGDEPLOYDIR/nginx.files"
|
|
|
|
echo "dir srv/www 0755 0 0" >> "$PKGDEPLOYDIR/nginx.files"
|
2018-10-03 16:29:25 +02:00
|
|
|
|
2019-03-30 16:18:11 +01:00
|
|
|
pkg_scan_dir "$PKGDEPLOYDIR/srv/www" |\
|
2019-03-06 10:03:12 +01:00
|
|
|
sed "s#$PKGDEPLOYDIR/##g" >> "$PKGDEPLOYDIR/nginx.files"
|
2018-10-03 16:29:25 +02:00
|
|
|
fi
|
|
|
|
|
2019-03-06 10:03:12 +01:00
|
|
|
cat_file_override "nginx.conf" > "$PKGDEPLOYDIR/etc/nginx/nginx.conf"
|
2018-10-03 16:29:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
check_update() {
|
2019-07-07 16:17:16 +02:00
|
|
|
check_update_simple "$URL" "nginx" "tar.gz"
|
2018-10-03 16:29:25 +02:00
|
|
|
}
|