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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
|
# ex:ts=8
# Ports collection makefile for: dhcp
# Date created: 7 Mar 1996
# Whom: se
#
# $FreeBSD$
#
PORTNAME= dhcp
PORTVERSION= 3.0.5
PORTREVISION= ${DHCP_PORTREVISION}
CATEGORIES= net
MASTER_SITES= ${MASTER_SITE_ISC}
MASTER_SITE_SUBDIR= dhcp dhcp/dhcp-3.0-history
PKGNAMEPREFIX= isc-
PKGNAMESUFFIX= 3-${SUBSYS}
DISTNAME= ${PORTNAME}-${RELEASE}${VERSION}${PATCHLEVEL}
MAINTAINER= Joerg.Pulz@frm2.tum.de
COMMENT?= The ISC Dynamic Host Configuration Protocol server
PORTREVISION_SERVER= 1
PORTREVISION_CLIENT= 0
PORTREVISION_RELAY= 0
PORTREVISION_DEVEL= 0
SUBSYS?= server
UNIQUENAME= ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}
.if ${SUBSYS} == client
OPTIONS= INTERFACE_POLLING "interface polling support" on
.endif
.if ${SUBSYS} == server
OPTIONS= DHCP_PARANOIA "add -user, -group and -chroot options" on \
DHCP_JAIL "add -chroot and -jail options" on \
DHCP_SOCKETS "use sockets instead of /dev/bpf (jail-only)" off \
DHCP_LDAP "add experimental LDAP backend support" off \
DHCP_LDAP_SSL "support LDAP connection over SSL/TLS" on \
OPENSSL_BASE "use the base system OpenSSL (required by TLS)" on \
OPENSSL_PORT "use OpenSSL from ports (required by TLS)" off \
DHCP_LQ "DHCPLEASEQUERY support used by Cisco uBR's" off
.endif
# PORTREVISION handling
.if ${SUBSYS} == client
DHCP_PORTREVISION= ${PORTREVISION_CLIENT}
.elif ${SUBSYS} == relay
DHCP_PORTREVISION= ${PORTREVISION_RELAY}
.elif ${SUBSYS} == devel
DHCP_PORTREVISION= ${PORTREVISION_DEVEL}
.else
DHCP_PORTREVISION= ${PORTREVISION_SERVER}
.endif
.include <bsd.port.pre.mk>
.if ${SUBSYS} == server && defined(WITH_DHCP_LDAP)
# Based on patch from Brian Masney :
PATCH_SITES= http://www.newwave.net/~masneyb/:ldap \
ftp://ftp.frm2.tum.de/pub/jpulz/FreeBSD/:ldap
PATCHFILES= ${PORTNAME}-${RELEASE}${VERSION}${PATCHLEVEL}-ldap-patch:ldap
PATCH_DIST_STRIP= -p1
USE_PERL5_RUN= yes
USE_OPENLDAP= yes
.if !defined(WITHOUT_DHCP_LDAP_SSL)
USE_OPENSSL= yes
# hack to get bsd.openssl.mk included at this late state
.include "${PORTSDIR}/Mk/bsd.openssl.mk"
.endif
.endif
.if ${SUBSYS} == server && defined(WITH_DHCP_LQ)
# Based on patch from Dmitry Sukhodoev :
PATCH_SITES+= http://bingo.ru/~raven/FreeBSD/patches/:dlq \
ftp://ftp.frm2.tum.de/pub/jpulz/FreeBSD/:dlq
PATCHFILES+= ${PORTNAME}-${RELEASE}${VERSION}${PATCHLEVEL}-dlq-patch:dlq
.endif
# Global variables
#
HAS_CONFIGURE= yes
CONFIGURE_ARGS= --subsys ${SUBSYS}
ALL_TARGET= all.${SUBSYS}
INSTALL_TARGET= install.${SUBSYS}
SCRIPTS_ENV+= PKG_PREFIX=${PREFIX}
.if ${SUBSYS} == client
MAN5= dhclient.conf.5 dhclient.leases.5
MAN8= dhclient.8 dhclient-script.8
.elif ${SUBSYS} == server
MAN1= omshell.1
MAN5= dhcpd.conf.5 dhcpd.leases.5
MAN8= dhcpd.8
.elif ${SUBSYS} == relay
MAN8= dhcrelay.8
.else
MAN3= dhcpctl.3 omapi.3
.endif
.if ${SUBSYS} != relay
MAN5+= dhcp-eval.5 dhcp-options.5
.endif
MSG_FILE= ${.CURDIR}/pkg-message
DESCR= ${.CURDIR}/pkg-descr
PKGINSTALL= ${.CURDIR}/pkg-install
PKGDEINSTALL= ${PKGINSTALL}
PKGMESSAGE= ${WRKDIR}/pkg-message
PLIST= ${.CURDIR}/pkg-plist
# 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.2.3, 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
.if ${SUBSYS} == server || ${SUBSYS} == devel
PATCH_SUBDIRS+= dhcpctl
.endif
.if ${SUBSYS} != devel
PATCH_SUBDIRS+= ${SUBSYS}
.endif
.if ${SUBSYS} == server
PATCH_SUBDIRS+= omshell
.endif
.if !defined(NOPORTDOCS)
PORTDOCS= LICENSE README RELNOTES
.endif
.if ${SUBSYS} == client
BIN_FILES= dhclient
LOCAL_CONF_FILES= dhclient.conf
SAMP_FILES= client/dhclient.conf
DATA_FILES= dhclient.leases
.elif ${SUBSYS} == server
BIN_FILES= dhcpd omshell
USE_RC_SUBR= isc-dhcpd
SAMP_FILES= server/dhcpd.conf
DATA_FILES= dhcpd.leases
.if defined(WITH_DHCP_LDAP)
PORTDOCS+= README.ldap
LDAP_SCRIPT= contrib/dhcpd-conf-to-ldap.pl
LDAP_SCHEMA= contrib/dhcp.schema
.endif
.elif ${SUBSYS} == relay
BIN_FILES= dhcrelay
USE_RC_SUBR= isc-dhcrelay
.endif
SAMP_SUFX= .sample
CONF_DIR= ${PREFIX}/etc
SCHEMA_DIR= ${PREFIX}/share/${PKGBASE}
DOCSDIR= ${PREFIX}/share/doc/${PKGBASE}
DATADIR= /var/db
PLIST_SUB+= SCHEMA_DIR="${SCHEMA_DIR:S,^${PREFIX}/,,}"
.if defined(WITH_DHCP_LDAP)
PLIST_SUB+= LDAP=""
.else
PLIST_SUB+= LDAP="@comment "
.endif
REINPLACE_SUB= PREFIX=${PREFIX}
.if ${OSVERSION} >= 502100
SUB_LIST+= NOLOGIN=/usr/sbin/nologin
.else
SUB_LIST+= NOLOGIN=/sbin/nologin
.endif
.if !defined(WITHOUT_DHCP_PARANOIA)
SUB_LIST+= PARANOIA=YES
.else
SUB_LIST+= PARANOIA=NO
.endif
.if !defined(WITHOUT_DHCP_JAIL)
SUB_LIST+= JAIL=YES
.else
SUB_LIST+= JAIL=NO
.endif
PKGMESSAGE_SUB= PREFIX="${PREFIX}" MAN1PREFIX="${MAN1PREFIX}" \
DOCSDIR="${DOCSDIR}" SCHEMA_DIR="${SCHEMA_DIR}"
# Post-extract
#
post-extract: extract-omshell extract-script
extract-omshell:
@${MKDIR} ${WRKSRC}/omshell
@${MV} ${WRKSRC}/dhcpctl/omshell.? ${WRKSRC}/omshell
@${CP} ${FILESDIR}/omshell::Makefile.dist \
${WRKSRC}/omshell/Makefile.dist
extract-script:
@${CP} ${FILESDIR}/client::scripts::freebsd ${WRKSRC}/client/scripts/freebsd
# Post-patch
#
post-patch: patch-scripts patch-makefile-conf \
patch-makefiles-dist patch-man-pages \
patch-pkgmessage patch-site-conf \
patch-dlq
patch-scripts:
@${REINPLACE_CMD} ${REINPLACE_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
${WRKSRC}/client/dhclient.conf \
${WRKSRC}/client/scripts/freebsd
patch-site-conf:
.if ${SUBSYS} == client && !defined(WITHOUT_INTERFACE_POLLING)
@${ECHO_CMD} CFLAGS += -DENABLE_POLLING_MODE >> ${WRKSRC}/site.conf
.endif
.if ${SUBSYS} == server
.if !defined(WITHOUT_DHCP_PARANOIA)
@${ECHO_CMD} CFLAGS += -DPARANOIA >> ${WRKSRC}/site.conf
.endif
.if !defined(WITHOUT_DHCP_JAIL)
@${ECHO_CMD} CFLAGS += -DJAIL >> ${WRKSRC}/site.conf
.if defined(WITH_DHCP_SOCKETS)
@${ECHO_CMD} CFLAGS += -DUSE_SOCKETS >> ${WRKSRC}/site.conf
.endif
.endif
.if defined(WITH_DHCP_LDAP)
@${ECHO_CMD} CFLAGS += -I${LOCALBASE}/include >> ${WRKSRC}/site.conf
@${ECHO_CMD} LIBS += -L${LOCALBASE}/lib >> ${WRKSRC}/site.conf
.if !defined(WITHOUT_DHCP_LDAP_SSL)
@${ECHO_CMD} CFLAGS += -DUSE_SSL -I${OPENSSLINC} >> ${WRKSRC}/site.conf
@${ECHO_CMD} LIBS += -L${OPENSSLLIB} >> ${WRKSRC}/site.conf
@${ECHO_CMD} LIBS += -lcrypto -lssl >> ${WRKSRC}/site.conf
.endif
.endif
.endif
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:
.if ${SUBSYS} != devel
@${SED} ${PKGMESSAGE_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
${MSG_FILE} > ${PKGMESSAGE}
.if defined(WITH_DHCP_LDAP)
@${REINPLACE_CMD} -e 's|^%%LDAP%%||g' ${PKGMESSAGE}
.else
@${REINPLACE_CMD} -e '/^%%LDAP%%/d' ${PKGMESSAGE}
.endif
.endif
patch-dlq:
.if ${SUBSYS} == server && defined(WITH_DHCP_LQ)
.if defined(WITH_DHCP_LDAP)
@${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-dlq-ldap
.else
@${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-dlq
.endif
.endif
# Post-install
#
POST-INSTALL= parallel-post-install install-rc-script configure-package \
display-message
.ORDER: ${POST-INSTALL}
post-install: ${POST-INSTALL}
parallel-post-install: \
strip-binary-files \
install-doc-files install-ldap-files install-sample-files \
create-conf-files create-data-files
strip-binary-files:
.for f in ${BIN_FILES}
.if exists(${PREFIX}/bin/${f})
@${STRIP_CMD} ${PREFIX}/bin/${f}
.endif
.if exists(${PREFIX}/sbin/${f})
@${STRIP_CMD} ${PREFIX}/sbin/${f}
.endif
.endfor
install-doc-files:
.if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}
.for f in ${PORTDOCS}
@${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}
.endfor
.endif
install-ldap-files:
.if ${SUBSYS} == server && defined(WITH_DHCP_LDAP)
@${INSTALL_SCRIPT} ${WRKSRC}/${LDAP_SCRIPT} ${PREFIX}/bin
@${MKDIR} ${SCHEMA_DIR}
@${INSTALL_DATA} ${WRKSRC}/${LDAP_SCHEMA} ${SCHEMA_DIR}
.endif
install-sample-files:
.for f in ${SAMP_FILES}
@${INSTALL_DATA} ${WRKSRC}/${f} ${CONF_DIR}/${f:T}${SAMP_SUFX}
.endfor
create-conf-files:
.for f in ${LOCAL_CONF_FILES}
.if !exists(${CONF_DIR}/${f})
@${TOUCH} ${CONF_DIR}/${f}
.endif
.endfor
create-data-files:
.for f in ${DATA_FILES}
.if !exists(${DATADIR}/${f})
@${TOUCH} ${DATADIR}/${f}
.endif
.endfor
configure-package:
.if ${SUBSYS} == server
@${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
.endif
display-message:
.if ${SUBSYS} != devel
@${ECHO_MSG}
@${CAT} ${PKGMESSAGE}
@${ECHO_MSG}
.endif
.include <bsd.port.post.mk>
|