summaryrefslogtreecommitdiff
path: root/mk/configure
diff options
context:
space:
mode:
authorrillig <rillig>2006-11-09 02:53:15 +0000
committerrillig <rillig>2006-11-09 02:53:15 +0000
commit394e684cbbde53918b135a64dc7d92164223953c (patch)
treef288e89bbcdc9a6720db069493d3c910a194766b /mk/configure
parent1e906ce7ab6fae585472440ca86bd1b29eb7eb9d (diff)
downloadpkgsrc-394e684cbbde53918b135a64dc7d92164223953c.tar.gz
Moved the portability checks from the configure/ directory to checks/,
since according to the comment in check/bsd.check.mk, they belong there. Added a new check for all C and C++ header files to make sure they don't contain strings like ${prefix} or ${exec_prefix}, which is currently a problem with sysutils/dbus and has been noticed in PR 35019. This check is disabled by default since I don't know anything about possible false positives, but I plan to enable it for PKG_DEVELOPERs after some testing. Added two names for hooks that are placed in the configure and in the build phase. Now the checks look more like becoming something one could call a framework, sharing a common structure and a documented interface.
Diffstat (limited to 'mk/configure')
-rw-r--r--mk/configure/check-portability.mk48
-rw-r--r--mk/configure/check-portability.sh115
-rw-r--r--mk/configure/configure.mk8
3 files changed, 6 insertions, 165 deletions
diff --git a/mk/configure/check-portability.mk b/mk/configure/check-portability.mk
deleted file mode 100644
index 741ebc1b6ac..00000000000
--- a/mk/configure/check-portability.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-# $NetBSD: check-portability.mk,v 1.8 2006/10/26 14:42:53 tv Exp $
-#
-# This file contains some checks that are applied to the configure
-# scripts to check for certain constructs that are known to cause
-# problems on some platforms.
-#
-# The following variables may be set by the pkgsrc user in mk.conf:
-#
-# CHECK_PORTABILITY: YesNo
-# Whether to enable some portability checks for the configure
-# scripts before they are run.
-#
-# Default value: yes for PKG_DEVELOPERs, no otherwise.
-#
-# The following variables may be set by the package:
-#
-# SKIP_PORTABILITY_CHECK: YesNo
-# Whether the above checks should be skipped for the current
-# package.
-#
-# Default value: no
-#
-# CHECK_PORTABILITY_SKIP: List of Pathmask
-# The list of files that should be skipped in the portability
-# check.
-#
-# Default value: empty.
-#
-
-.if defined(PKG_DEVELOPER)
-CHECK_PORTABILITY?= yes
-.endif
-CHECK_PORTABILITY?= no
-SKIP_PORTABILITY_CHECK?= no
-CHECK_PORTABILITY_SKIP?= # none
-
-.if ${CHECK_PORTABILITY:M[Yy][Ee][Ss]} != "" && \
- ${SKIP_PORTABILITY_CHECK:M[Yy][Ee][Ss]} == ""
-do-configure-pre-hook: _configure-check-for-test
-.endif
-.PHONY: _configure-check-for-test
-_configure-check-for-test:
- @${STEP_MSG} "Checking for portability problems in extracted files"
- ${_PKG_SILENT}${_PKG_DEBUG} \
- [ -d ${WRKSRC}/. ] || exit 0; \
- cd ${WRKSRC} \
- && env SKIP_FILTER=${CHECK_PORTABILITY_SKIP:@p@${p}) continue;;@:Q} \
- sh ${PKGSRCDIR}/mk/configure/check-portability.sh
diff --git a/mk/configure/check-portability.sh b/mk/configure/check-portability.sh
deleted file mode 100644
index 079571017f9..00000000000
--- a/mk/configure/check-portability.sh
+++ /dev/null
@@ -1,115 +0,0 @@
-# $NetBSD: check-portability.sh,v 1.5 2006/10/29 20:12:49 rillig Exp $
-#
-# This program checks the extracted files for portability issues that
-# are likely to result in false assumptions by the package.
-#
-# The most prominent example is the "==" operator of test(1), which is
-# only implemented by bash and some versions of the ksh.
-#
-# Note: because this program is run with the tools wrapper directory in
-# the PATH, it calls the utilities by their base names. It also assumes
-# to be interpreted by a POSIX-conforming shell.
-#
-# ENVIRONMENT VARIABLES
-#
-# SKIP_FILTER: A shell command that excludes some patterns.
-#
-# See also:
-# mk/configure/check-portability.mk
-#
-
-set -eu
-
-: ${SKIP:=""}
-
-exitcode=0
-
-last_heading=""
-
-error_msg() {
- echo "ERROR: [check-portability.sh] $*" 1>&2
- exitcode=1
-}
-
-warning_msg() {
- echo "WARNING: [check-portability.sh] $*" 1>&2
-}
-
-error_heading() {
- if test "$1" != "$last_heading"; then
- last_heading="$1"
- error_msg "=> $1"
- fi
-}
-
-warning_heading() {
- if test "$1" != "$last_heading"; then
- last_heading="$1"
- warning_msg "=> $1"
- fi
-}
-
-# usage: check_shell <fname>
-check_shell() {
- # See the end of the loop for the redirection.
- while read line; do
-
- # Note: This code does not find _all_ instances of
- # unportable code. If a single line contains an unsafe and
- # a safe usage of $RANDOM, it will pass the test.
-
- # Strip comments.
- # Note: this has the side-effect that the # in $# is also
- # regarded as a comment.
- line="${line%%#*}"
-
- # Check for $RANDOM, which is specific to ksh and bash.
- case "$line" in
- *"\$\$-\$RANDOM"* \
- | *"\$RANDOM-\$\$"* \
- | *"\$RANDOM"[A-Z_]*)
- # When $RANDOM is prefixed by the process ID, it
- # doesn't matter too much if $RANDOM is empty.
- # This code is often found in GNU configure scripts.
- ;;
-
- *\$RANDOM*)
- warning_heading "Found \$RANDOM:"
- warning_msg "$fname: $line"
- ;;
- esac
-
- #
- # Split the line into words and check them.
- #
- set args $line; shift
- while [ $# -ge 3 ]; do
- case "$1" in
- "test" | "[")
- if [ "==" = "$3" ]; then
- error_heading "Found test ... == ...:"
- error_msg "$fname: $line"
- fi
- ;;
- esac
- shift
- done
-
- done < "$1"
-}
-
-find * -type f -print 2>/dev/null \
-| {
- while read fname; do
-
- eval "case \"\$fname\" in $SKIP_FILTER *.orig) continue;; esac"
-
- read firstline < "$fname" || continue
- case "$firstline" in
- "#!"*"/bin/sh")
- check_shell "$fname"
- ;;
- esac
- done
- exit $exitcode
-}
diff --git a/mk/configure/configure.mk b/mk/configure/configure.mk
index d041b9e079d..ed202251d42 100644
--- a/mk/configure/configure.mk
+++ b/mk/configure/configure.mk
@@ -1,4 +1,4 @@
-# $NetBSD: configure.mk,v 1.11 2006/10/12 17:57:05 rillig Exp $
+# $NetBSD: configure.mk,v 1.12 2006/11/09 02:53:15 rillig Exp $
#
# CONFIGURE_SCRIPT is the path to the script to run in order to
# configure the software for building. If the path is relative,
@@ -32,7 +32,6 @@ _BUILD_DEFS+= CONFIGURE_ENV CONFIGURE_ARGS
.if defined(USE_PKGLOCALEDIR)
. include "${PKGSRCDIR}/mk/configure/replace-localedir.mk"
.endif
-.include "${.PARSEDIR}/check-portability.mk"
######################################################################
### configure (PUBLIC)
@@ -74,10 +73,15 @@ ${_COOKIE.configure}: real-configure
### real-configure is a helper target onto which one can hook all of the
### targets that do the actual configuration of the sources.
###
+#
+# Note: pre-configure-checks-hook comes after pre-configure to allow
+# packages for fixing bad files with SUBST_STAGE.* = pre-configure.
+#
_REAL_CONFIGURE_TARGETS+= configure-check-interactive
_REAL_CONFIGURE_TARGETS+= configure-message
_REAL_CONFIGURE_TARGETS+= configure-vars
_REAL_CONFIGURE_TARGETS+= pre-configure
+_REAL_CONFIGURE_TARGETS+= pre-configure-checks-hook
_REAL_CONFIGURE_TARGETS+= do-configure-pre-hook
_REAL_CONFIGURE_TARGETS+= do-configure
_REAL_CONFIGURE_TARGETS+= do-configure-post-hook