[Exherbo-dev] exlib and exheres design question

Vasiliy G Tolstov v.tolstov at selfip.ru
Sun Dec 12 12:10:07 GMT 2010


Hello. I'm try to write new www-servers/nginx exheres, based on apache
stuff from arbor. It incomplete, but now i have question - arbor profile
does not contains NGINX_HTTP_MODULES. How can i define this SUBOPTION
from my layout or my repo?


nginx.exlib
# Copyright 2010 Vasiliy Tolstov <v.tolstov at selfip.ru>
# Distributed under the terms of the GNU General Public License v2

require multilib systemd-service [ systemd_files=[ nginx.service ] ]

export_exlib_phases src_install

myexparam nginx_http_modules[]

exparam -v NGINX_HTTP_MODULES nginx_http_modules[@]

SUMMARY="A small and fast HTTP server and mail proxy server"
DESCRIPTION="A free, open-source, high-performance HTTP server and
reverse proxy, as well as an IMAP/POP3 proxy server.
It's known for its high performance, stability, rich feature set, simple
configuration, and low resource consumption.
Nginx is one of a handful of servers written to address the C10K
problem. Unlike traditional servers, Nginx doesn't rely on threads to
handle requests. Instead it uses a much more scalable event-driven
(asynchronous) architecture. This architecture uses small, but most
importantly, predictable amounts of memory under load.
Even if you don't expect to handle thousands of simultaneous requests,
you can still benefit from Nginx's high-performance and small memory
footprint. Nginx scales in all directions: from the smallest VPS all the
way up to clusters of servers."
HOMEPAGE="http://sysoev.ru/nginx"
DOWNLOADS="http://sysoev.ru/nginx/${PNV}.tar.gz"
LICENCES="BSD-2"

BUGS_TO="v.tolstov at selfip.ru"
SLOT=0
MYOPTIONS="
    baselayout
    ssl
    nginx_http_modules: ${NGINX_HTTP_MODULES[*]}
"

REMOTE_IDS="freshmeat:${PN}"

UPSTREAM_CHANGELOG="http://sysoev.ru/nginx/changes.html"
UPSTREAM_DOCUMENTATION="http://sysoev.ru/nginx/docs"

nginx_src_install() {
    default
    install_systemd_files
}

====================================================================================
nginx-0.9.2.exheres-0 
# Copyright 2010 Vasiliy Tolstov <v.tolstov at selfip.ru>
# Distributed under the terms of the GNU General Public License v2

require nginx [ \
    nginx_http_modules=[ \
        map referer rewrite proxy fastcgi memcached limit_zone limit_req
\
	empty_gif browser upstream_ip_hash perl \
    ] \
]

MYOPTIONS="addition baselayout debug flv imap pcre random-index sub zlib
    status [[ description = [ Enables stub_status module ] ]]
    webdav [[ description = [ Enables webdav support ] ]]
    nginx_http_modules:
"

PLATFORMS="~amd64 ~x86"
DEPENDENCIES="
    build+run:
        pcre? ( dev-libs/pcre )
        dev-libs/openssl [[
            description = [ newer nginx versions are very broken without
it ]
        ]]
        zlib? ( sys-libs/zlib )
        perl? ( dev-lang/perl )
    post:
        user/${PN}
        group/${PN}"

option_with_no_inverse() {
    option "${1}" && option_with ${1#!} ${2}
}

option_with_http_modules() {
    for s in "${@}"; do
        local opt=${s% *}
        local tmp=${s#* }
        local tmp=${tmp#!}
        option_with_no_inverse ${opt} http_${tmp/-/_}_module
    done
}

src_prepare() {
    sed -i 's/ make/ \\$(MAKE)/' auto/lib/perl/make
}

src_configure() {
    ./configure \
        --prefix=/usr \
        --conf-path=/etc/${PN}/${PN}.conf \
        --http-log-path=/var/log/${PN}/access_log \
        --error-log-path=/var/log/${PN}/error_log \
        --pid-path=/var/run/${PN}.pid \
        --http-client-body-temp-path=/var/tmp/${PN}/client \
        --http-proxy-temp-path=/var/tmp/${PN}/proxy \
        --http-fastcgi-temp-path=/var/tmp/${PN}/fastcgi \
        --with-md5-asm --with-sha1-asm \
        --with-ld-opt="${LDFLAGS}" \
        $(option_with_http_modules addition !fastcgi flv "!zlib gzip"
pcre perl \
            "status stub-status" "webdav dav" sub random-index) \
        $(option_with_no_inverse debug) \
        $(option_with_no_inverse imap) \
        || die "configure failed"
}

src_compile() {
    emake CC="${CC}" LD="\${CC}" OTHERLDFLAGS="${LDFLAGS}"
}

src_install() {
    keepdir /var/log/${PN} /var/tmp/${PN}/{client,proxy,fastcgi}

    dosbin objs/nginx
    option baselayout && newinitd "${FILES}"/nginx.initd nginx

    dobin "${FILES}"/nginxctl

    insinto /etc/nginx
#    doins "${FILES}"/nginx.conf
    doins conf/*
    dodoc CHANGES{,.ru} README

    option perl && emake -C objs/src/http/modules/perl install
DESTDIR="${IMAGE}"
}

pkg_postinst() {
    # FIXME porting install_cert
    ewarn "You should generate your certificates and put it
in /etc/ssl/${PN}/"
}






More information about the Exherbo-dev mailing list