aboutsummaryrefslogtreecommitdiff
path: root/Mk/bsd.port.mk
diff options
context:
space:
mode:
authorPav Lucistnik <pav@FreeBSD.org>2007-04-02 22:44:52 +0000
committerPav Lucistnik <pav@FreeBSD.org>2007-04-02 22:44:52 +0000
commit4c21980b8385ad7bb1df445a43f1f04361d8ddc1 (patch)
tree1985e9f3b56d5ec48c535bbd28e6c78b804c9425 /Mk/bsd.port.mk
parent90c48348fe2e4198f290411662f061d3c993c488 (diff)
downloadports-4c21980b8385ad7bb1df445a43f1f04361d8ddc1.tar.gz
ports-4c21980b8385ad7bb1df445a43f1f04361d8ddc1.zip
Notes
Diffstat (limited to 'Mk/bsd.port.mk')
-rw-r--r--Mk/bsd.port.mk176
1 files changed, 86 insertions, 90 deletions
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 7a5dbc2716c3..c469db05f239 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -3301,16 +3301,25 @@ check-vulnerable:
fi
.endif
+# set alg to any of SIZE, MD5, SHA256 (or any other checksum algorithm):
+DISTINFO_DATA?= DIR=${DIST_SUBDIR}; ${AWK} -v alg=$$alg \
+ -v file=$${DIR:+$$DIR/}$${file\#\#*/} \
+ '$$1 == alg && $$2 == "(" file ")" {print $$4}' ${MD5_FILE}
+
# Fetch
.if !target(do-fetch)
do-fetch:
@${MKDIR} ${_DISTDIR}
- @(cd ${_DISTDIR}; \
+ @cd ${_DISTDIR};\
${_MASTER_SITES_ENV} ; \
for _file in ${DISTFILES}; do \
- file=`${ECHO_CMD} $$_file | ${SED} -E -e 's/:[^:]+$$//'` ; \
- select=`${ECHO_CMD} $${_file#$${file}} | ${SED} -e 's/^://' -e 's/,/ /g'` ; \
+ file=$${_file%%:*}; \
+ if [ $$_file = $$file ]; then \
+ select=''; \
+ else \
+ select=`${ECHO_CMD} $${_file##*:} | ${SED} -e 's/,/ /g'` ; \
+ fi; \
force_fetch=false; \
filebasename=`${BASENAME} $$file`; \
for afile in ${FORCE_FETCH}; do \
@@ -3320,8 +3329,6 @@ do-fetch:
fi; \
done; \
if [ ! -f $$file -a ! -f $$filebasename -o "$$force_fetch" = "true" ]; then \
- DIR=${DIST_SUBDIR}; \
- pattern="$${DIR:+$$DIR/}`${ECHO_CMD} $$file | ${SED} -e 's/\./\\\\./g'`"; \
if [ -L $$file -o -L $$filebasename ]; then \
${ECHO_MSG} "=> ${_DISTDIR}/$$file is a broken symlink."; \
${ECHO_MSG} "=> Perhaps a filesystem (most likely a CD) isn't mounted?"; \
@@ -3329,7 +3336,8 @@ do-fetch:
exit 1; \
fi ; \
if [ -f ${MD5_FILE} -a "x${NO_CHECKSUM}" = "x" ]; then \
- if ! ${GREP} -q "^MD5 ($$pattern)" ${MD5_FILE}; then \
+ _md5sum=`alg=MD5; ${DISTINFO_DATA}`; \
+ if [ -z "$$_md5sum" ]; then \
${ECHO_MSG} "=> $${DIR:+$$DIR/}$$file is not in ${MD5_FILE}."; \
${ECHO_MSG} "=> Either ${MD5_FILE} is out of date, or"; \
${ECHO_MSG} "=> $${DIR:+$$DIR/}$$file is spelled incorrectly."; \
@@ -3356,8 +3364,7 @@ do-fetch:
fi ; \
for site in `eval $$SORTED_MASTER_SITES_CMD_TMP ${_RANDOMIZE_SITES}`; do \
${ECHO_MSG} "=> Attempting to fetch from $${site}."; \
- DIR=${DIST_SUBDIR}; \
- CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
+ CKSIZE=`alg=SIZE; ${DISTINFO_DATA}`; \
case $${file} in \
*/*) ${MKDIR} $${file%/*}; \
args="-o $${file} $${site}$${file}";; \
@@ -3371,10 +3378,10 @@ do-fetch:
${ECHO_MSG} "=> port manually into ${_DISTDIR} and try again."; \
exit 1; \
fi \
- done)
+ done
.if defined(PATCHFILES)
- @(cd ${_DISTDIR}; \
- ${_PATCH_SITES_ENV} ; \
+ @cd ${_DISTDIR};\
+ ${_PATCH_SITES_ENV} ; \
for _file in ${PATCHFILES}; do \
file=`${ECHO_CMD} $$_file | ${SED} -E -e 's/:[^:]+$$//'` ; \
select=`${ECHO_CMD} $${_file#$${file}} | ${SED} -e 's/^://' -e 's/,/ /g'` ; \
@@ -3409,9 +3416,7 @@ do-fetch:
fi ; \
for site in `eval $$SORTED_PATCH_SITES_CMD_TMP`; do \
${ECHO_MSG} "=> Attempting to fetch from $${site}."; \
- DIR=${DIST_SUBDIR}; \
- pattern="$${DIR:+$$DIR/}`${ECHO_CMD} $$file | ${SED} -e 's/\./\\\\./g'`"; \
- CKSIZE=`${GREP} "^SIZE ($$pattern)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
+ CKSIZE=`alg=SIZE; ${DISTINFO_DATA}`; \
case $${file} in \
*/*) ${MKDIR} $${file%/*}; \
args="-o $${file} $${site}$${file}";; \
@@ -3425,7 +3430,7 @@ do-fetch:
${ECHO_MSG} "=> port manually into ${_DISTDIR} and try again."; \
exit 1; \
fi \
- done)
+ done
.endif
.endif
@@ -4468,8 +4473,8 @@ fetch-list:
continue; \
fi; \
fi; \
- DIR=${DIST_SUBDIR}; \
- CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
+ DIR=${DIST_SUBDIR};\
+ CKSIZE=`alg=SIZE; ${DISTINFO_DATA}`; \
case $${file} in \
*/*) args="-o $${file} $${site}$${file}";; \
*) args=$${site}$${file};; \
@@ -4500,8 +4505,7 @@ fetch-list:
SORTED_PATCH_SITES_CMD_TMP="${SORTED_PATCH_SITES_DEFAULT_CMD}" ; \
fi ; \
for site in `eval $$SORTED_PATCH_SITES_CMD_TMP ${_RANDOMIZE_SITES}`; do \
- DIR=${DIST_SUBDIR}; \
- CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
+ CKSIZE=`alg=SIZE; ${DISTINFO_DATA}`; \
case $${file} in \
*/*) args="-o $${file} $${site}$${file}";; \
*) args=$${site}$${file};; \
@@ -4578,15 +4582,10 @@ makesum: check-checksum-algorithms
.if !target(checksum)
checksum: fetch check-checksum-algorithms
- @ \
- \
- ${checksum_init} \
- \
+ @${checksum_init} \
if [ -f ${MD5_FILE} ]; then \
- ( cd ${DISTDIR}; OK=""; \
+ cd ${DISTDIR}; OK="";\
for file in ${_CKSUMFILES}; do \
- pattern="`${ECHO_CMD} $$file | ${SED} -e 's/\./\\\\./g'`"; \
- \
ignored="true"; \
for alg in ${CHECKSUM_ALGORITHMS:U}; do \
ignore="false"; \
@@ -4594,7 +4593,7 @@ checksum: fetch check-checksum-algorithms
\
if [ $$alg_executable != "NO" ]; then \
MKSUM=`$$alg_executable < $$file`; \
- CKSUM=`${GREP} "^$$alg ($$pattern)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
+ CKSUM=`${DISTINFO_DATA}`; \
else \
ignore="true"; \
fi; \
@@ -4639,8 +4638,6 @@ checksum: fetch check-checksum-algorithms
done; \
\
for file in ${_IGNOREFILES}; do \
- pattern="`${ECHO_CMD} $$file | ${SED} -e 's/\./\\\\./g'`"; \
- \
ignored="true"; \
alreadymatched="false"; \
for alg in ${CHECKSUM_ALGORITHMS:U}; do \
@@ -4648,7 +4645,7 @@ checksum: fetch check-checksum-algorithms
eval alg_executable=\$$$$alg; \
\
if [ $$alg_executable != "NO" ]; then \
- CKSUM=`${GREP} "^$$alg ($$pattern)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
+ CKSUM=`${DISTINFO_DATA}`; \
else \
ignore="true"; \
fi; \
@@ -4696,7 +4693,6 @@ checksum: fetch check-checksum-algorithms
if [ "$$OK" != "true" ]; then \
exit 1; \
fi \
- ); \
elif [ -n "${_CKSUMFILES:M*}" ]; then \
${ECHO_MSG} "=> No checksum file (${MD5_FILE})."; \
fi
@@ -5014,62 +5010,60 @@ fetch-recursive-list:
done
.endif
+# Used by fetch-required and fetch-required list, this script looks
+# at each of the dependencies. If 3 items are specified in the tuple,
+# such as foo:${PORTSDIR}/graphics/foo:extract, the first item (foo)
+# is examined. Only if it begins with a / and does not exist on the
+# file-system will ``make targ'' proceed.
+# For more usual (dual-item) dependency tuples, the ``make targ''
+# proceeds, if the exact package, which the directory WOULD'VE installed,
+# is not yet installed.
+# This is the exact behaviour of the old code, and it may need
+# revisiting. For example, the entire first case seems dubious, and in
+# the second case we, probably, should be satisfied with _any_ (earlier)
+# package, with the same origin as that of the dir.
+#
+# -mi
+FETCH_LIST?= for i in $$deps; do \
+ prog=$${i%%:*}; dir=$${i\#*:}; \
+ case $$dir in \
+ *:*) if [ $$prog != $${prog\#/} -o ! -e $$prog ]; then \
+ dir=$${dir%%:*}; \
+ else \
+ continue; \
+ fi;; \
+ *) if [ -d ${PKG_DBDIR}/$$(cd $$dir; ${MAKE} -V PKGNAME) ]; then \
+ continue; \
+ fi;; \
+ esac; \
+ echo cd $$dir; ${MAKE} $$targ; \
+ done
+
.if !target(fetch-required)
fetch-required: fetch
+.if defined(NO_DEPENDS)
+ @${ECHO_MSG} "===> NO_DEPENDS is set, not fetching any distfiles for ${PKG_NAME}"
+.else
@${ECHO_MSG} "===> Fetching all required distfiles for ${PKGNAME} and dependencies"
.for deptype in EXTRACT PATCH FETCH BUILD RUN
.if defined(${deptype}_DEPENDS)
-.if !defined(NO_DEPENDS)
- @for i in ${${deptype}_DEPENDS}; do \
- prog=`${ECHO_CMD} $$i | ${CUT} -f 1 -d ':'`; \
- dir=`${ECHO_CMD} $$i | ${CUT} -f 2-999 -d ':'`; \
- if ${EXPR} "$$dir" : '.*:' > /dev/null; then \
- dir=`${ECHO_CMD} $$dir | ${CUT} -f 1 -d ':'`; \
- if ${EXPR} "$$prog" : \\/ >/dev/null; then \
- if [ ! -e "$$prog" ]; then \
- (cd $$dir; ${MAKE} fetch); \
- fi; \
- fi; \
- else \
- (cd $$dir; \
- tmp=`${MAKE} -V PKGNAME`; \
- if [ ! -d ${PKG_DBDIR}/$${tmp} ]; then \
- ${MAKE} fetch; \
- fi ); \
- fi; \
- done
-.endif
+ @targ=fetch; deps="${${deptype}_DEPENDS}"; ${FETCH_LIST}
.endif
.endfor
.endif
+.endif
+
.if !target(fetch-required-list)
fetch-required-list: fetch-list
+.if !defined(NO_DEPENDS)
.for deptype in EXTRACT PATCH FETCH BUILD RUN
.if defined(${deptype}_DEPENDS)
-.if !defined(NO_DEPENDS)
- @for i in ${${deptype}_DEPENDS}; do \
- prog=`${ECHO_CMD} $$i | ${CUT} -f 1 -d ':'`; \
- dir=`${ECHO_CMD} $$i | ${CUT} -f 2-999 -d ':'`; \
- if ${EXPR} "$$dir" : '.*:' > /dev/null; then \
- dir=`${ECHO_CMD} $$dir | ${CUT} -f 1 -d ':'`; \
- if ${EXPR} "$$prog" : \\/ >/dev/null; then \
- if [ ! -e "$$prog" ]; then \
- (cd $$dir; ${MAKE} fetch-list); \
- fi; \
- fi; \
- else \
- (cd $$dir; \
- tmp=`${MAKE} -V PKGNAME`; \
- if [ ! -d ${PKG_DBDIR}/$${tmp} ]; then \
- ${MAKE} fetch-list; \
- fi ); \
- fi; \
- done
-.endif
+ @targ=fetch-list; deps="${${deptype}_DEPENDS}"; ${FETCH_LIST}
.endif
.endfor
.endif
+.endif
.if !target(checksum-recursive)
checksum-recursive:
@@ -5087,7 +5081,7 @@ build-depends-list:
.endif
BUILD-DEPENDS-LIST= \
- for dir in $$(${ECHO_CMD} "${EXTRACT_DEPENDS} ${PATCH_DEPENDS} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS}" | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | ${SORT} -u); do \
+ for dir in $$(${ECHO_CMD} "${EXTRACT_DEPENDS} ${PATCH_DEPENDS} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS}" | ${SED} -E -e 's,([^: ]*):([^: ]*)(:[^ ]*)?,\2,g' -e 'y/ /\n/'| ${SORT} -u); do \
if [ -d $$dir ]; then \
${ECHO_CMD} $$dir; \
else \
@@ -5101,7 +5095,7 @@ run-depends-list:
.endif
RUN-DEPENDS-LIST= \
- for dir in $$(${ECHO_CMD} "${LIB_DEPENDS} ${RUN_DEPENDS}" | ${SED} -e 'y/ /\n/' | ${CUT} -f 2 -d ':' | ${SORT} -u); do \
+ for dir in $$(${ECHO_CMD} "${_LIB_RUN_DEPENDS:C,.*:([^:]*).*,\1,}" | ${SED} -e 'y/ /\n/' | ${SORT} -u); do \
if [ -d $$dir ]; then \
${ECHO_CMD} $$dir; \
else \
@@ -5117,6 +5111,7 @@ package-depends-list:
@${PACKAGE-DEPENDS-LIST}
.endif
+_LIB_RUN_DEPENDS= ${LIB_DEPENDS} ${RUN_DEPENDS}
PACKAGE-DEPENDS-LIST?= \
if [ "${CHILD_DEPENDS}" ]; then \
installed=$$(${PKG_INFO} -qO ${PKGORIGIN} 2>/dev/null || \
@@ -5132,21 +5127,22 @@ PACKAGE-DEPENDS-LIST?= \
done; \
fi; \
checked="${PARENT_CHECKED}"; \
- for dir in $$(${ECHO_CMD} "${LIB_DEPENDS} ${RUN_DEPENDS}" | ${SED} -e 'y/ /\n/' | ${CUT} -f 2 -d ':'); do \
+ for dir in ${_LIB_RUN_DEPENDS:C,[^:]*:([^:]*):?.*,\1,}; do \
dir=$$(${REALPATH} $$dir); \
if [ -d $$dir ]; then \
- if (${ECHO_CMD} $$checked | ${GREP} -qwv "$$dir"); then \
- childout=$$(cd $$dir; ${MAKE} CHILD_DEPENDS=yes PARENT_CHECKED="$$checked" package-depends-list); \
- set -- $$childout; \
- childdir=""; \
- while [ $$\# != 0 ]; do \
- childdir="$$childdir $$2"; \
- ${ECHO_CMD} "$$1 $$2 $$3"; \
- shift 3; \
- done; \
- checked="$$dir $$childdir $$checked"; \
- fi; \
- else \
+ case $$checked in \
+ $$dir|$$dir\ *|*\ $$dir|*\ $$dir\ *) continue;; \
+ esac; \
+ childout=$$(cd $$dir; ${MAKE} CHILD_DEPENDS=yes PARENT_CHECKED="$$checked" package-depends-list); \
+ set -- $$childout; \
+ childdir=""; \
+ while [ $$\# != 0 ]; do \
+ childdir="$$childdir $$2"; \
+ ${ECHO_CMD} "$$1 $$2 $$3"; \
+ shift 3; \
+ done; \
+ checked="$$dir $$childdir $$checked"; \
+ else \\
${ECHO_MSG} "${PKGNAME}: \"$$dir\" non-existent -- dependency list incomplete" >&2; \
fi; \
done
@@ -5166,7 +5162,7 @@ package-recursive: package
# Show missing dependiencies
missing:
@for dir in $$(${ALL-DEPENDS-LIST}); do \
- THISORIGIN=$$(${ECHO_CMD} $$dir | ${SED} 's,${PORTSDIR}/,,'); \
+ THISORIGIN=$${dir##${PORTSDIR}/}; \
installed=$$(${PKG_INFO} -qO $${THISORIGIN}); \
if [ -z "$$installed" ]; then \
${ECHO_CMD} $$THISORIGIN; \
@@ -5369,7 +5365,7 @@ generate-plist:
@${ECHO_CMD} '@cwd ${PREFIX}' >> ${TMPPLIST}
.endif
@for i in $$(${ECHO_CMD} ${__MANPAGES} ${_TMLINKS:M${_PREFIX}*:S|^${_PREFIX}/||} ' ' | ${SED} -E -e 's|man([1-9ln])/([^/ ]+) |cat\1/\2 |g'); do \
- ${ECHO_CMD} "@unexec rm -f %D/$${i%.gz} %D/$${i%.gz}.gz" >> ${TMPPLIST}; \
+ ${ECHO_CMD} "@unexec rm -f %D/$$i %D/$${i%.gz} %D/$${i%.bz2} %D/$$i.gz %D/$$i.bz2" >> ${TMPPLIST}; \
done
.endfor
@if [ -f ${PLIST} ]; then \
@@ -5382,7 +5378,7 @@ generate-plist:
.endfor
.for dir in ${PLIST_DIRS}
- @${ECHO_CMD} ${dir} | ${SED} ${PLIST_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} | ${SED} -e 's,^,@dirrm ,' >> ${TMPPLIST}
+ @${ECHO_CMD} ${dir} | ${SED} ${PLIST_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} -e 's,^,@dirrm ,' >> ${TMPPLIST}
.endfor
# To be removed once INSTALLS_SHLIB has been eradicated.
.if defined(INSTALLS_SHLIB) && !defined(INSTALL_AS_USER)
@@ -5564,7 +5560,7 @@ fake-pkg:
if [ -f ${PKGMESSAGE} ]; then \
${CP} ${PKGMESSAGE} ${PKG_DBDIR}/${PKGNAME}/+DISPLAY; \
fi; \
- for dep in `${PKG_INFO} -qf ${PKGNAME} | ${GREP} -w ^@pkgdep | ${AWK} '{print $$2}' | ${SORT} -u`; do \
+ for dep in `${PKG_INFO} -qf ${PKGNAME} | ${AWK} '/^@pkgdep / {print $$2}' | ${SORT} -u`; do \
if [ -d ${PKG_DBDIR}/$$dep -a -z `${ECHO_CMD} $$dep | ${GREP} -E ${PKG_IGNORE_DEPENDS}` ]; then \
if ! ${GREP} ^${PKGNAME}$$ ${PKG_DBDIR}/$$dep/+REQUIRED_BY \
>/dev/null 2>&1; then \