aboutsummaryrefslogtreecommitdiffstats
path: root/security/stunnel/Makefile
blob: df0b8be5ecd795f45725b9b267b4ef3b0d89ccc6 (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
# New ports collection makefile for:    stunnel
# Date created:     Mon Jan 11 11:53:54 EET 1999
# Whom:         Martti Kuparinen <martti.kuparinen@ericsson.com>
#
# $FreeBSD$
#

PORTNAME=   stunnel
PORTVERSION=    4.00
CATEGORIES= security
MASTER_SITES=   http://www.stunnel.org/download/stunnel/src/ \
        ftp://stunnel.mirt.net/stunnel/ \
        ftp://opensores.thebunker.net/pub/mirrors/stunnel/ \
        ftp://ftp.cryptoarchive.net/pub/cryptoarchive/mirrors/opensores.thebunker.net/pub/mirrors/stunnel/

MAINTAINER= roam@FreeBSD.org

USE_OPENSSL=    YES
USE_REINPLACE=  YES
IS_INTERACTIVE= YES # prompts for information while generating certificate

GNU_CONFIGURE=  yes
CONFIGURE_ARGS= --localstatedir=/var/tmp --with-pem-dir=${PEM_DIR}

MAN8=       stunnel.8

PEM_DIR?=   ${PREFIX}/etc

post-patch:
# place files under /var/tmp so that this can be run by an unprivileged user
# user stunnel and group stunnel
    @${REINPLACE_CMD} -E -e 's|\@prefix\@/var/run/stunnel/|/var/tmp/stunnel|; \
        s|nobody|stunnel|;s|nogroup|stunnel|' \
        ${WRKSRC}/tools/stunnel.conf-sample.in
    @${REINPLACE_CMD} -E -e 's|localstatedir/run/stunnel.pid|localstatedir/stunnel.pid|' \
        ${WRKSRC}/configure.ac ${WRKSRC}/configure
.ifdef(NOPORTDOCS)
    @${REINPLACE_CMD} -E -e 's/ install-docDATA/ /; s/^(SUBDIRS.+)doc/\1/' \
        ${WRKSRC}/Makefile.in
.endif

post-install:
    @${SED} "s+!!PREFIX!!+${PREFIX}+g" < ${FILESDIR}/stunnel.sh \
        > ${PREFIX}/etc/rc.d/stunnel.sh.sample
    @${CHMOD} 755 ${PREFIX}/etc/rc.d/stunnel.sh.sample
    @${SETENV} PKG_PREFIX=${PREFIX} ${SH} \
        ${PKGINSTALL} ${PKGNAME} POST-INSTALL
    @${ECHO} ""
    @${ECHO} "**************************************************************************"
    @${ECHO} "To create and install a new certificate, type \"make cert\""
    @${ECHO} ""
    @${ECHO} "And don't forget to check out the FAQ at http://www.stunnel.org/"
    @${ECHO} "**************************************************************************"
    @${ECHO} ""

cert:
    @${ECHO} ""
    @${ECHO} "**************************************************************************"
    @${ECHO} "The new certificate will be saved into ${PREFIX}/etc/stunnel.pem"
    @${ECHO} "**************************************************************************"
    @${ECHO} ""
    @(cd ${WRKSRC}; make cert)
    ${INSTALL} -m 600 ${WRKSRC}/stunnel.pem ${PEM_DIR}/

.include <bsd.port.mk>