diff options
-rw-r--r-- | mk/bsd.pkg.mk | 217 | ||||
-rw-r--r-- | mk/bsd.prefs.mk | 19 | ||||
-rw-r--r-- | mk/bsd.utils.mk | 4 | ||||
-rw-r--r-- | mk/checksum/bsd.checksum-vars.mk | 12 | ||||
-rw-r--r-- | mk/checksum/bsd.checksum.mk | 41 | ||||
-rwxr-xr-x | mk/checksum/checksum | 179 | ||||
-rw-r--r-- | mk/checksum/checksum.mk | 116 | ||||
-rw-r--r-- | mk/depends/bsd.depends-vars.mk | 9 | ||||
-rw-r--r-- | mk/depends/bsd.depends.mk | 18 | ||||
-rw-r--r-- | mk/fetch/bsd.fetch-vars.mk | 7 | ||||
-rw-r--r-- | mk/fetch/fetch.mk | 6 | ||||
-rw-r--r-- | mk/flavor/pkg/depends.mk | 90 | ||||
-rw-r--r-- | mk/install/bsd.install-vars.mk | 7 | ||||
-rw-r--r-- | mk/patch/bsd.patch-vars.mk | 7 | ||||
-rw-r--r-- | mk/patch/patch.mk | 5 | ||||
-rw-r--r-- | mk/tools/bsd.tools.mk | 3 | ||||
-rw-r--r-- | mk/tools/digest.mk | 80 | ||||
-rw-r--r-- | mk/tools/replace.mk | 6 |
18 files changed, 556 insertions, 270 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index 234c91e3e15..400fb785004 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.mk,v 1.1868 2006/07/10 22:59:27 jlam Exp $ +# $NetBSD: bsd.pkg.mk,v 1.1869 2006/07/13 14:02:34 jlam Exp $ # # This file is in the public domain. # @@ -9,12 +9,17 @@ # # Default sequence for "all" is: # -# fetch checksum depends tools extract patch wrapper configure build +# bootstrap-depends +# fetch +# checksum +# depends +# tools +# extract +# patch +# wrapper +# configure +# build # -# Please read the comments in the targets section below, you -# should be able to use the pre-* or post-* targets/scripts -# (which are available for every stage except checksum) or -# override the do-* targets to do pretty much anything you want. ############################################################################ # Include any preferences, if not already included, and common definitions @@ -28,11 +33,13 @@ .include "${PKGSRCDIR}/mk/check/bsd.check-vars.mk" .include "${PKGSRCDIR}/mk/depends/bsd.depends-vars.mk" .include "${PKGSRCDIR}/mk/fetch/bsd.fetch-vars.mk" +.include "${PKGSRCDIR}/mk/checksum/bsd.checksum-vars.mk" .include "${PKGSRCDIR}/mk/extract/bsd.extract-vars.mk" .include "${PKGSRCDIR}/mk/patch/bsd.patch-vars.mk" .include "${PKGSRCDIR}/mk/configure/bsd.configure-vars.mk" .include "${PKGSRCDIR}/mk/build/bsd.build-vars.mk" .include "${PKGSRCDIR}/mk/install/bsd.install-vars.mk" + .include "${PKGSRCDIR}/mk/bsd.pkg.error.mk" .include "../../mk/bsd.hacks.mk" @@ -108,14 +115,10 @@ BUILD_DEPENDS?= # empty COMMENT?= (no description) DEPENDS?= # empty DESCR_SRC?= ${PKGDIR}/DESCR -DIGEST_ALGORITHMS?= SHA1 RMD160 -DISTINFO_FILE?= ${PKGDIR}/distinfo INTERACTIVE_STAGE?= none MAINTAINER?= pkgsrc-users@NetBSD.org -PATCH_DIGEST_ALGORITHM?=SHA1 PKGWILDCARD?= ${PKGBASE}-[0-9]* SVR4_PKGNAME?= ${PKGNAME} -USE_DIGEST?= YES WRKSRC?= ${WRKDIR}/${DISTNAME} .if (defined(INSTALL_UNSTRIPPED) && !empty(INSTALL_UNSTRIPPED:M[yY][eE][sS])) || defined(DEBUG_FLAGS) @@ -125,7 +128,6 @@ _INSTALL_UNSTRIPPED= # set (flag used by platform/*.mk) ##### Non-overridable constants # Latest versions of tools required for correct pkgsrc operation. -DIGEST_REQD= 20010302 PKGTOOLS_REQD= ${_OPSYS_PKGTOOLS_REQD:U20051103} ##### Transform USE_* into dependencies @@ -366,27 +368,6 @@ OVERRIDE_DIRDEPTH?= 2 # INSTALL/DEINSTALL script framework .include "../../mk/pkginstall/bsd.pkginstall.mk" -.PHONY: uptodate-digest -uptodate-digest: -.if !empty(USE_DIGEST:M[yY][eE][sS]) - ${_PKG_SILENT}${_PKG_DEBUG} \ - if [ -f ${DISTINFO_FILE} -a \( ! -f ${DIGEST} -o ${DIGEST_VERSION} -lt ${DIGEST_REQD} \) ]; then \ - { cd ${PKGSRCDIR}/pkgtools/digest; \ - ${MAKE} clean; \ - if [ -f ${DIGEST} ]; then \ - ${MAKE} ${MAKEFLAGS} deinstall; \ - fi; \ - ${MAKE} ${MAKEFLAGS} ${_PKGSRC_BUILD_TARGETS}; \ - if [ -f ${DIGEST} ]; then \ - ${MAKE} ${MAKEFLAGS} deinstall; \ - fi; \ - ${MAKE} ${MAKEFLAGS} ${DEPENDS_TARGET}; \ - ${MAKE} ${MAKEFLAGS} clean; } \ - fi -.else - @${DO_NADA} -.endif - # Define SMART_MESSAGES in /etc/mk.conf for messages giving the tree # of dependencies for building, and the current target. _PKGSRC_IN?= ===${SMART_MESSAGES:D> ${.TARGET} [${PKGNAME}${_PKGSRC_DEPS}] ===} @@ -449,6 +430,8 @@ USE_TOOLS+= \ mkdir mv pax pwd rm rmdir sed sh sort tail test touch tr true \ wc xargs +USE_TOOLS+= ${NO_CHECKSUM:D:Udigest\:bootstrap} + # bsd.wrapper.mk USE_TOOLS+= expr @@ -645,22 +628,6 @@ all: ${_PKGSRC_BUILD_TARGETS} .endif ################################################################ -# The following are used to create easy dummy targets for -# disabling some bit of default target behavior you don't want. -# They still check to see if the target exists, and if so don't -# do anything, since you might want to set this globally for a -# group of packages in a Makefile.inc, but still be able to -# override from an individual Makefile. -################################################################ - -# Disable checksum -.PHONY: checksum -.if (defined(NO_CHECKSUM) || exists(${_COOKIE.extract})) && !target(checksum) -checksum: fetch - @${DO_NADA} -.endif - -################################################################ # More standard targets start here. # # These are the body of the build/install framework. If you are @@ -772,6 +739,9 @@ makedirs: ${.CURDIR}/${WRKDIR_BASENAME} # Fetch .include "${PKGSRCDIR}/mk/fetch/bsd.fetch.mk" +# Checksum +.include "${PKGSRCDIR}/mk/checksum/bsd.checksum.mk" + # Extract .include "${PKGSRCDIR}/mk/extract/bsd.extract.mk" @@ -840,157 +810,6 @@ su-target: .USE lint: ${_PKG_SILENT}${_PKG_DEBUG}${LOCALBASE}/bin/pkglint - -# Checksumming utilities - -.PHONY: makesum -.if !target(makesum) -. if defined(NO_CHECKSUM) && !empty(NO_CHECKSUM:M[Yy][Ee][Ss]) -makesum: - @${DO_NADA} -. else -makesum: fetch uptodate-digest - ${_PKG_SILENT}${_PKG_DEBUG} \ - newfile=${DISTINFO_FILE}.$$$$; \ - if [ -f ${DISTINFO_FILE} ]; then \ - ${GREP} '^.NetBSD' ${DISTINFO_FILE} > $$newfile || \ - (${ECHO_N} "$$" > $$newfile && \ - ${ECHO_N} "NetBSD" >> $$newfile && \ - ${ECHO} "$$" >> $$newfile) \ - else \ - ${ECHO_N} "$$" > $$newfile; \ - ${ECHO_N} "NetBSD" >> $$newfile; \ - ${ECHO} "$$" >> $$newfile; \ - fi; \ - ${ECHO} "" >> $$newfile; \ - cd ${DISTDIR}; \ - for sumfile in "" ${_CKSUMFILES}; do \ - if [ "X$$sumfile" = "X" ]; then continue; fi; \ - for a in "" ${DIGEST_ALGORITHMS}; do \ - if [ "X$$a" = "X" ]; then continue; fi; \ - ${DIGEST} $$a $$sumfile >> $$newfile; \ - done; \ - ${WC} -c $$sumfile | ${AWK} '{ print "Size (" $$2 ") = " $$1 " bytes" }' >> $$newfile; \ - done; \ - for ignore in "" ${_IGNOREFILES}; do \ - if [ "X$$ignore" = "X" ]; then continue; fi; \ - for a in "" ${DIGEST_ALGORITHMS}; do \ - if [ "X$$a" = "X" ]; then continue; fi; \ - ${ECHO} "$$a ($$ignore) = IGNORE" >> $$newfile; \ - done; \ - done; \ - if [ -f ${DISTINFO_FILE} ]; then \ - ${AWK} '$$2 ~ /\(patch-[a-z0-9]+\)/ { print $$0 }' < ${DISTINFO_FILE} >> $$newfile; \ - fi; \ - if ${CMP} -s $$newfile ${DISTINFO_FILE}; then \ - ${RM} -f $$newfile; \ - ${ECHO_MSG} "=> distinfo: distfiles part unchanged."; \ - else \ - ${MV} $$newfile ${DISTINFO_FILE}; \ - fi -. endif -.endif - -.if !target(makepatchsum) -makepatchsum mps: uptodate-digest - ${_PKG_SILENT}${_PKG_DEBUG} \ - newfile=${DISTINFO_FILE}.$$$$; \ - if [ -f ${DISTINFO_FILE} ]; then \ - ${AWK} '$$2 !~ /\(patch-[a-z0-9]+\)/ { print $$0 }' < ${DISTINFO_FILE} >> $$newfile; \ - else \ - ${ECHO} "\$$""NetBSD""\$$" > $$newfile; \ - ${ECHO} "" >> $$newfile; \ - fi; \ - if [ -d ${PATCHDIR} ]; then \ - (cd ${PATCHDIR}; \ - for sumfile in "" patch-*; do \ - case $$sumfile in \ - "" | "patch-*") ;; \ - patch-local-* | *.orig | *.rej | *~) ;; \ - *) ${ECHO} "${PATCH_DIGEST_ALGORITHM} ($$sumfile) = `${SED} -e '/\$$NetBSD.*/d' $$sumfile | ${DIGEST} ${PATCH_DIGEST_ALGORITHM}`" >> $$newfile;; \ - esac; \ - done); \ - fi; \ - if ${CMP} -s $$newfile ${DISTINFO_FILE}; then \ - ${RM} -f $$newfile; \ - ${ECHO_MSG} "=> distinfo: patches part unchanged."; \ - else \ - ${MV} $$newfile ${DISTINFO_FILE}; \ - fi -.endif - -# This target is done by invoking a sub-make so that DISTINFO_FILE gets -# re-evaluated after the "makepatchsum" target is made. This can be -# made into: -#makedistinfo mdi: makepatchsum makesum -# once a combined distinfo file exists for all packages -.if !target(makedistinfo) -makedistinfo mdi distinfo: makepatchsum - ${_PKG_SILENT}${_PKG_DEBUG}${MAKE} makesum -.endif - -.PHONY: checksum -.if !target(checksum) -checksum: fetch uptodate-digest - ${_PKG_SILENT}${_PKG_DEBUG} \ - if [ ! -f ${DISTINFO_FILE} ]; then \ - ${ECHO_MSG} "=> No checksum file."; \ - else \ - (cd ${DISTDIR}; OK="true"; missing=""; \ - for file in "" ${_CKSUMFILES}; do \ - if [ "X$$file" = X"" ]; then continue; fi; \ - filesummed=false; \ - for a in ${DIGEST_ALGORITHMS}; do \ - CKSUM2=`${AWK} 'NF == 4 && $$1 == "'$$a'" && $$2 == "('$$file')" && $$3 == "=" {print $$4; exit}' ${DISTINFO_FILE}`; \ - case "$${CKSUM2}" in \ - "") ${ECHO_MSG} "=> No $$a checksum recorded for $$file."; \ - ;; \ - *) filesummed=true; \ - CKSUM=`${DIGEST} $$a < $$file`; \ - if [ "$$CKSUM2" = "IGNORE" ]; then \ - ${ECHO_MSG} "=> Checksum for $$file is set to IGNORE in checksum file even though"; \ - ${ECHO_MSG} " the file is not in the "'$$'"{IGNOREFILES} list."; \ - OK="false"; \ - elif [ "$$CKSUM" = "$$CKSUM2" ]; then \ - ${ECHO_MSG} "=> Checksum $$a OK for $$file."; \ - else \ - ${ECHO_MSG} "=> Checksum $$a mismatch for $$file."; \ - OK="false"; \ - fi ;; \ - esac; \ - done; \ - case "$$filesummed" in \ - false) missing="$$missing $$file"; \ - OK=false ;; \ - esac; \ - done; \ - for file in "" ${_IGNOREFILES}; do \ - if [ "X$$file" = X"" ]; then continue; fi; \ - CKSUM2=`${AWK} 'NF == 4 && $$3 == "=" && $$2 == "('$$file')"{print $$4; exit}' ${DISTINFO_FILE}`; \ - if [ "$$CKSUM2" = "" ]; then \ - ${ECHO_MSG} "=> No checksum recorded for $$file, file is in "'$$'"{IGNOREFILES} list."; \ - OK="false"; \ - elif [ "$$CKSUM2" != "IGNORE" ]; then \ - ${ECHO_MSG} "=> Checksum for $$file is not set to IGNORE in checksum file even though"; \ - ${ECHO_MSG} " the file is in the "'$$'"{IGNOREFILES} list."; \ - OK="false"; \ - fi; \ - done; \ - if [ "$$OK" != "true" ]; then \ - case "$$missing" in \ - "") ;; \ - *) ${ECHO_MSG} "Missing checksums for $$missing";; \ - esac; \ - ${ECHO_MSG} "Make sure the Makefile and checksum file (${DISTINFO_FILE})"; \ - ${ECHO_MSG} "are up to date. If you want to override this check, type"; \ - ${ECHO_MSG} "\"${MAKE} NO_CHECKSUM=yes [other args]\"."; \ - exit 1; \ - fi) ; \ - fi -.endif - - - # List of sites carrying binary pkgs. Variables "rel" and "arch" are # replaced with OS release ("1.5", ...) and architecture ("mipsel", ...) BINPKG_SITES?= \ diff --git a/mk/bsd.prefs.mk b/mk/bsd.prefs.mk index ca2fb382cf6..8970633d7f2 100644 --- a/mk/bsd.prefs.mk +++ b/mk/bsd.prefs.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.prefs.mk,v 1.228 2006/07/10 22:59:27 jlam Exp $ +# $NetBSD: bsd.prefs.mk,v 1.229 2006/07/13 14:02:34 jlam Exp $ # # Make file, included to get the site preferences, if any. Should # only be included by package Makefiles before any .if defined() @@ -443,23 +443,6 @@ COMPILER_RPATH_FLAG?= ${_COMPILER_RPATH_FLAG} WHOLE_ARCHIVE_FLAG?= ${_OPSYS_WHOLE_ARCHIVE_FLAG} NO_WHOLE_ARCHIVE_FLAG?= ${_OPSYS_NO_WHOLE_ARCHIVE_FLAG} -.if !defined(DIGEST) -DIGEST:= ${LOCALBASE}/bin/digest -MAKEFLAGS+= DIGEST=${DIGEST:Q} -.endif - -# Only add the DIGEST_VERSION value to MAKEFLAGS when we know -# we've got a valid version number, retrieved from the digest(1) -# binary. This is different to PKGTOOLS_VERSION, since, in that -# case, the build dies when pkg_info(1) is out of date. - -.if !exists(${DIGEST}) -DIGEST_VERSION= 20010301 -.elif !defined(DIGEST_VERSION) -DIGEST_VERSION!= ${DIGEST} -V 2>/dev/null -MAKEFLAGS+= DIGEST_VERSION=${DIGEST_VERSION:Q} -.endif - USE_TOOLS?= # empty # Provide default values for TOOLs used by the top-level make. diff --git a/mk/bsd.utils.mk b/mk/bsd.utils.mk index 37b5e113e57..6c1c8937234 100644 --- a/mk/bsd.utils.mk +++ b/mk/bsd.utils.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.utils.mk,v 1.6 2006/01/23 15:01:39 jlam Exp $ +# $NetBSD: bsd.utils.mk,v 1.7 2006/07/13 14:02:34 jlam Exp $ # # This Makefile fragment is included by bsd.pkg.mk and defines utility # and otherwise miscellaneous variables and targets. @@ -10,7 +10,7 @@ # DEPENDS_TYPE?= all .if !empty(DEPENDS_TYPE:Mbuild) || !empty(DEPENDS_TYPE:Mall) -_ALL_DEPENDS+= ${BUILD_DEPENDS} +_ALL_DEPENDS+= ${BOOTSTRAP_DEPENDS} ${BUILD_DEPENDS} .endif .if !empty(DEPENDS_TYPE:Minstall) || !empty(DEPENDS_TYPE:Mpackage) || \ !empty(DEPENDS_TYPE:Mall) diff --git a/mk/checksum/bsd.checksum-vars.mk b/mk/checksum/bsd.checksum-vars.mk new file mode 100644 index 00000000000..24d69faab5b --- /dev/null +++ b/mk/checksum/bsd.checksum-vars.mk @@ -0,0 +1,12 @@ +# $NetBSD: bsd.checksum-vars.mk,v 1.1 2006/07/13 14:02:34 jlam Exp $ +# +# This Makefile fragment is included separately by bsd.pkg.mk and +# defines some variables which must be defined earlier than where +# bsd.checksum.mk is included. +# +# The following variables may be set in a package Makefile: +# +# DISTINFO_FILE is the path to file containing the checksums. +# + +DISTINFO_FILE?= ${PKGDIR}/distinfo diff --git a/mk/checksum/bsd.checksum.mk b/mk/checksum/bsd.checksum.mk new file mode 100644 index 00000000000..d44a74a01f4 --- /dev/null +++ b/mk/checksum/bsd.checksum.mk @@ -0,0 +1,41 @@ +# $NetBSD: bsd.checksum.mk,v 1.1 2006/07/13 14:02:34 jlam Exp $ +# +# This Makefile fragment is included by bsd.pkg.mk and defines the +# relevant variables and targets for the "checksum" phase. +# +# The following are the "public" targets provided by this module: +# +# checksum, makesum, makepatchsum +# + +###################################################################### +### checksum, makesum, makepatchsum (PUBLIC) +###################################################################### +### checksum is a public target to checksum the fetched distfiles +### for the package. +### +### makesum is a public target to add checksums of the distfiles for +### the package to ${DISTINFO_FILE}. +### +### makepatchsum is a public target to add checksums of the patches +### for the package to ${DISTINFO_FILE}. +### +.if defined(NO_CHECKSUM) +.PHONY: checksum makesum makepatchsum +checksum makesum makepatchsum: + @${DO_NADA} +.else +. include "${PKGSRCDIR}/mk/checksum/checksum.mk" +.endif + +###################################################################### +### makedistinfo (PUBLIC) +###################################################################### +### makedistinfo is a public target to create ${DISTINFO_FILE}. +### +makedistinfo: makepatchsum makesum + @${DO_NADA} + +# Some short aliases for "makepatchsum" and "makedistinfo". +mps: makepatchsum +mdi: makedistinfo diff --git a/mk/checksum/checksum b/mk/checksum/checksum new file mode 100755 index 00000000000..070b9792ced --- /dev/null +++ b/mk/checksum/checksum @@ -0,0 +1,179 @@ +#!/bin/sh +# +# $NetBSD: checksum,v 1.1 2006/07/13 14:02:34 jlam Exp $ +# +# Copyright (c) 2006 The NetBSD Foundation, Inc. +# All rights reserved. +# +# This code is derived from software contributed to The NetBSD Foundation +# by Johnny C. Lam. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed by the NetBSD +# Foundation, Inc. and its contributors. +# 4. Neither the name of The NetBSD Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +###################################################################### +# +# NAME +# checksum -- checksum files +# +# SYNOPSIS +# checksum [options] distinfo [file ...] +# +# DESCRIPTION +# checksum will verify the checksums in the distinfo file for each +# of the files specified. +# +# OPTIONS +# -a algorithm Only verify checksums for the specified algorithm. +# +###################################################################### + +set -e # exit on errors + +: ${DIGEST:=digest} +: ${CAT:=cat} +: ${ECHO:=echo} +: ${TEST:=test} + +self="${0##*/}" + +usage() { + ${ECHO} 1>&2 "usage: $self [-a algorithm] distinfo [file ...]" +} + +# Process optional arguments +algorithm= +while ${TEST} $# -gt 0; do + case "$1" in + -a) algorithm="$2"; shift 2 ;; + --) shift; break ;; + -*) ${ECHO} 1>&2 "$self: unknown option -- ${1#-}" + usage + exit 1 + ;; + *) break ;; + esac +done + +# Process required arguments +${TEST} $# -gt 0 || { usage; exit 1; } +distinfo="$1"; shift + +if ${TEST} ! -f "$distinfo"; then + ${ECHO} 1>&2 "$self: distinfo file missing: $distinfo" + exit 1 +fi + +digestcmd= +case ${DIGEST} in +/*) + if ${TEST} -x "$i/${DIGEST}"; then + digestcmd="$i/${DIGEST}" + fi + ;; +*) + SAVEIFS="$IFS"; IFS=: + for i in $PATH; do + if ${TEST} -x "$i/${DIGEST}"; then + digestcmd="$i/${DIGEST}" + break + fi + done + IFS="$SAVEIFS" + ;; +esac + +if ${TEST} -z "$digestcmd"; then + ${ECHO} 1>&2 "$self: \`\`${DIGEST}'' is missing" + exit 1 +fi + +${CAT} $distinfo | +{ exitcode=0 + while read d_alg d_file d_equals d_checksum; do + case "$d_alg" in + "#"*) continue ;; # skip comments + "\$"*) continue ;; # skip RCS ID + "") continue ;; # skip empty lines + Size) continue ;; # skip lines holding filesizes, not checksums + esac + + if ${TEST} -n "$algorithm"; then + ${TEST} "$d_alg" = "$algorithm" || continue + fi + + eval "tmp=\$_alg_${d_alg}" + ${TEST} -n "$tmp" || eval "_alg_${d_alg}=\"$@\"" + + d_file="${d_file#(}"; d_file="${d_file%)}" + for file in "$@"; do + ${TEST} "$d_file" = "$file" || continue + + eval "tmp=\$_alg_${d_alg}" + case "$tmp" in + "$file"|"$file "*) tmp_pre= ;; + *" $file") tmp_pre="${tmp%% $file}" ;; + *) tmp_pre="${tmp%% $file *} " ;; + esac + case "$tmp" in + "$file"|*" $file") tmp_post= ;; + "$file "*) tmp_post="${tmp##$file }" ;; + *) tmp_post="${tmp##* $file }" ;; + esac + tmp="${tmp_pre}${tmp_post}" + eval "_alg_${d_alg}=\"$tmp\"" + + if ${TEST} "$d_checksum" = "IGNORE"; then + ${ECHO} 1>&2 "WARNING: Ignoring checksum for $file" + continue + fi + checksum=`${DIGEST} $d_alg < $file` + if ${TEST} "$d_checksum" = "$checksum"; then + ${ECHO} "=> Checksum $d_alg OK for $file" + else + ${ECHO} 1>&2 "ERROR: Checksum $d_alg mismatch for $file" + exitcode=1 + fi + break + done + + eval "tmp=\$_alg_${d_alg}" + ${TEST} -n "$tmp" || eval "_alg_${d_alg}=DONE" + done + if ${TEST} -n "$algorithm"; then + eval "tmp=\$_alg_${algorithm}" + ${TEST} -n "$tmp" || tmp="$@" + if ${TEST} "$tmp" != DONE; then + for file in $tmp; do + ${ECHO} 1>&2 "ERROR: No $algorithm checksum recorded for $file" + exitcode=1 + done + fi + fi + exit $exitcode; } diff --git a/mk/checksum/checksum.mk b/mk/checksum/checksum.mk new file mode 100644 index 00000000000..6215738d5e6 --- /dev/null +++ b/mk/checksum/checksum.mk @@ -0,0 +1,116 @@ +# $NetBSD: checksum.mk,v 1.1 2006/07/13 14:02:34 jlam Exp $ + +_DIGEST_ALGORITHMS?= SHA1 RMD160 +_PATCH_DIGEST_ALGORITHMS?= SHA1 + +# These variables are set by pkgsrc/mk/fetch/fetch.mk. +#_CKSUMFILES?= # empty +#_IGNOREFILES?= # empty + +###################################################################### +### checksum (PUBLIC) +###################################################################### +### checksum is a public target to checksum the fetched distfiles +### for the package. +### +_CHECKSUM_CMD= \ + ${SETENV} DIGEST=${TOOLS_DIGEST:Q} CAT=${TOOLS_CAT:Q} \ + ECHO=${TOOLS_ECHO:Q} TEST=${TOOLS_TEST:Q} \ + ${SH} ${PKGSRCDIR}/mk/checksum/checksum \ + +.PHONY: checksum +checksum: fetch +.for _alg_ in ${_DIGEST_ALGORITHMS} + ${_PKG_SILENT}${_PKG_DEBUG} \ + if cd ${DISTDIR} && ${_CHECKSUM_CMD} -a ${_alg_:Q} \ + ${DISTINFO_FILE} ${_CKSUMFILES}; then \ + ${TRUE}; \ + else \ + ${ERROR_MSG} "Make sure the Makefile and checksum file (${DISTINFO_FILE})"; \ + ${ERROR_MSG} "are up to date. If you want to override this check, type"; \ + ${ERROR_MSG} "\"${MAKE} NO_CHECKSUM=yes [other args]\"."; \ + exit 1; \ + fi +.endfor + +###################################################################### +### makesum (PUBLIC) +###################################################################### +### makesum is a public target to add checksums of the distfiles for +### the package to ${DISTINFO_FILE}. +### +.PHONY: makesum +makesum: fetch + ${_PKG_SILENT}${_PKG_DEBUG}set -e; \ + newfile=${DISTINFO_FILE}.$$$$; \ + if ${TEST} -f ${DISTINFO_FILE}; then \ + { ${GREP} '^.NetBSD' ${DISTINFO_FILE} || \ + ${ECHO} "$$""NetBSD""$$"; } > $$newfile; \ + else \ + ${ECHO} "$$""NetBSD""$$" > $$newfile; \ + fi; \ + ${ECHO} "" >> $$newfile; \ + cd ${DISTDIR}; \ + for sumfile in "" ${_CKSUMFILES}; do \ + ${TEST} -n "$$sumfile" || continue; \ + for a in "" ${_DIGEST_ALGORITHMS}; do \ + ${TEST} -n "$$a" || continue; \ + ${TOOLS_DIGEST} $$a $$sumfile >> $$newfile; \ + done; \ + ${WC} -c $$sumfile | \ + ${AWK} '{ print "Size (" $$2 ") = " $$1 " bytes" }' \ + >> $$newfile; \ + done; \ + for ignore in "" ${_IGNOREFILES}; do \ + ${TEST} -n "$$ignore" || continue; \ + for a in "" ${_DIGEST_ALGORITHMS}; do \ + ${TEST} -n "$$a" || continue; \ + ${ECHO} "$$a ($$ignore) = IGNORE" >> $$newfile; \ + done; \ + done; \ + if ${TEST} -f ${DISTINFO_FILE}; then \ + ${AWK} '$$2 ~ /\(patch-[a-z0-9]+\)/ { print $$0 }' \ + < ${DISTINFO_FILE} >> $$newfile; \ + fi; \ + if ${CMP} -s $$newfile ${DISTINFO_FILE}; then \ + ${RM} -f $$newfile; \ + ${ECHO_MSG} "=> distinfo: distfiles part unchanged."; \ + else \ + ${MV} -f $$newfile ${DISTINFO_FILE}; \ + fi + +###################################################################### +### makepatchsum (PUBLIC) +###################################################################### +### makepatchsum is a public target to add checksums of the patches +### for the package to ${DISTINFO_FILE}. +### +makepatchsum: + ${_PKG_SILENT}${_PKG_DEBUG}set -e; \ + newfile=${DISTINFO_FILE}.$$$$; \ + if ${TEST} -f ${DISTINFO_FILE}; then \ + ${AWK} '$$2 !~ /\(patch-[a-z0-9]+\)/ { print $$0 }' \ + < ${DISTINFO_FILE} >> $$newfile; \ + else \ + ${ECHO} "$$""NetBSD""$$" > $$newfile; \ + ${ECHO} "" >> $$newfile; \ + fi; \ + if ${TEST} -d ${PATCHDIR}; then \ + ( cd ${PATCHDIR}; \ + for sumfile in "" patch-*; do \ + case "$$sumfile" in \ + ""|"patch-*") continue ;; \ + patch-local-*|*.orig|*.rej|*~) continue ;; \ + esac; \ + for a in "" ${_PATCH_DIGEST_ALGORITHMS}; do \ + ${TEST} -n "$$a" || continue; \ + ${ECHO} "$$a ($$sumfile) = `${SED} -e '/\$$NetBSD.*/d' $$sumfile | ${TOOLS_DIGEST} $$a`" >> $$newfile; \ + done; \ + done ); \ + fi; \ + if ${CMP} -s $$newfile ${DISTINFO_FILE}; then \ + ${RM} -f $$newfile; \ + ${ECHO_MSG} "=> distinfo: patches part unchanged."; \ + else \ + ${MV} $$newfile ${DISTINFO_FILE}; \ + fi diff --git a/mk/depends/bsd.depends-vars.mk b/mk/depends/bsd.depends-vars.mk index 464869112b5..ca3074c98d3 100644 --- a/mk/depends/bsd.depends-vars.mk +++ b/mk/depends/bsd.depends-vars.mk @@ -1,8 +1,15 @@ -# $NetBSD: bsd.depends-vars.mk,v 1.3 2006/07/07 21:24:28 jlam Exp $ +# $NetBSD: bsd.depends-vars.mk,v 1.4 2006/07/13 14:02:34 jlam Exp $ # # This Makefile fragment is included separately by bsd.pkg.mk and # defines some variables which must be defined earlier than where # bsd.depends.mk is included. # +# The following variables may be set in a package Makefile: +# +# BOOTSTRAP_DEPENDS is a list of dependencies of the form "pattern:dir" +# for packages that should be installed before any other stage is +# invoked. +# +BOOTSTRAP_DEPENDS?= # empty _COOKIE.depends= ${WRKDIR}/.depends_done diff --git a/mk/depends/bsd.depends.mk b/mk/depends/bsd.depends.mk index 453d939e29a..759fa7f4ccd 100644 --- a/mk/depends/bsd.depends.mk +++ b/mk/depends/bsd.depends.mk @@ -1,11 +1,11 @@ -# $NetBSD: bsd.depends.mk,v 1.8 2006/07/07 21:24:28 jlam Exp $ +# $NetBSD: bsd.depends.mk,v 1.9 2006/07/13 14:02:34 jlam Exp $ # # This Makefile fragment is included by bsd.pkg.mk and provides all # variables and targets related to dependencies. # # The following are the "public" targets provided by this module: # -# depends, install-depends +# depends, bootstrap-depends, install-depends # # DEPENDS_TARGET is the target that is invoked to satisfy missing @@ -46,6 +46,19 @@ depends: depends-cookie .endif ###################################################################### +### bootstrap-depends (PUBLIC, OVERRIDE) +###################################################################### +### bootstrap-depends is a public target to install any missing +### dependencies needed during stages before the normal "depends" +### stage. These dependencies are listed in BOOTSTRAP_DEPENDS. +### +.PHONY: bootstrap-depends +.if !target(bootstrap-depends) +bootstrap-depends: + @${DO_NADA} +.endif + +###################################################################### ### install-depends (PUBLIC) ###################################################################### ### install-depends is a convenience target that installs all dependencies @@ -81,4 +94,3 @@ depends-cookie: ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${_COOKIE.depends:H} ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_ARGS} ${_COOKIE.depends} .endif - diff --git a/mk/fetch/bsd.fetch-vars.mk b/mk/fetch/bsd.fetch-vars.mk index cd4006d68b9..25e06ee95e4 100644 --- a/mk/fetch/bsd.fetch-vars.mk +++ b/mk/fetch/bsd.fetch-vars.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.fetch-vars.mk,v 1.2 2006/06/06 15:28:52 jlam Exp $ +# $NetBSD: bsd.fetch-vars.mk,v 1.3 2006/07/13 14:02:34 jlam Exp $ # # This Makefile fragment is included separately by bsd.pkg.mk and # defines some variables which must be defined earlier than where @@ -22,3 +22,8 @@ _DISTDIR= ${DISTDIR}/${DIST_SUBDIR} DISTFILES?= ${DISTNAME}${EXTRACT_SUFX} + +# "Failover" fetching requires the digest tool to compute checksums to +# verify any fetched files. +# +USE_TOOLS+= ${FAILOVER_FETCH:Ddigest\:bootstrap} diff --git a/mk/fetch/fetch.mk b/mk/fetch/fetch.mk index 1c52f1d8827..95029207035 100644 --- a/mk/fetch/fetch.mk +++ b/mk/fetch/fetch.mk @@ -1,4 +1,4 @@ -# $NetBSD: fetch.mk,v 1.5 2006/07/05 09:08:35 jlam Exp $ +# $NetBSD: fetch.mk,v 1.6 2006/07/13 14:02:34 jlam Exp $ ###################################################################### ### fetch (PUBLIC) @@ -8,7 +8,7 @@ ### .PHONY: fetch .if !target(fetch) -fetch: check-vulnerable pre-fetch do-fetch post-fetch +fetch: bootstrap-depends check-vulnerable pre-fetch do-fetch post-fetch .endif # If this host is behind a filtering firewall, use passive ftp(1) @@ -261,7 +261,7 @@ batch-check-distfiles: .PHONY: do-fetch .if !target(do-fetch) -do-fetch: ${FAILOVER_FETCH:Duptodate-digest} +do-fetch: . if !empty(_ALLFILES) ${_PKG_SILENT}${_PKG_DEBUG} \ ${TEST} -d ${_DISTDIR} || ${MKDIR} ${_DISTDIR} diff --git a/mk/flavor/pkg/depends.mk b/mk/flavor/pkg/depends.mk index a2b3fcfab8e..37c1a51cb63 100644 --- a/mk/flavor/pkg/depends.mk +++ b/mk/flavor/pkg/depends.mk @@ -1,4 +1,4 @@ -# $NetBSD: depends.mk,v 1.9 2006/07/07 21:24:28 jlam Exp $ +# $NetBSD: depends.mk,v 1.10 2006/07/13 14:02:34 jlam Exp $ _DEPENDS_FILE= ${WRKDIR}/.depends _REDUCE_DEPENDS_CMD= ${SETENV} CAT=${CAT:Q} \ @@ -72,39 +72,63 @@ depends-install: ${_DEPENDS_FILE} set -- dummy `${CAT} ${_DEPENDS_FILE}`; shift; \ while ${TEST} $$# -gt 0; do \ type="$$1"; pattern="$$2"; dir="$$3"; shift 3; \ + ${_DEPENDS_INSTALL_CMD}; \ + done + +###################################################################### +### bootstrap-depends (PUBLIC, pkgsrc/mk/depends/depends.mk) +###################################################################### +### bootstrap-depends is a public target to install any missing +### dependencies needed during stages before the normal "depends" +### stage. These dependencies are listed in BOOTSTRAP_DEPENDS. +### +.PHONY: bootstrap-depends +bootstrap-depends: + ${_PKG_SILENT}${_PKG_DEBUG}set -e; \ + args=${BOOTSTRAP_DEPENDS:S/:/ /:Q}; \ + set -- dummy $$args; shift; \ + while ${TEST} $$# -gt 0; do \ + pattern="$$1"; dir="$$2"; shift 2; \ + ${_DEPENDS_INSTALL_CMD}; \ + done + +# _DEPENDS_INSTALL_CMD expects "$pattern" to hold the dependency pattern +# and "$dir" to hold the package directory path associated with +# that dependency pattern. +# +_DEPENDS_INSTALL_CMD= \ + pkg=`${_PKG_BEST_EXISTS} "$$pattern" || ${TRUE}`; \ + case "$$pkg" in \ + "") \ + ${STEP_MSG} "Required installed package $$pattern: NOT found"; \ + target=${DEPENDS_TARGET:Q}; \ + ${STEP_MSG} "Verifying $$target for $$dir"; \ + if ${TEST} ! -d "$$dir"; then \ + ${ERROR_MSG} "[depends.mk] The directory \`\`$$dir'' does not exist."; \ + exit 1; \ + fi; \ + cd $$dir; \ + ${SETENV} _PKGSRC_DEPS=", ${PKGNAME}${_PKGSRC_DEPS}" PKGNAME_REQD="$$pattern" ${MAKE} ${MAKEFLAGS} _AUTOMATIC=yes $$target; \ pkg=`${_PKG_BEST_EXISTS} "$$pattern" || ${TRUE}`; \ case "$$pkg" in \ - "") \ - ${STEP_MSG} "Required installed package $$pattern: NOT found"; \ - target=${DEPENDS_TARGET:Q}; \ - ${STEP_MSG} "Verifying $$target for $$dir"; \ - if ${TEST} ! -d "$$dir"; then \ - ${ERROR_MSG} "[depends.mk] The directory \`\`$$dir'' does not exist."; \ - exit 1; \ - fi; \ - cd $$dir; \ - ${SETENV} _PKGSRC_DEPS=", ${PKGNAME}${_PKGSRC_DEPS}" PKGNAME_REQD="$$pattern" ${MAKE} ${MAKEFLAGS} _AUTOMATIC=yes $$target; \ - pkg=`${_PKG_BEST_EXISTS} "$$pattern" || ${TRUE}`; \ - case "$$pkg" in \ - "") ${ERROR_MSG} "[depends.mk] A package matching \`\`$$pattern'' should"; \ - ${ERROR_MSG} " be installed, but one cannot be found. Perhaps there is a"; \ - ${ERROR_MSG} " stale work directory for $$dir?"; \ - exit 1; \ - esac; \ - ${STEP_MSG} "Returning to build of ${PKGNAME}"; \ - ;; \ - *) \ - objfmt=`${PKG_INFO} -Q OBJECT_FMT "$$pkg"`; \ - case "$$objfmt" in \ - "") ${WARNING_MSG} "[depends.mk] Unknown object format for installed package $$pkg" ;; \ - ${OBJECT_FMT}) ;; \ - *) ${ERROR_MSG} "[depends.mk] Installed package $$pkg has an"; \ - ${ERROR_MSG} " object format \`\`$$objfmt'' which differs from \`\`${OBJECT_FMT}''. Please"; \ - ${ERROR_MSG} " update the $$pkg package to ${OBJECT_FMT}."; \ - exit 1; \ - ;; \ - esac; \ - ${STEP_MSG} "Required installed package $$pattern: $$pkg found"; \ + "") ${ERROR_MSG} "[depends.mk] A package matching \`\`$$pattern'' should"; \ + ${ERROR_MSG} " be installed, but one cannot be found. Perhaps there is a"; \ + ${ERROR_MSG} " stale work directory for $$dir?"; \ + exit 1; \ + esac; \ + ${STEP_MSG} "Returning to build of ${PKGNAME}"; \ + ;; \ + *) \ + objfmt=`${PKG_INFO} -Q OBJECT_FMT "$$pkg"`; \ + case "$$objfmt" in \ + "") ${WARNING_MSG} "[depends.mk] Unknown object format for installed package $$pkg" ;; \ + ${OBJECT_FMT}) ;; \ + *) ${ERROR_MSG} "[depends.mk] Installed package $$pkg has an"; \ + ${ERROR_MSG} " object format \`\`$$objfmt'' which differs from \`\`${OBJECT_FMT}''. Please"; \ + ${ERROR_MSG} " update the $$pkg package to ${OBJECT_FMT}."; \ + exit 1; \ ;; \ esac; \ - done + ${STEP_MSG} "Required installed package $$pattern: $$pkg found"; \ + ;; \ + esac diff --git a/mk/install/bsd.install-vars.mk b/mk/install/bsd.install-vars.mk index a00828d7dee..e95c317775d 100644 --- a/mk/install/bsd.install-vars.mk +++ b/mk/install/bsd.install-vars.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.install-vars.mk,v 1.2 2006/06/06 15:28:52 jlam Exp $ +# $NetBSD: bsd.install-vars.mk,v 1.3 2006/07/13 14:02:34 jlam Exp $ # # This Makefile fragment is included separately by bsd.pkg.mk and # defines some variables which must be defined earlier than where @@ -19,9 +19,8 @@ NO_MTREE= yes .if (${PKG_INSTALLATION_TYPE} == "pkgviews") && defined(CROSSBASE) NO_MTREE= yes .endif -.if !defined(NO_MTREE) -USE_TOOLS+= mtree -.endif + +USE_TOOLS+= ${NO_MTREE:D:Umtree\:bootstrap} # If MANZ is defined, then we want the final man pages to be compressed. # If MANZ is not defined, then we want the final man pages to be diff --git a/mk/patch/bsd.patch-vars.mk b/mk/patch/bsd.patch-vars.mk index 418b51965da..c487713c018 100644 --- a/mk/patch/bsd.patch-vars.mk +++ b/mk/patch/bsd.patch-vars.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.patch-vars.mk,v 1.2 2006/06/06 15:28:52 jlam Exp $ +# $NetBSD: bsd.patch-vars.mk,v 1.3 2006/07/13 14:02:34 jlam Exp $ # # This Makefile fragment is included separately by bsd.pkg.mk and # defines some variables which must be defined earlier than where @@ -31,6 +31,11 @@ USE_TOOLS+= patch .endif +.if (defined(PATCHDIR) && exists(${PATCHDIR})) || \ + (defined(LOCALPATCHES) && exists(${LOCALPATCHES}/${PKGPATH})) +USE_TOOLS+= digest:bootstrap +.endif + # These tools are used to output the contents of the distribution patches # to stdout. # diff --git a/mk/patch/patch.mk b/mk/patch/patch.mk index c4e0984732b..259f1f5f153 100644 --- a/mk/patch/patch.mk +++ b/mk/patch/patch.mk @@ -1,4 +1,4 @@ -# $NetBSD: patch.mk,v 1.8 2006/07/07 21:24:29 jlam Exp $ +# $NetBSD: patch.mk,v 1.9 2006/07/13 14:02:34 jlam Exp $ # # The following variables may be set in a package Makefile and control # how pkgsrc patches are applied. @@ -124,7 +124,6 @@ patch-cookie: ### .PHONY: pre-patch do-patch post-patch -_PKGSRC_PATCH_TARGETS+= uptodate-digest .if defined(PATCHFILES) _PKGSRC_PATCH_TARGETS+= distribution-patch-message _PKGSRC_PATCH_TARGETS+= do-distribution-patch @@ -295,7 +294,7 @@ do-pkgsrc-patch: set -- $$algsum; \ alg="$$1"; \ recorded="$$2"; \ - calcsum=`${SED} -e '/\$$NetBSD.*/d' $$i | ${DIGEST} $$alg`; \ + calcsum=`${SED} -e '/\$$NetBSD.*/d' $$i | ${TOOLS_DIGEST} $$alg`; \ ${ECHO_PATCH_MSG} "Verifying $$filename (using digest algorithm $$alg)"; \ if ${TEST} "$$calcsum" != "$$recorded"; then \ patch_warning "Ignoring patch file $$i: invalid checksum"; \ diff --git a/mk/tools/bsd.tools.mk b/mk/tools/bsd.tools.mk index 2c1b56d32f8..90278b9ae14 100644 --- a/mk/tools/bsd.tools.mk +++ b/mk/tools/bsd.tools.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.tools.mk,v 1.42 2006/07/07 21:24:29 jlam Exp $ +# $NetBSD: bsd.tools.mk,v 1.43 2006/07/13 14:02:34 jlam Exp $ # # Copyright (c) 2005, 2006 The NetBSD Foundation, Inc. # All rights reserved. @@ -143,6 +143,7 @@ post-tools: @${DO_NADA} .endif +.include "${PKGSRCDIR}/mk/tools/digest.mk" .include "${PKGSRCDIR}/mk/tools/automake.mk" .include "${PKGSRCDIR}/mk/tools/autoconf.mk" .include "${PKGSRCDIR}/mk/tools/texinfo.mk" diff --git a/mk/tools/digest.mk b/mk/tools/digest.mk new file mode 100644 index 00000000000..ecbf9c26117 --- /dev/null +++ b/mk/tools/digest.mk @@ -0,0 +1,80 @@ +# $NetBSD: digest.mk,v 1.1 2006/07/13 14:02:34 jlam Exp $ +# +# Copyright (c) 2006 The NetBSD Foundation, Inc. +# All rights reserved. +# +# This code is derived from software contributed to The NetBSD Foundation +# by Johnny C. Lam. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed by the NetBSD +# Foundation, Inc. and its contributors. +# 4. Neither the name of The NetBSD Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +# +# This Makefile fragment defines additional variables that are used +# by packages that need digest. +# +# Optional variables that may be defined by the package are: +# +# DIGEST_REQD is the minimum version of digest required. +# +# This file needs to be included before replace.mk as it uses the +# replace.mk magic to set the TOOLS_DIGEST and DIGEST variables. +# + +DIGEST_REQD?= 20010302 + +.if !defined(TOOLS_IGNORE.digest) && !empty(USE_TOOLS:C/:.*//:Mdigest) +. if !empty(PKGPATH:Mpkgtools/digest) +MAKEFLAGS+= TOOLS_IGNORE.digest= +. else +. if defined(TOOLS_PLATFORM.digest) && !empty(TOOLS_PLATFORM.digest) +_TOOLS_USE_PKGSRC.digest?= no +. if !defined(_TOOLS_VERSION.digest) +_TOOLS_VERSION.digest!= \ + ${TOOLS_PLATFORM.digest} -V 2>/dev/null || ${ECHO} 20010301 +_TOOLS_USE_PKGSRC.digest!= \ + if ${PKG_ADMIN} pmatch "digest>="${DIGEST_REQD:Q} \ + digest-${_TOOLS_VERSION.digest:Q}; then \ + ${ECHO} no; \ + else \ + ${ECHO} yes; \ + fi +. endif +MAKEVARS+= _TOOLS_USE_PKGSRC.digest +. else +_TOOLS_USE_PKGSRC.digest= yes +. endif +. if !empty(_TOOLS_USE_PKGSRC.digest:M[yY][eE][sS]) +TOOLS_DEPENDS.digest?= digest>=${DIGEST_REQD}:../../pkgtools/digest +TOOLS_CREATE+= digest +TOOLS_FIND_PREFIX+= TOOLS_PREFIX.digest=digest +TOOLS_PATH.digest= ${TOOLS_PREFIX.digest}/bin/digest +. endif +. endif +.endif diff --git a/mk/tools/replace.mk b/mk/tools/replace.mk index 7da449f1eb6..4191d5af3bc 100644 --- a/mk/tools/replace.mk +++ b/mk/tools/replace.mk @@ -1,4 +1,4 @@ -# $NetBSD: replace.mk,v 1.173 2006/07/10 22:17:58 jlam Exp $ +# $NetBSD: replace.mk,v 1.174 2006/07/13 14:02:34 jlam Exp $ # # Copyright (c) 2005 The NetBSD Foundation, Inc. # All rights reserved. @@ -127,9 +127,13 @@ PKG_FAIL_REASON+= "\`\`bison'' and \`\`byacc'' conflict in USE_TOOLS." # Set the type of dependency requested for the tool. The type of # dependency is determined by the modifier specified for each tool: # +# BOOTSTRAP_DEPENDS: :bootstrap # BUILD_DEPENDS: :build (default), :pkgsrc # DEPENDS: :run # +.for _t_ in ${USE_TOOLS:N*\:*} ${USE_TOOLS:M*\:bootstrap} +_TOOLS_DEPMETHOD.${_t_:C/:.*//}= BOOTSTRAP_DEPENDS +.endfor .for _t_ in ${USE_TOOLS:N*\:*} ${USE_TOOLS:M*\:build} ${USE_TOOLS:M*\:pkgsrc} _TOOLS_DEPMETHOD.${_t_:C/:.*//}= BUILD_DEPENDS .endfor |