Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / mk / check / check-stripped.mk
blobf908df658c5c1f5f58054c5c746b51cd22bf930c
1 # $NetBSD: check-stripped.mk,v 1.4 2010/08/24 19:08:29 bad Exp $
3 # This file checks that after installation, all binaries conform to the
4 # setting of INSTALL_UNSTRIPPED.
6 # User-settable variables:
8 # CHECK_STRIPPED
9 # Whether this check should be enabled or not.
11 # Default value: "no".
13 # Package-settable variables:
15 # CHECK_STRIPPED_SKIP
16 # The list of file patterns that are skipped by the check.
18 # Default value: (empty)
20 # Example: bin/* sbin/foo
23 .if defined(PKG_DEVELOPER) && ${PKG_DEVELOPER} != "no"
24 CHECK_STRIPPED?= no # XXX: change to "yes" later
25 .else
26 CHECK_STRIPPED?= no
27 .endif
28 CHECK_STRIPPED_SKIP?= # empty
30 _CHECK_STRIPPED_FILELIST_CMD?= ${SED} -e '/^@/d' ${PLIST}
32 .if !empty(CHECK_STRIPPED:M[Yy][Ee][Ss])
33 privileged-install-hook: _check-stripped
34 . if empty(USE_TOOLS:Mfile)
35 USE_TOOLS+= file
36 . endif
37 .endif
39 _check-stripped: error-check .PHONY
40 @${STEP_MSG} "Checking whether binaries are ${_INSTALL_UNSTRIPPED:Dun:U}stripped."
41 ${RUN} cd ${DESTDIR}${PREFIX}; \
42 want_stripped=${_INSTALL_UNSTRIPPED:Dno:Uyes}; \
43 ${_CHECK_STRIPPED_FILELIST_CMD} | ${SORT} | ${SED} 's,\\,\\\\,g'\
44 | while read file; do \
45 case "$$file" in \
46 ${CHECK_STRIPPED_SKIP:@p@${p}) continue ;;@} \
47 *) ;; \
48 esac; \
49 dpfile=${DESTDIR}${PREFIX}/$$file; \
50 test -x "$$dpfile" || continue; \
51 if [ ! -r "$$dpfile" ]; then \
52 ${DELAYED_WARNING_MSG} "[check-stripped.mk] File \"$$dpfile\" cannot be read."; \
53 continue; \
54 fi; \
55 ftype=`LC_ALL=C ${FILE_CMD} $$dpfile`; \
56 case $$want_stripped,$$ftype in \
57 yes,*:*\ ELF\ *,\ not\ stripped*) ${DELAYED_ERROR_MSG} "[check-stripped.mk] $$dpfile should be stripped, but is not.";; \
58 no,*:*\ ELF\ *,\ stripped*) ${DELAYED_ERROR_MSG} "[check-stripped.mk] $$dpfile should NOT be stripped, but it is.";; \
59 no,*:*\ ELF\ *,\ not\ stripped*) : ${INFO_MSG} "[check-stripped.mk] $$dpfile is not stripped (ok).";; \
60 yes,*:*\ ELF\ *,\ stripped*) : ${INFO_MSG} "[check-stripped.mk] $$dpfile is stripped (ok).";; \
61 esac; \
62 done