SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "nginx-extras"

# SliTaz package receipt.

PACKAGE="nginx-extras"
VERSION="1.21.6"
CATEGORY="network"
SHORT_DESC="Asynchronous HTTP server designed for heavy loads and mail proxy."
MAINTAINER="pascal.bellard@slitaz.org"
LICENSE="BSD"
WEB_SITE="https://nginx.org/"

SOURCE="nginx"
TARBALL="$SOURCE-$VERSION.tar.gz"
WGET_URL="${WEB_SITE}download//$TARBALL"

PROVIDE="lighttpd"
CONFLICT="nginx"

SUGGESTED="php python"
DEPENDS="geoip libgd libxslt openssl pcre perl zlib"
BUILD_DEPENDS="geoip-dev libgd-dev libxslt-dev openssl-dev pcre-dev
    tiff zlib-dev"

CONFIG_FILES="/etc/nginx"

# What is the latest version available today?
current_version()
{
    wget -O - ${WGET_URL%/*} 2>/dev/null | \
    sed "/latest/d;/nginx-/!d;/tar/!d;s|.*nginx-\\(.*\\).tar.*\".*|\\1|" | sort -Vr | sed q
}

# Rules to configure and make the package.
compile_rules()
{
    # 1.16.0 invalid:
    #    --with-http_spdy_module

    ./configure                            \
        --prefix=/usr                        \
        --conf-path=/etc/nginx/nginx.conf            \
        --pid-path=/var/run/nginx.pid                \
        --lock-path=/var/lock/nginx.lock            \
        --error-log-path=/var/log/nginx/error.log        \
        --http-log-path=/var/log/nginx/access.log        \
        --http-client-body-temp-path=/var/spool/nginx/body    \
        --http-proxy-temp-path=/var/spool/nginx/proxy        \
        --http-fastcgi-temp-path=/var/spool/nginx/fastcgi    \
        --with-http_ssl_module                    \
        --with-http_realip_module                \
        --with-http_addition_module                \
        --with-http_xslt_module                    \
        --with-http_image_filter_module                \
        --with-http_geoip_module                \
        --with-http_sub_module                    \
        --with-http_dav_module                    \
        --with-http_flv_module                    \
        --with-http_mp4_module                    \
        --with-http_gunzip_module                \
        --with-http_gzip_static_module                \
        --with-http_auth_request_module                \
        --with-http_random_index_module                \
        --with-http_secure_link_module                \
        --with-http_degradation_module                \
        --with-http_stub_status_module                \
        --with-mail                        \
        --with-mail_ssl_module                    \
        --with-stream                        \
        --with-stream_ssl_module                \
        --with-pcre                        \
        --with-pcre-jit                        \
        --with-http_perl_module                    \
        --user=80                        \
        --group=80 &&
    make &&
    make install DESTDIR=$DESTDIR

    # not yet available - perftools dep lib
    #--with-google_perftools_module \
}

# Rules to gen a SliTaz package suitable for Tazpkg.
# On SliTaz Lighttpd runs as user/group : www/www or 80/80.
genpkg_rules()
{
    cp -a $install/*    $fs
    rm -rf            $fs/usr/html
    cp -a stuff/*        $fs
    sed -i 's/#user  nobody;/user  www;/' \
                $fs/etc/nginx/nginx.conf
}

# Pre and post install commands for Tazpkg.
# We stop the server by default in case of upgarde.
pre_install()
{
    [ -f /etc/init.d/$SOURCE ] &&
    /etc/init.d/$SOURCE stop

    # Backup configuration file.
    if [ -d "$1/$CONFIG_FILES" ]
      then
        cp -a "$1/$CONFIG_FILES" "$1/$CONFIG_FILES.bak"
    fi
}

post_install()
{
    mkdir -p /var/spool/nginx

    # Restore original configuration.
    if [ -d "$1/$CONFIG_FILES.bak" ]
      then
        rm -rf "$1/$CONFIG_FILES"
        mv "$1/$CONFIG_FILES.bak" "$1/$CONFIG_FILES"
    fi

    # Just in case.
    chown www.www "$1/var/log/$SOURCE"
    if [ -z "$1" ]
      then
        for i in apache lighttpd
          do
            [ -f /etc/init.d/$i ] && /etc/init.d/$i stop
          done
        /etc/init.d/$SOURCE start
    fi

    :
}
6025 packages and 203154 files in current database (Thu Apr 25 06:17:47 2024)