blob: 4d9323ecc7f8cc5e54d21d70e7a7e629d52deda7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#!/bin/sh
#
######################################################################
#
# NAME
# install-dependencies -- install package dependencies
#
# SYNOPSIS
# register-dependencies [ filter ]
#
# DESCRIPTION
# install-dependencies checks all entries in ${DEPENDS_FILE}
# for existance. Missing entries get installed by
# ${DEPENDS_TARGET} in the listed directory.
#
######################################################################
: ${CAT:=cat}
: ${ECHO:=echo}
: ${TEST:=test}
: ${TRUE:=true}
set -e
bootstrap_mode="$1"
shift
eval "$@"
error_msg() {
${ECHO} "ERROR:" "$*" 1>&2
}
step_msg() {
${ECHO} "=>" "$*"
}
find_best() {
${PKG_ADMIN} -b -d ${_PKG_DBDIR} -S lsbest $1 || ${TRUE}
}
${CAT} ${_DEPENDS_FILE} | while read type pattern dir; do
if $TEST "$bootstrap_mode" = "bootstrap"; then
$TEST "$type" != "bootstrap" && continue
else
$TEST "$type" = "bootstrap" && continue
fi
pkg=`find_best "$pattern"`
case "$pkg" in
"")
step_msg "Required installed package $pattern: NOT found"
target=${DEPENDS_TARGET}
if ${TEST} ! -d "$dir"; then
error_msg "[install-depends] The directory \`\`$dir'' does not exist."
exit 1
fi
step_msg "Verifying $target for $dir"
cd $dir
${SETENV} ${PKGSRC_MAKE_ENV} _PKGSRC_DEPS=", ${PKGNAME}${_PKGSRC_DEPS}" PKGNAME_REQD="$pattern" ${MAKE} ${MAKEFLAGS} _AUTOMATIC=yes $target
pkg=`find_best "$pattern"`
case "$pkg" in
"") error_msg "[install-depends] A package matching \`\`$pattern'' should"
error_msg " be installed, but one cannot be found. Perhaps there is a"
error_msg " stale work directory for $dir?"
exit 1
esac
step_msg "Returning to build of ${PKGNAME}"
;;
*)
objfmt=`${PKG_INFO} -Q OBJECT_FMT "$pkg"`
case "$objfmt" in
"") ${WARNING_MSG} "[install-depends] Unknown object format for installed package $pkg" ;;
${OBJECT_FMT}) ;;
*) error_msg "[install-depends] Installed package $pkg has an"
error_msg " object format \`\`$objfmt'' which differs from \`\`${OBJECT_FMT}''. Please"
error_msg " update the $pkg package to ${OBJECT_FMT}."
exit 1
;;
esac;
step_msg "Required installed package $pattern: $pkg found"
;;
esac
done
|