Lines 11-51
validate_env dp_RAWDEPENDS dp_DEPTYPE dp_DEPENDS_TARGET dp_DEPENDS_PRECLEAN \
Link Here
|
11 |
dp_DEPENDS_CLEAN dp_DEPENDS_ARGS dp_USE_PACKAGE_DEPENDS \ |
11 |
dp_DEPENDS_CLEAN dp_DEPENDS_ARGS dp_USE_PACKAGE_DEPENDS \ |
12 |
dp_USE_PACKAGE_DEPENDS_ONLY dp_PKG_ADD dp_PKG_INFO dp_WRKDIR \ |
12 |
dp_USE_PACKAGE_DEPENDS_ONLY dp_PKG_ADD dp_PKG_INFO dp_WRKDIR \ |
13 |
dp_PKGNAME dp_STRICT_DEPENDS dp_LOCALBASE dp_LIB_DIRS dp_SH \ |
13 |
dp_PKGNAME dp_STRICT_DEPENDS dp_LOCALBASE dp_LIB_DIRS dp_SH \ |
14 |
dp_SCRIPTSDIR PORTSDIR dp_MAKE |
14 |
dp_SCRIPTSDIR PORTSDIR dp_MAKE dp_USE_REPO_DEPENDS \ |
|
|
15 |
dp_USE_REPO_DEPENDS_ONLY dp_PKG_INSTALL |
15 |
|
16 |
|
16 |
set -u |
17 |
set -u |
17 |
|
18 |
|
18 |
install_depends() |
19 |
install_depends() |
19 |
{ |
20 |
{ |
20 |
origin=$1 |
21 |
local origin=$1 |
21 |
target=$2 |
22 |
local target=$2 |
22 |
depends_args=$3 |
23 |
local depends_args=$3 |
23 |
if [ -z "${dp_USE_PACKAGE_DEPENDS}" -a -z "${dp_USE_PACKAGE_DEPENDS_ONLY}" ]; then |
24 |
|
24 |
${dp_MAKE} -C ${origin} -DINSTALLS_DEPENDS ${target} ${depends_args} |
25 |
local no_source="${dp_USE_PACKAGE_DEPENDS_ONLY}${dp_USE_REPO_DEPENDS_ONLY}" |
25 |
return 0 |
26 |
local non_source="${dp_USE_PACKAGE_DEPENDS}${dp_USE_REPO_DEPENDS}${no_source}" |
26 |
fi |
27 |
|
|
|
28 |
local success="no" |
29 |
|
30 |
if [ -n "${non_source}" -a "${target}" = "${dp_DEPENDS_TARGET}" ]; then |
31 |
read pkgbase <<- EOF |
32 |
$(${dp_MAKE} -C ${origin} -VPKGBASE) |
33 |
EOF |
34 |
|
35 |
local use_package="${dp_USE_PACKAGE_DEPENDS}${dp_USE_PACKAGE_DEPENDS_ONLY}" |
36 |
if [ -n "${use_package}" -a "${success}" = "no" ]; then |
37 |
read pkgfile <<- EOF |
38 |
$(${dp_MAKE} -C ${origin} -VPKGFILE) |
39 |
EOF |
40 |
|
41 |
if [ -r "${pkgfile}" ]; then |
42 |
echo "===> Installing existing package ${pkgfile}" |
43 |
if [ "${pkgbase}" = "pkg" -o "${pkgbase}" = "pkg-devel" ]; then |
44 |
[ -d ${dp_WRKDIR} ] || mkdir -p ${dp_WRKDIR} |
45 |
tar xf ${pkgfile} -C ${dp_WRKDIR} -s ",/.*/,,g" "*/pkg-static" |
46 |
${dp_WRKDIR}/pkg-static add ${pkgfile} && success="yes" |
47 |
rm -f ${dp_WRKDIR}/pkg-static |
48 |
else |
49 |
${dp_PKG_ADD} -A ${pkgfile} && success="yes" |
50 |
fi |
51 |
fi |
52 |
fi |
27 |
|
53 |
|
28 |
read pkgfile <<- EOF |
54 |
local use_repo="${dp_USE_REPO_DEPENDS}${dp_USE_REPO_DEPENDS_ONLY}" |
29 |
$(${dp_MAKE} -C ${origin} -VPKGFILE) |
55 |
if [ -n "${use_repo}" -a "${success}" = "no" ]; then |
30 |
EOF |
56 |
echo "===> Installing package ${pkgbase} from repository" |
31 |
read pkgbase <<- EOF |
57 |
env ASSUME_ALWAYS_YES=yes ${dp_PKG_INSTALL} -A ${pkgbase} && success="yes" |
32 |
$(${dp_MAKE} -C ${origin} -VPKGBASE) |
|
|
33 |
EOF |
34 |
if [ -r "${pkgfile}" -a "${target}" = "${dp_DEPENDS_TARGET}" ]; then |
35 |
echo "===> Installing existing package ${pkgfile}" |
36 |
if [ "${pkgbase}" = "pkg" ]; then |
37 |
[ -d ${dp_WRKDIR} ] || mkdir -p ${dp_WRKDIR} |
38 |
tar xf ${pkgfile} -C ${dp_WRKDIR} -s ",/.*/,,g" "*/pkg-static" |
39 |
${dp_WRKDIR}/pkg-static add ${pkgfile} |
40 |
rm -f ${dp_WRKDIR}/pkg-static |
41 |
else |
42 |
${dp_PKG_ADD} -A ${pkgfile} |
43 |
fi |
58 |
fi |
44 |
elif [ -n "${dp_USE_PACKAGE_DEPENDS_ONLY}" -a "${target}" = "${dp_DEPENDS_TARGET}" ]; then |
59 |
|
45 |
echo "===> ${dp_PKGNAME} depends on package: ${pkgfile} - not found" >&2 |
60 |
if [ -n "${no_source}" -a "${success}" = "no" ]; then |
46 |
echo "===> dp_USE_PACKAGE_DEPENDS_ONLY set - not building missing dependency from source" >&2 |
61 |
echo "===> ${dp_PKGNAME} depends on package: ${pkgfile} - not found" >&2 |
47 |
exit 1 |
62 |
echo "===> dp_USE_PACKAGE_DEPENDS_ONLY or dp_USE_REPO_DEPENDS_ONLY set" >&2 |
48 |
else |
63 |
echo "===> not building missing dependency from source" >&2 |
|
|
64 |
exit 1 |
65 |
fi |
66 |
fi |
67 |
|
68 |
if [ ${success} = no ]; then |
49 |
${dp_MAKE} -C ${origin} -DINSTALLS_DEPENDS ${target} ${depends_args} |
69 |
${dp_MAKE} -C ${origin} -DINSTALLS_DEPENDS ${target} ${depends_args} |
50 |
fi |
70 |
fi |
51 |
} |
71 |
} |