1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-05 19:47:09 +01:00
build/pkg/nginx/build
David Oberhollenzer 8fa44569d8 cleanup: remove deploy directory argument from package command
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-06 10:03:12 +01:00

107 lines
3 KiB
Text
Executable file

VERSION="1.15.8"
SRCDIR="nginx-${VERSION}"
TARBALL="${SRCDIR}.tar.gz"
URL="https://nginx.org/download"
SHA256SUM="a8bdafbca87eb99813ae4fcac1ad0875bf725ce19eb265d28268c309b2b40787"
DEPENDS="zlib-dev openssl-dev pcre-dev crt-dev"
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"
find -H "$PKGDEPLOYDIR/srv/www" -type d \
-printf "dir %p 0%m 0 0\\n" | tail -n +2 |\
sed "s#$PKGDEPLOYDIR/##g" >> "$PKGDEPLOYDIR/nginx.files"
find -H "$PKGDEPLOYDIR/srv/www" -type l \
-printf "slink %p 0%m 0 0 %l\\n" | \
sed "s#$PKGDEPLOYDIR/##g" >> "$PKGDEPLOYDIR/nginx.files"
find -H "$PKGDEPLOYDIR/srv/www" -type f \
-printf "file %p 0%m 0 0\\n" |\
sed "s#$PKGDEPLOYDIR/##g" >> "$PKGDEPLOYDIR/nginx.files"
fi
cat_file_override "nginx.conf" > "$PKGDEPLOYDIR/etc/nginx/nginx.conf"
}
check_update() {
curl --silent -L "$URL" | grep -o ">nginx-[0-9.]*tar.gz<" | \
sed 's/>nginx-//g' | sed 's/.tar.gz<//g' | \
verson_find_greatest "$VERSION"
}