aboutsummaryrefslogtreecommitdiffstats
path: root/www/nginx/Makefile
blob: aa2925fdfc6e344a92ec406ad518a16a2af207c4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# New ports collection makefile for:    nginx
# Date created:             11 Oct 2004
# Whom:                 osa
#
# $FreeBSD$
#

PORTNAME=   nginx
PORTVERSION=    0.1.4
CATEGORIES= www
MASTER_SITES=   http://sysoev.ru/nginx/

MAINTAINER= osa@FreeBSD.org
COMMENT=    Robust and small WWW server

VARDIR?=    ${DESTDIR}/var
LOGDIR?=    ${VARDIR}/log
RUNDIR?=    ${VARDIR}/run
HTTP_PORT?= 80

USE_REINPLACE=  yes
USE_RC_SUBR=    yes
HAS_CONFIGURE=  yes
CONFIGURE_ENV+= LINK="${CC}"
CONFIGURE_ARGS= --prefix=${PREFIX}/etc/nginx \
        --with-cc-opt="-I ${LOCALBASE}/include" \
        --with-ld-opt="-L ${LOCALBASE}/lib" \
        --conf-path=${PREFIX}/etc/nginx/nginx.conf \
        --sbin-path=${PREFIX}/sbin/nginx \
        --pid-path=${RUNDIR}/nginx.pid \
        --http-log-path=${LOGDIR}/nginx-access.log \
        --error-log-path=${LOGDIR}/nginx-error.log \
        --user=${WWWOWN} --group=${WWWGRP}

.if defined(WITHOUT_HTTP_REWRITE_MODULE) || defined(WITHOUT_PCRE)
PKGNAMESUFFIX=  -nopcre
CONFIGURE_ARGS+=--without-http_rewrite_module \
        --without-pcre
.else
LIB_DEPENDS=    pcre.0:${PORTSDIR}/devel/pcre
.endif

PLIST_FILES+=   etc/nginx/koi-win \
        etc/rc.d/nginx.sh \
        sbin/nginx

RC_SCRIPTS_SUB=PREFIX=${PREFIX} RC_SUBR=${RC_SUBR}

post-extract:
    @${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
        ${FILESDIR}/nginx.sh > ${WRKSRC}/nginx.sh

post-patch:
    @${REINPLACE_CMD} 's!%%HTTP_PORT%%!${HTTP_PORT}!; \
        s!%%PREFIX%%!${PREFIX}!' \
        ${WRKSRC}/conf/nginx.conf

do-build:
    @cd ${WRKSRC} && ${MAKE}

do-install:
    ${MKDIR} ${PREFIX}/etc/nginx ${PREFIX}/www/nginx-dist
    ${INSTALL_SCRIPT} ${WRKSRC}/nginx.sh ${PREFIX}/etc/rc.d
    ${INSTALL_PROGRAM} ${WRKSRC}/objs/nginx ${PREFIX}/sbin
    ${INSTALL_DATA} ${WRKSRC}/conf/koi-win ${PREFIX}/etc/nginx
.for i in mime.types nginx.conf
    [ -f ${PREFIX}/etc/nginx/${i} ] || \
        ${INSTALL_DATA} ${WRKSRC}/conf/${i} ${PREFIX}/etc/nginx
    ${INSTALL_DATA} ${WRKSRC}/conf/${i} ${PREFIX}/etc/nginx/${i}-dist
.endfor
    ${INSTALL_DATA} ${WRKSRC}/html/index.html ${PREFIX}/www/nginx-dist
    ${ECHO_CMD} "" >>${PREFIX}/www/nginx-dist/EXAMPLE_DIRECTORY-DONT_ADD_OR_TOUCH_ANYTHING
    ${LN} -sf ${PREFIX}/www/nginx-dist ${PREFIX}/www/nginx

.include <bsd.port.mk>