aboutsummaryrefslogtreecommitdiff
path: root/Makefile.inc1
diff options
context:
space:
mode:
authorYaroslav Tykhiy <ytykhiy@gmail.com>2007-12-04 12:55:27 +0000
committerYaroslav Tykhiy <ytykhiy@gmail.com>2007-12-04 12:55:27 +0000
commitc93073c260923dcbdb29dbec4e22ec78b1fc4194 (patch)
tree3b201eda572e1c3864ba4e036bba59bb6d0a89ea /Makefile.inc1
parentd24031dd0cd7426670045968bda8cc501303cd0f (diff)
downloadsrc-c93073c260923dcbdb29dbec4e22ec78b1fc4194.tar.gz
src-c93073c260923dcbdb29dbec4e22ec78b1fc4194.zip
- Explicitly verify if all needed libs were found by ldd(1). Do so
through scanning its output as ldd(1) returns a non-zero status only for really abnormal conditions such as an improper file format. Now cp(1) won't get bogus "not" and "found" arguments if a lib is missing. [1] - Don't guess if an element of a complex pipeline is assigned to the main shell or a sub-shell. Namely use stdio, not vars, to pass lists out from loops. If using vars, there's the risk that a loop will run in a sub-shell and the list won't make it to the main shell. It appears that braces and parens give only limited control over the issue while stdio always works as intended. Apply this solution to both $progs and $libs for consistency, although I've failed to go without it only in the $libs part. Requested by: emaste [1]
Notes
Notes: svn path=/head/; revision=174255
Diffstat (limited to 'Makefile.inc1')
-rw-r--r--Makefile.inc120
1 files changed, 14 insertions, 6 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index 4447bdc43f1e..13650969765e 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -591,17 +591,25 @@ ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
#
distributeworld installworld: installcheck
mkdir -p ${INSTALLTMP}
- for prog in ${ITOOLS}; do \
+ progs=$$(for prog in ${ITOOLS}; do \
if progpath=`which $$prog`; then \
- progs="$$progs $$progpath"; \
+ echo $$progpath; \
else \
echo "Required tool $$prog not found in PATH." >&2; \
exit 1; \
fi; \
- done; \
- cp $$progs ${INSTALLTMP}; \
- cp `ldd -f "%p\n" -f "%p\n" $$progs 2>/dev/null | \
- sort -u` ${INSTALLTMP}
+ done); \
+ libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
+ while read line; do \
+ set -- $$line; \
+ if [ "$$2 $$3" != "not found" ]; then \
+ echo $$2; \
+ else \
+ echo "Required library $$1 not found." >&2; \
+ exit 1; \
+ fi; \
+ done); \
+ cp $$libs $$progs ${INSTALLTMP}
cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
${IMAKEENV} rm -rf ${INSTALLTMP}