usr/src/cmd/bind/Makefile.sfw
author Jon Tibble <meths@btinternet.com>
Mon, 04 May 2015 14:04:39 +0100
branchoi_151a
changeset 254 9c2a4ac793f0
parent 42 b6f829cb6d9e
child 54 c8df60226931
permissions -rw-r--r--
Bash patch catchup including shellshock

#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
#

#pragma ident	"@(#)Makefile.sfw	1.24	10/08/04 SMI"
#

VER =		$(COMPONENT_NAME:sh)-$(COMPONENT_VERSION:sh)

TARBALL =	$(VER).tar.gz

# Environment settings.
CONFIGURE_ENV = 	CC='$(CC)' CXX='$(CCC)'
CONFIGURE_ENV +=	PATH='$(SFW_PATH)'
CONFIGURE_ENV +=	LD_OPTIONS='-M $(SRC)/cmd/mapfile_noexstk'
CONFIGURE_ENV +=	LDFLAGS='-L$(ROOTLIB)/dns'
CONFIGURE_ENV +=	MAKE='$(CCSMAKE)'
CONFIGURE_ENV +=	LD_LIBRARY_PATH='$(CFGLIB)/dns'

# Ideally no patches should be required, where they are needed for a
# release they should be incorporated or obsoleted in the next ISC
# release.
#
PATCHES:sh=	test -f Patches/*.patch && echo Patches/*.patch || echo ${VER}

include ../Makefile.cmd

# The ISC tarball is not /usr/bin/tar friendly.
$(VER)/.patched:= UNPACKARCHIVE=$(GTAR) xfz

# CONFIGARGS is printed by 'named -V' and logged at start-up.  It is
# overridden here to prevent the long path names appearing from CC,
# LDFLAGS and CXX.
all: $(VER)/config.status
	(cd $(VER); pwd;\
	    $(env) - PATH='$(SFW_PATH)' EXT_CFLAGS='$(CFLAGS)' $(CCSMAKE) -e \
		CONFIGARGS="$(CONFIGURE_OPTIONS)")

# The openssl version check is disabled as we rely on dynamic SSL library
# which is independent of BIND.
CONFIGURE_OPTIONS +=	--with-libtool
CONFIGURE_OPTIONS +=	--bindir=$(CFGBIN)
CONFIGURE_OPTIONS +=	--sbindir=$(CFGUSRSBIN)
CONFIGURE_OPTIONS +=	--libdir=$(CFGLIB)/dns
CONFIGURE_OPTIONS +=	--sysconfdir=/etc
CONFIGURE_OPTIONS +=	--localstatedir=/var
CONFIGURE_OPTIONS +=	--with-openssl
CONFIGURE_OPTIONS +=	--enable-threads=yes
CONFIGURE_OPTIONS +=	--enable-devpoll=yes
CONFIGURE_OPTIONS +=	--disable-openssl-version-check
CONFIGURE_OPTIONS +=	--enable-fixed-rrset
CONFIGURE_OPTIONS +=	--disable-getifaddrs

# Configure BIND ready for compilation.
$(VER)/config.status: $(VER)/$(SFW_STAMP_PATCHED)
	(cd $(VER); pwd; $(env) - $(CONFIGURE_ENV) \
		$(SHELL) ./configure $(CONFIGURE_OPTIONS) )

# Install deliverables into ROOT.
install: all
	$(SH) ./install-bind $(VER)

# test & fulltest.  The latter configures IP addresses 10.53.0.1
# through 10.53.0.5 as aliases on the loopback interface.
# The default task is to display summary from cache file if it exists.
# To force a new test either use clean target first or specify FRC=FRC.
#
# Nawk script reads ISC output which is of the form:
# /^T:/ = Start of a test, 
# /^I:/ = info from a test;  collect in case test did not PASS...
# /^R:/ = Result. If 'PASS' then continue, else print line and collected info.
# @ EOF = Display count of RESULTS: i.e. R:PASS=124 R:UNTESTED=26 Total=150
config_ip=$(POUND_SIGN)
fulltest := config_ip = cd $(VER); $(SHELL) ./bin/tests/system/ifconfig.sh
cache_str=I: $(VER) CACHED RESULTS from

test fulltest:  all $$@.$(MACH).results
	@$(ECHO) 'Sumary of results from $@.$(MACH).results'
	@$(nawk) '\
	     /^T:/{name=$$0;info="";}\
	     /^I:/ {info=sprintf("%s%s\n", info, $$0);}\
	     /^R:/ {test++; result[$$1]++;}\
	     /^R:PASS/{next;}\
	     /^R:/{printf("%s: %s\n%s\n", $$1, name, info);}\
	     END{for (item in result) printf("%s=%d ", item, result[item]);\
		 printf("Total=%d\n",test);\
	     }' $@.$(MACH).results
	@$(tail) -1 $@.$(MACH).results | $(GREP) '^$(cache_str)' || \
		$(ECHO) '$(cache_str)' `$(date)` >> $@.$(MACH).results

test.$(MACH).results fulltest.$(MACH).results: $(FRC)
	-$(config_ip) up
	-(cd $(VER); pwd; $(env) \
	    PATH=$(SFW_PATH) \
	    MAKE=$(CCSMAKE) \
	    $(CCSMAKE) -e test) 2>&1 | $(tee) $@
	-$(config_ip) down

clean:
	$(RM) -r ./$(VER)
	$(RM) test.$(MACH).results fulltest.$(MACH).results

prog=	dig dnssec-dsfromkey dnssec-keyfromlabel dnssec-keygen dnssec-signzone \
	host in.named named named-checkconf named-checkzone ndc nslookup \
	nsupdate rndc rndc-confgen
lib=	libisc libisccc libdns libisccfg liblwres libbind9

CLOBBERFILES=$(prog:%=$(ROOT)/usr/sbin/%) $(lib:%=$(ROOT)/usr/lib/dns/%.*)

date=/usr/bin/date
env=/usr/bin/env
nawk=/usr/bin/nawk
tail=/usr/bin/tail
tee=/usr/bin/tee

include ../Makefile.targ

FRC: