summaryrefslogtreecommitdiff
path: root/mk/check
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2008-02-13 15:02:20 +0000
committerrillig <rillig@pkgsrc.org>2008-02-13 15:02:20 +0000
commitc18f3fed8166b5fc1045c00c9628058786c08e63 (patch)
tree77262aee0b73b3037fc2a9de3972c4f84beec080 /mk/check
parenta72a43a532fee7de7598016018424246fbbcd3ba (diff)
downloadpkgsrc-c18f3fed8166b5fc1045c00c9628058786c08e63.tar.gz
Added a new check for binaries, so that they are installed according to
the INSTALL_UNSTRIPPED variable. By default, this check is disabled, so that it does not cause any breakage. NB: The file(1) command needs the explicit locale to prevent translated messages. This file is copied from check-interpreter.mk.
Diffstat (limited to 'mk/check')
-rw-r--r--mk/check/bsd.check.mk3
-rw-r--r--mk/check/check-stripped.mk58
2 files changed, 60 insertions, 1 deletions
diff --git a/mk/check/bsd.check.mk b/mk/check/bsd.check.mk
index c70604bae5e..8db4197e4b1 100644
--- a/mk/check/bsd.check.mk
+++ b/mk/check/bsd.check.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.check.mk,v 1.7 2008/02/10 11:44:48 tnn Exp $
+# $NetBSD: bsd.check.mk,v 1.8 2008/02/13 15:02:20 rillig Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and provides all
# variables and targets related to build and install checks.
@@ -31,6 +31,7 @@
.include "check-perms.mk"
.include "check-portability.mk"
.include "check-shlibs.mk"
+.include "check-stripped.mk"
.include "check-vulnerable.mk"
.include "check-wrkref.mk"
.include "check-fakehome.mk"
diff --git a/mk/check/check-stripped.mk b/mk/check/check-stripped.mk
new file mode 100644
index 00000000000..5cda390b863
--- /dev/null
+++ b/mk/check/check-stripped.mk
@@ -0,0 +1,58 @@
+# $NetBSD: check-stripped.mk,v 1.1 2008/02/13 15:02:20 rillig Exp $
+#
+# This file checks that after installation, all binaries conform to the
+# setting of INSTALL_UNSTRIPPED.
+#
+# User-settable variables:
+#
+# CHECK_STRIPPED
+# Whether this check should be enabled or not.
+#
+# Default value: "no".
+#
+# Package-settable variables:
+#
+# CHECK_STRIPPED_SKIP
+# The list of file patterns that are skipped by the check.
+#
+# Default value: (empty)
+#
+# Example: bin/* sbin/foo
+#
+
+.if defined(PKG_DEVELOPER)
+CHECK_STRIPPED?= no # XXX: change to "yes" later
+.else
+CHECK_STRIPPED?= no
+.endif
+CHECK_STRIPPED_SKIP?= # empty
+
+_CHECK_STRIPPED_FILELIST_CMD?= ${SED} -e '/^@/d' ${PLIST}
+
+.if !empty(CHECK_STRIPPED:M[Yy][Ee][Ss])
+privileged-install-hook: _check-stripped
+.endif
+
+_check-stripped: error-check .PHONY
+ @${STEP_MSG} "Checking whether binaries are ${_INSTALL_UNSTRIPPED:Dun:U}stripped."
+ ${RUN} cd ${DESTDIR}${PREFIX}; \
+ want_stripped=${_INSTALL_UNSTRIPPED:Dno:Uyes}; \
+ ${_CHECK_STRIPPED_FILELIST_CMD} | ${SORT} | ${SED} 's,\\,\\\\,g'\
+ | while read file; do \
+ case "$$file" in \
+ ${CHECK_STRIPPED_SKIP:@p@${p}) continue ;;@} \
+ *) ;; \
+ esac; \
+ test -x "$$file" || continue; \
+ if [ ! -r "$$file" ]; then \
+ ${DELAYED_WARNING_MSG} "[check-stripped.mk] File \"${DESTDIR}${PREFIX}/$$file\" cannot be read."; \
+ continue; \
+ fi; \
+ ftype=`LANG=C LC_ALL=C ${FILE_CMD} ./$$file`; \
+ case $$want_stripped,$$ftype in \
+ yes,*:*\ ELF\ *,\ not\ stripped*) ${DELAYED_ERROR_MSG} "[check-stripped.mk] ${DESTDIR}${PREFIX}/$$file should be stripped, but is not.";; \
+ no,*:*\ ELF\ *,\ stripped*) ${DELAYED_ERROR_MSG} "[check-stripped.mk] ${DESTDIR}${PREFIX}/$$file should NOT be stripped, but it is.";; \
+ no,*:*\ ELF\ *,\ not\ stripped*) ${INFO_MSG} "[check-stripped.mk] ${DESTDIR}${PREFIX}/$$file is not stripped (ok).";; \
+ yes,*:*\ ELF\ *,\ stripped*) ${INFO_MSG} "[check-stripped.mk] ${DESTDIR}${PREFIX}/$$file is stripped (ok).";; \
+ esac; \
+ done