aboutsummaryrefslogtreecommitdiffstats
path: root/net/mpd-l2tp-ipv6pd-client/Makefile
blob: 5853229a844a5950dd90f1afb209bcb21b9051c9 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# New ports collection makefile for:    mpd-l2tp-ipv6pd-client
# Date created:             Nov 2 2006
# Whom:                 Hajimu UMEMOTO <ume@FreeBSD.org>
#
# $FreeBSD$
#

PORTNAME=   mpd-l2tp-ipv6pd-client
PORTVERSION=    20081105
#PORTREVISION=  0
CATEGORIES= net ipv6
MASTER_SITES=   # none
DISTFILES=  # none

MAINTAINER= ume@FreeBSD.org
COMMENT=    A sample implementaiton set of "L2TP-IPv6PD" client using mpd

IS_INTERACTIVE= yes
MANUAL_PACKAGE_BUILD=yes
NO_PACKAGE= yes
USE_RC_SUBR=    yes

OPTIONS=    MPD4        "Use mpd4"          off \
        MPD5        "Use mpd5"          on

.include <bsd.port.pre.mk>

.if defined(WITH_MPD5) && defined(WITH_MPD4)
BROKEN=     Multiple mpd versions selected.  Run 'make config' again!
.endif

.if defined(WITH_MPD4)
MPD_NAME=   mpd4
MPD4=       ""
.else
MPD_NAME=   mpd5
MPD4=       "@comment "
.endif

BUILD_DEPENDS=  ${MPD_NAME}:${PORTSDIR}/net/${MPD_NAME}
RUN_DEPENDS=    dhcp6ctl:${PORTSDIR}/net/dhcp6 \
        ${MPD_NAME}:${PORTSDIR}/net/${MPD_NAME}

CONF_DIR?=  etc/${MPD_NAME}
CONF_FILES= dhcp6c.conf.in rtadvd.conf
SCRIPT_FILES=   dhcp6c_pd.sh linkdown.sh linkup.sh
SECRET_FILES=   mpd.secret

SCRIPTS_ENV=    WRKDIR="${WRKDIR}" \
        SCRIPTDIR="${SCRIPTDIR}" \
        PREFIX="${PREFIX}" \
        CONF_DIR="${CONF_DIR}" \
        MPD_NAME="${MPD_NAME}" \
        CAT="${CAT}" \
        CP="${CP}" \
        DIALOG="${DIALOG}" \
        MD5="${MD5}" \
        MKTEMP="${MKTEMP}" \
        RM="${RM}" \
        SED="${SED}" \
        WHICH="${WHICH}"

PLIST_SUB=  CONF_DIR=${CONF_DIR} \
        MPD_NAME=${MPD_NAME} \
        MPD4=${MPD4}

PKGMESSAGE= ${WRKDIR}/pkg-message

.if ${OSVERSION} < 602106 || (${OSVERSION} >= 700000 && ${OSVERSION} < 700031)
IGNORE=     does not work with old ng_ksocket
.endif

do-build:
    @${SETENV} ${SCRIPTS_ENV} ${SH} ${SCRIPTDIR}/setting
    @${DIALOG} --clear

do-install:
    @if [ -f ${PREFIX}/${CONF_DIR}/mpd.conf -o \
          -f ${PREFIX}/${CONF_DIR}/mpd.links -o \
          -f ${PREFIX}/${CONF_DIR}/mpd.secret ]; then \
        ${ECHO_CMD} "There are ${MPD_NAME} configuration files already"; \
        ${ECHO_CMD} "Pleae remove at least following files before install:"; \
        ${ECHO_CMD} "    ${PREFIX}/${CONF_DIR}/mpd.conf"; \
        ${ECHO_CMD} "    ${PREFIX}/${CONF_DIR}/mpd.links"; \
        ${ECHO_CMD} "    ${PREFIX}/${CONF_DIR}/mpd.secret"; \
        exit 1; \
    fi
    @${MKDIR} ${PREFIX}/${CONF_DIR}
.if defined(WITH_MPD4)
    @${INSTALL_DATA} ${WRKDIR}/mpd.conf ${PREFIX}/${CONF_DIR}/mpd.conf
    @${INSTALL_DATA} ${WRKDIR}/mpd.links ${PREFIX}/${CONF_DIR}/mpd.links
.else
    @${INSTALL_DATA} ${WRKDIR}/mpd5.conf ${PREFIX}/${CONF_DIR}/mpd.conf
.endif
.for f in ${CONF_FILES}
    @${INSTALL_DATA} ${WRKDIR}/${f} ${PREFIX}/${CONF_DIR}/${f}
.endfor
    @${INSTALL_DATA} ${WRKDIR}/mpd ${PREFIX}/${CONF_DIR}/${MPD_NAME}
.for f in ${SCRIPT_FILES}
    @${INSTALL_SCRIPT} ${WRKDIR}/${f} ${PREFIX}/${CONF_DIR}/${f}
.endfor
.for f in ${SECRET_FILES}
    @${INSTALL} ${COPY} -o ${SHAREOWN} -g ${SHAREGRP} -m 400 \
        ${WRKDIR}/${f} ${PREFIX}/${CONF_DIR}/${f}
.endfor
    @${CAT} ${PKGMESSAGE}

.include <bsd.port.post.mk>