aboutsummaryrefslogtreecommitdiffstats
path: root/www/moinmoin/Makefile
blob: 25f3d7ae2c2197ccf9460a8ae0d123aa453728d4 (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
# New ports collection makefile for:    moinmoin
# Date created:             18 September 2001
# Whom:                 Hye-Shik Chang <perky@python.or.kr>
#
# $FreeBSD$
#

PORTNAME=   moinmoin
PORTVERSION=    1.0
CATEGORIES= www python
MASTER_SITES=   ${MASTER_SITE_SOURCEFORGE} \
        http://twiki.org/p/pub/TWiki/TWikiDrawPlugin/:twiki \
        http://fallin.lv/distfiles/:twiki
MASTER_SITE_SUBDIR= moin
DISTNAME=   moin-${PORTVERSION}
DISTFILES=  ${DISTNAME}.tar.gz twikidraw.jar:twiki
EXTRACT_ONLY=   ${DISTNAME}.tar.gz

MAINTAINER= perky@FreeBSD.org

USE_PYTHON= yes
USE_PYDISTUTILS=    yes
PLIST_SUB+= PYTHON_SITELIB=${PYTHON_SITELIBDIR:S|^${LOCALBASE}/||} \
        CGIUSER=${CGIUSER} CGIROOT=${CGIROOT}

CGIUSER=    moinmoin
CGIUSERID?= 192
CGIROOT=    ${PREFIX}/www/cgi-bin
HTDOCSROOT= ${PREFIX}/www/data
MOINDIR=    ${PREFIX}/share/moin

post-patch:
    @# Tweak configuration
    ${SED} -e 's|^url_prefix =.*$$|url_prefix="/moin"|g' \
        ${WRKSRC}/wiki/cgi-bin/moin_config.py > \
        ${WRKSRC}/wiki/cgi-bin/moin_config.py.default

post-build:
    @# Compile setuid wrapper
    ${CC} ${CFLAGS} -o ${WRKDIR}/moin \
        -DPYTHON_PATH='"${PYTHON_CMD}"' \
        -DMOIN_PREFIX='"${MOINDIR}"' \
        ${FILESDIR}/wrapper.c

pre-install:
    PKG_PREFIX=${PREFIX} INST_UID="${CGIUSERID}" \
    ${SH} pkg-install ${PKGNAME} PRE-INSTALL

post-install:
    ${INSTALL_DATA} ${DISTDIR}/twikidraw.jar ${MOINDIR}/htdocs/applets/TWikiDrawPlugin/

    @# Install Wrapper
    ${MKDIR} ${CGIROOT}
    ${INSTALL_PROGRAM} ${WRKDIR}/moin ${CGIROOT}/
    ${CHMOD} 4555 ${CGIROOT}/moin

    @# Arrange Permissions
    ${MKDIR} ${MOINDIR}/data/backup
    ${CHMOD} -R u+rw,go-wxs ${MOINDIR}/data
    ${CHOWN} -R ${CGIUSER}:${CGIUSER} ${CGIROOT}/moin ${MOINDIR}/data

    @# Create symbolic links and copy defaults
    ${TEST} -f ${MOINDIR}/cgi-bin/moin_config.py || \
        ${CP} ${MOINDIR}/cgi-bin/moin_config.py.default \
            ${MOINDIR}/cgi-bin/moin_config.py
    ${TEST} -d ${MOINDIR}/data/text || \
        ${LN} -sf ${MOINDIR}/data/text.default ${MOINDIR}/data/text
    -${MKDIR} ${HTDOCSROOT}
    -${LN} -sf ${MOINDIR}/htdocs ${HTDOCSROOT}/moin

    @${CAT} ${PKGMESSAGE}

.include <bsd.port.mk>