- Add OPTIONS: DHCP_IPV6 to make IPv6 support optional

- Use bsd.port.mk and bsd.port.options.mk
- Make portlint happier

PR:		ports/156846
Submitted by:	Alex Deiter <alex.deiter@gmail.com>
Approved by:	Douglas Thrift <douglas@douglasthrift.net> (maintainer)
This commit is contained in:
Sunpoet Po-Chuan Hsieh 2011-05-09 00:58:17 +00:00
parent 7f9f10fe28
commit d5665382a5
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=273831
2 changed files with 30 additions and 13 deletions

View file

@ -31,8 +31,10 @@ WRKSRC= ${WRKDIR}/${PORTNAME}-${DISTVERSION}-${PATCHLEVEL}
UNIQUENAME= ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}
OPTIONS= DHCP_IPV6 "Enable support for IPv6" on
.if ${SUBSYS} == server
OPTIONS= DHCP_PARANOIA "Enable support for chroot" on \
OPTIONS+= DHCP_PARANOIA "Enable support for chroot" on \
DHCP_LDAP "Experimental LDAP backend support" off \
DHCP_LDAP_SSL "Support LDAP connection over SSL/TLS" on
.endif
@ -50,17 +52,17 @@ DHCP_PORTREVISION= ${PORTREVISION_SERVER}
.endif
.if ${SUBSYS} == server
USERS= dhcpd
GROUPS= dhcpd
USERS= dhcpd
GROUPS= dhcpd
.endif
.include <bsd.port.pre.mk>
MAN_COMPRESSED= no
GNU_CONFIGURE= yes
CONFIGURE_ENV= CPPFLAGS="-D_PATH_DHCLIENT_SCRIPT='\"${PREFIX}/sbin/dhclient-script\"' -D_PATH_DHCLIENT_CONF='\"${PREFIX}/etc/dhclient.conf\"' -D_PATH_DHCPD_CONF='\"${PREFIX}/etc/dhcpd.conf\"'"
CPPFLAGS+= -D_PATH_DHCLIENT_SCRIPT='\"${PREFIX}/sbin/dhclient-script\"' -D_PATH_DHCLIENT_CONF='\"${PREFIX}/etc/dhclient.conf\"' -D_PATH_DHCPD_CONF='\"${PREFIX}/etc/dhcpd.conf\"'
SCRIPTS_ENV+= PKG_PREFIX=${PREFIX}
.include <bsd.port.options.mk>
.if ${SUBSYS} == client
MAN5+= dhclient.conf.5 dhclient.leases.5
MAN8+= dhclient.8 dhclient-script.8
@ -72,7 +74,10 @@ MAN8+= dhcpd.8
MAN1= omshell.1
MAN3= dhcpctl.3 omapi.3
CFLAGS+= -fPIC
CONF_FILE= dhcpd.conf dhcpd6.conf
CONF_FILE= dhcpd.conf
.if defined(WITH_DHCP_IPV6)
CONF_FILE+= dhcpd6.conf
.endif
.else
MAN8+= dhcrelay.8
.endif
@ -135,6 +140,14 @@ SUB_LIST+= PARANOIA=yes
SUB_LIST+= PARANOIA=no
.endif
.if defined(WITH_DHCP_IPV6)
CONFIGURE_ARGS+= --enable-dhcpv6
PLIST_SUB+= IPV6=""
.else
CONFIGURE_ARGS+= --disable-dhcpv6
PLIST_SUB+= IPV6="@comment "
.endif
pre-patch:
.if ${SUBSYS} == server && defined(WITH_DHCP_LDAP)
@cd ${WRKSRC} && ${PATCH} -p1 < ${WRKDIR}/${LDAPPATCHDIST}/${LDAPPATCHFILE}
@ -155,9 +168,11 @@ do-install:
${MAKE} -C ${WRKSRC}/includes install
${MAKE} -C ${WRKSRC}/common install
${INSTALL_DATA} ${WRKSRC}/dhcpctl/dhcpctl.h ${PREFIX}/include
.if defined(WITH_DHCP_IPV6)
${INSTALL_DATA} ${WRKSRC}/doc/examples/dhcpd-dhcpv6.conf \
${PREFIX}/etc/dhcpd6.conf.sample
.endif
.endif
.if defined(WITH_DHCP_LDAP)
@${MKDIR} ${SCHEMA_DIR}
${INSTALL_DATA} ${LDAP_SCHEMA} ${SCHEMA_DIR}
@ -180,7 +195,9 @@ post-install:
.if ${SUBSYS} == client
${INSTALL_SCRIPT} ${WRKSRC}/client/scripts/freebsd ${PREFIX}/sbin/dhclient-script
.elif ${SUBSYS} == server
.if defined(WITH_DHCP_IPV6)
@${LN} -sf isc-dhcpd ${PREFIX}/etc/rc.d/isc-dhcpd6
.endif
.endif
@${SED} ${PKGMESSAGE_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
${MSG_FILE} > ${PKGMESSAGE}
@ -193,4 +210,4 @@ post-install:
@${CAT} ${PKGMESSAGE}
@${ECHO_MSG}
.include <bsd.port.post.mk>
.include <bsd.port.mk>

View file

@ -1,13 +1,13 @@
@comment $FreeBSD$
@unexec %D/etc/rc.d/isc-dhcpd forcestop 2>/dev/null || true
@unexec %D/etc/rc.d/isc-dhcpd6 forcestop 2>/dev/null || true
%%IPV6%%@unexec %D/etc/rc.d/isc-dhcpd6 forcestop 2>/dev/null || true
@unexec if cmp -s %D/etc/dhcpd.conf.sample %D/etc/dhcpd.conf; then rm -f %D/etc/dhcpd.conf; fi
etc/dhcpd.conf.sample
@exec if [ ! -f %D/etc/dhcpd.conf ] ; then cp -p %D/%F %B/dhcpd.conf; fi
@unexec if cmp -s %D/etc/dhcpd6.conf.sample %D/etc/dhcpd6.conf; then rm -f %D/etc/dhcpd6.conf; fi
etc/dhcpd6.conf.sample
@exec if [ ! -f %D/etc/dhcpd6.conf ] ; then cp -p %D/%F %B/dhcpd6.conf; fi
etc/rc.d/isc-dhcpd6
%%IPV6%%@unexec if cmp -s %D/etc/dhcpd6.conf.sample %D/etc/dhcpd6.conf; then rm -f %D/etc/dhcpd6.conf; fi
%%IPV6%%etc/dhcpd6.conf.sample
%%IPV6%%@exec if [ ! -f %D/etc/dhcpd6.conf ] ; then cp -p %D/%F %B/dhcpd6.conf; fi
%%IPV6%%etc/rc.d/isc-dhcpd6
sbin/dhcpd
bin/omshell
%%LDAP%%bin/dhcpd-conf-to-ldap