From d5665382a5ba991f3216b61a54a092197a4ab53f Mon Sep 17 00:00:00 2001 From: Sunpoet Po-Chuan Hsieh Date: Mon, 9 May 2011 00:58:17 +0000 Subject: [PATCH] - 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 Approved by: Douglas Thrift (maintainer) --- net/isc-dhcp41-server/Makefile | 33 +++++++++++++++++++++++++-------- net/isc-dhcp41-server/pkg-plist | 10 +++++----- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/net/isc-dhcp41-server/Makefile b/net/isc-dhcp41-server/Makefile index 25eb4fcee4f8..dac9276099ef 100644 --- a/net/isc-dhcp41-server/Makefile +++ b/net/isc-dhcp41-server/Makefile @@ -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 - 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 + .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 +.include diff --git a/net/isc-dhcp41-server/pkg-plist b/net/isc-dhcp41-server/pkg-plist index cf370863aa94..fcf5c7eb34d5 100644 --- a/net/isc-dhcp41-server/pkg-plist +++ b/net/isc-dhcp41-server/pkg-plist @@ -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