#!/bin/bash . ./scripts/colors.sh . ./scripts/funcs.sh . ./scripts/config.sh nginx_build() { pkgname=nginx pkgver=1.29.5 printf "$GREEN** Building and installing ${pkgname}\n$RESET" [ -d $build/${pkgname} ] && return 0 mkdir $build/${pkgname} cd $build/${pkgname} tar -xvf $root/downloads/${pkgname}-${pkgver}.tar.gz check $? "Extract ${pkgname}" cd ${pkgname}-${pkgver} ./configure \ --prefix=/opt/nginx \ --without-pcre \ --without-http_rewrite_module \ --with-cc-opt="-DNGX_HAVE_EPOLLEXCLUSIVE=0 -DNGX_HAVE_STRERRORDESC_NP=0 -DNGX_HAVE_IP_BIND_ADDRESS_NO_PORT=0 -DNGX_HAVE_GNU_CRYPT_R=0" check $? "Configure ${pkgname}" sed -i "/CC =/s/.*/CC=$CROSS_COMPILE-gcc/" objs/Makefile sed -i "/CPP =/s/.*/CPP=$CROSS_COMPILE-gcc -E/" objs/Makefile make $makeflags check $? "Build ${pkgname}" make DESTDIR=$rootfspath install check $? "Installing to rootfs ${pkgname}" cat << EOF > $rootfspath/etc/finit.d/available/nginx.conf run [S] mkdir -p /run/nginx /var/log/nginx /var/cache/nginx run [S] chown -R nginx:nginx /run/nginx 2>/dev/null || chown -R nobody:nobody /run/nginx 2>/dev/null || true service [2345] \\ pid:/run/nginx/nginx.pid \\ log:/opt/nginx/logs/error.log \\ /opt/nginx/sbin/nginx -g "daemon off; pid /run/nginx/nginx.pid;" -c /opt/nginx/conf/nginx.conf \\ -- Nginx Web Server EOF [ -f $rootfspath/opt/nginx/sbin/nginx.old ] && rm -v $rootfspath/opt/nginx/sbin/nginx.old }