aboutsummaryrefslogtreecommitdiffstats
path: root/net/isc-dhcp31-server/Makefile
blob: 4bdee6352da37040a05484e99464291be25fb430 (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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# ex:ts=8
# Ports collection makefile for:    dhcp
# Date created:         7 Mar 1996
# Whom:                 se
#
# $FreeBSD$
#

PORTNAME=   dhcp
PORTVERSION=    3.0.1.r12
CATEGORIES= net
MASTER_SITES=   ${MASTER_SITE_ISC}
MASTER_SITE_SUBDIR= dhcp dhcp/dhcp-3.0-history
PKGNAMEPREFIX=  isc-
PKGNAMESUFFIX=  3
DISTNAME=   ${PORTNAME}-${RELEASE}${VERSION}${PATCHLEVEL}

MAINTAINER= cyrille.lefevre@laposte.net
COMMENT=    ISC Dynamic Host Configuration Protocol client and server code

USE_REINPLACE=  yes

.include <bsd.port.pre.mk>

# Global variables
#

HAS_CONFIGURE=  yes

MAN1=       omshell.1
MAN3=       dhcpctl.3 omapi.3 omshell.3
MAN5=       dhclient.conf.5 dhclient.leases.5 \
        dhcp-eval.5 dhcp-options.5 dhcpd.conf.5 \
        dhcpd.leases.5
MAN8=       dhclient.8 dhclient-script.8 dhcpd.8 dhcrelay.8

MSG_FILE=   ${PKGDIR}/pkg-message
PKGMESSAGE= ${WRKDIR}/pkg-message

# Local variables
#

# for instance, possible versions are:
#   1.2.r3.4 (or 1.2.b3.4), 1.2.r3 (or 1.2.b3), 1.2.3, 1.2
# which have to become:
#   1.2rc3pl4 (or 1.2beta3pl4), 1.2rc3 (or 1.2beta3), 1.2pl3, 1.2
# so, the magic things are:
VERSION=
PATCHLEVEL=
.if ${PORTVERSION:R:E:M[br]*} != ""
RELEASE=    ${PORTVERSION:R:R}
VERSION=    ${PORTVERSION:R:E:S/b/beta/:S/r/rc/}
PATCHLEVEL= pl${PORTVERSION:E}
.elif ${PORTVERSION:E:M[br]*} != ""
RELEASE=    ${PORTVERSION:R}
VERSION=    ${PORTVERSION:E:S/b/beta/:S/r/rc/}
.elif ${PORTVERSION:R:E} != ""
RELEASE=    ${PORTVERSION:R}
PATCHLEVEL= pl${PORTVERSION:E}
.else
RELEASE=    ${PORTVERSION}
.endif

PATCH_SUBDIRS=  common minires dst omapip server client relay dhcpctl

BIN_FILES=  dhclient dhcpd dhcrelay omshell
CONF_FILES= dhclient.conf
RC_FILES=   isc-dhcpd isc-dhcrelay
DOC_FILES=  ANONCVS CHANGES COPYRIGHT README RELNOTES
SAMP_FILES= client/dhclient.conf server/dhcpd.conf
DATA_FILES= dhclient.leases dhcpd.leases

SAMP_SUFX=  .sample

CONF_DIR=   ${PREFIX}/etc
RC_DIR=     ${PREFIX}/etc/rc.d
DOCSDIR=    ${PREFIX}/share/doc/${PKGBASE}
DATADIR=    /var/db

STRIP_CMD?= strip

# Post-patch
#

post-patch: patch-scripts patch-makefile-conf \
        patch-makefiles-dist patch-man-pages \
        patch-pkgmessage

patch-scripts:
    @${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \
        ${WRKSRC}/client/scripts/freebsd

patch-makefile-conf:
    @${REINPLACE_CMD} -e 's|^DEBUG[     ]*=|# DEBUG ?=|g' \
        ${WRKSRC}/Makefile.conf

patch-makefiles-dist:
.for subdir in ${PATCH_SUBDIRS}
    @${REINPLACE_CMD} -e 's|^CFLAGS[    ]*=|CFLAGS +=|g' \
        ${WRKSRC}/${subdir}/Makefile.dist
.endfor

# temporary hack - no patch file needed for this typo.
patch-man-pages:
    @${REINPLACE_CMD} -e '/^\.Fd$$/d' ${WRKSRC}/dhcpctl/dhcpctl.3

patch-pkgmessage:
    @${SED} 's|%%PREFIX%%|${PREFIX}|g;s|%%MAN1PREFIX%%|${MAN1PREFIX}|g' \
        ${MSG_FILE} > ${PKGMESSAGE}

# Post-install
#

post-install: strip-binary-files install-startup-files \
          install-doc-files install-sample-files \
          create-conf-files create-data-files \
          display-message

strip-binary-files:
.for file in ${BIN_FILES}
.if exists(${PREFIX}/bin/${file})
    @${STRIP_CMD} ${PREFIX}/bin/${file}
.endif
.if exists(${PREFIX}/sbin/${file})
    @${STRIP_CMD} ${PREFIX}/sbin/${file}
.endif
.endfor

install-startup-files:
.for file in ${RC_FILES}
.if exists(${FILESDIR}/rc.${file}.conf${SAMP_SUFX})
    @${INSTALL_DATA} ${FILESDIR}/rc.${file}.conf${SAMP_SUFX} ${CONF_DIR}
.if !exists(${CONF_DIR}/rc.${file}.conf)
    @${INSTALL_DATA} ${FILESDIR}/rc.${file}.conf${SAMP_SUFX} \
        ${CONF_DIR}/rc.${file}.conf
.endif
.endif
.if exists(${FILESDIR}/${file}.sh${SAMP_SUFX})
    @${INSTALL_SCRIPT} ${FILESDIR}/${file}.sh${SAMP_SUFX} ${RC_DIR}
.endif
.endfor

install-doc-files:
.if !defined(NOPORTDOCS)
    @${MKDIR} ${DOCSDIR}
.for file in ${DOC_FILES}
    @${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR}
.endfor
.endif

install-sample-files:
.for file in ${SAMP_FILES}
    @${INSTALL_DATA} ${WRKSRC}/${file} ${CONF_DIR}/${file:T}${SAMP_SUFX}
.endfor

create-conf-files:
.for file in ${CONF_FILES}
.if !exists(${CONF_DIR}/${file})
    @${TOUCH} ${CONF_DIR}/${file}
.endif
.endfor

create-data-files:
.for file in ${DATA_FILES}
.if !exists(${DATADIR}/${file})
    @${TOUCH} ${DATADIR}/${file}
.endif
.endfor

display-message:
    @${ECHO_MSG}
    @${CAT} ${PKGMESSAGE}
    @${ECHO_MSG}

.include <bsd.port.post.mk>