mirror of
https://github.com/pygos/build.git
synced 2024-11-14 07:27:10 +01:00
105 lines
2.9 KiB
Text
Executable file
105 lines
2.9 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 DEPLOY="$2"
|
|
|
|
local wwwroot=$(file_path_override "wwwroot")
|
|
|
|
make DESTDIR="$DEPLOY" install
|
|
cp $SCRIPTDIR/pkg/$PKGNAME/*.{files,desc} "$DEPLOY"
|
|
|
|
if [ ! -z "$wwwroot" ] && [ -d "$wwwroot" ]; then
|
|
mkdir -p "$DEPLOY/srv"
|
|
cp -r "$wwwroot" "$DEPLOY/srv/www"
|
|
|
|
echo "dir srv 0755 0 0" >> "$DEPLOY/nginx.files"
|
|
echo "dir srv/www 0755 0 0" >> "$DEPLOY/nginx.files"
|
|
|
|
find -H "$DEPLOY/srv/www" -type d -printf "dir %p 0%m 0 0\\n" |\
|
|
tail -n +2 | sed "s#$DEPLOY/##g" >> "$DEPLOY/nginx.files"
|
|
|
|
find -H "$DEPLOY/srv/www" -type l -printf "slink %p 0%m 0 0 %l\\n" |\
|
|
sed "s#$DEPLOY/##g" >> "$DEPLOY/nginx.files"
|
|
|
|
find -H "$DEPLOY/srv/www" -type f -printf "file %p 0%m 0 0\\n" |\
|
|
sed "s#$DEPLOY/##g" >> "$DEPLOY/nginx.files"
|
|
fi
|
|
|
|
cat_file_override "nginx.conf" > "$DEPLOY/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"
|
|
}
|