1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-24 20:10:42 +01:00
build/pkg/nginx/build
David Oberhollenzer 21342dee8e Cleanup: move path filtering into pkg_scan_dir
Instead of prefixing the search path with $PKGDEPLOYDIR and then
stripping the prefix off again every single time, do that inside
the pkg_scan_dir function.

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-04-16 15:16:58 +02:00

91 lines
2.5 KiB
Text
Executable file

VERSION="1.17.9"
SRCDIR="nginx-${VERSION}"
TARBALL="${SRCDIR}.tar.gz"
URL="https://nginx.org/download"
SHA256SUM="7dd65d405c753c41b7fdab9415cfb4bdbaf093ec6d9f7432072d52cb7bcbb689"
DEPENDS="zlib-dev openssl-dev pcre-dev toolchain"
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 "srv/www" >> "$PKGDEPLOYDIR/nginx.files"
fi
cat_file_override "nginx.conf" > "$PKGDEPLOYDIR/etc/nginx/nginx.conf"
}
check_update() {
check_update_simple "$URL" "nginx" "tar.gz"
}