2006-11-03 18:19:42 -05:00
|
|
|
# $OpenBSD: pkgpath.mk,v 1.9 2006/11/03 23:19:42 espie Exp $
|
2003-08-02 05:53:27 -04:00
|
|
|
# pkgpath.mk - 2003 Marc Espie
|
|
|
|
# This file is in the public domain.
|
|
|
|
|
|
|
|
# definitions common to bsd.port.mk and bsd.port.subdir.mk
|
|
|
|
|
|
|
|
.if !defined(PKGPATH)
|
|
|
|
_PORTSDIR!= cd ${PORTSDIR} && pwd -P
|
|
|
|
_CURDIR!= cd ${.CURDIR} && pwd -P
|
|
|
|
PKGPATH=${_CURDIR:S,${_PORTSDIR}/,,}
|
|
|
|
.endif
|
|
|
|
.if empty(PKGPATH)
|
|
|
|
PKGDEPTH=
|
|
|
|
.else
|
|
|
|
PKGDEPTH=${PKGPATH:C|[^./][^/]*|..|g}/
|
|
|
|
.endif
|
|
|
|
|
2003-08-14 20:05:41 -04:00
|
|
|
PORTSDIR_PATH?=${PORTSDIR}:${PORTSDIR}/mystuff
|
|
|
|
|
2003-08-02 05:53:27 -04:00
|
|
|
# Code to invoke to split dir,-multi,flavor
|
|
|
|
|
|
|
|
_flavor_fragment= \
|
2005-11-02 15:30:12 -05:00
|
|
|
unset FLAVOR SUBPACKAGE || true; \
|
2003-08-02 05:53:27 -04:00
|
|
|
multi=''; flavor=''; space=''; sawflavor=false; \
|
2005-11-02 15:30:12 -05:00
|
|
|
case "$$subdir" in \
|
2005-11-03 14:32:25 -05:00
|
|
|
"") \
|
|
|
|
echo 1>&2 ">> Broken dependency: empty directory $$extra_msg"; \
|
|
|
|
exit 1;; \
|
2003-08-02 05:53:27 -04:00
|
|
|
*,*) \
|
2005-11-02 15:30:12 -05:00
|
|
|
IFS=,; first=true; for i in $$subdir; do \
|
2003-08-02 05:53:27 -04:00
|
|
|
if $$first; then \
|
|
|
|
dir=$$i; first=false; \
|
|
|
|
else \
|
|
|
|
case X"$$i" in \
|
|
|
|
X-*) \
|
|
|
|
multi="$$i";; \
|
|
|
|
*) \
|
|
|
|
sawflavor=true; \
|
|
|
|
flavor="$$flavor$$space$$i"; \
|
|
|
|
space=' ';; \
|
|
|
|
esac \
|
|
|
|
fi; \
|
|
|
|
done; unset IFS;; \
|
2005-11-02 15:30:12 -05:00
|
|
|
*) \
|
|
|
|
dir=$$subdir;; \
|
2003-08-02 05:53:27 -04:00
|
|
|
esac; \
|
|
|
|
toset="PKGPATH=$$dir"; \
|
|
|
|
case X$$multi in "X");; *) \
|
|
|
|
toset="$$toset SUBPACKAGE=\"$$multi\"";; \
|
|
|
|
esac; \
|
|
|
|
if $$sawflavor; then \
|
|
|
|
toset="$$toset FLAVOR=\"$$flavor\""; \
|
|
|
|
fi; \
|
2003-08-14 20:05:41 -04:00
|
|
|
IFS=:; found_dir=false; bases=${PORTSDIR_PATH}; \
|
|
|
|
for base in $$bases; do \
|
|
|
|
cd $$base 2>/dev/null || continue; \
|
|
|
|
if [ -L $$dir ]; then \
|
2005-11-03 14:32:25 -05:00
|
|
|
echo 1>&2 ">> Broken dependency: $$base/$$dir is a symbolic link $$extra_msg"; \
|
2003-08-14 20:05:41 -04:00
|
|
|
exit 1; \
|
|
|
|
fi; \
|
|
|
|
if cd $$dir 2>/dev/null; then \
|
|
|
|
found_dir=true; \
|
|
|
|
break; \
|
|
|
|
fi; \
|
2003-08-28 17:50:12 -04:00
|
|
|
done; unset IFS; \
|
2003-08-14 20:05:41 -04:00
|
|
|
if ! $$found_dir; then \
|
2005-11-03 14:32:25 -05:00
|
|
|
echo 1>&2 ">> Broken dependency: $$dir non existent $$extra_msg"; \
|
2003-08-14 20:05:41 -04:00
|
|
|
exit 1; \
|
2003-08-02 05:53:27 -04:00
|
|
|
fi
|
|
|
|
|
2003-08-04 10:37:10 -04:00
|
|
|
_depfile_fragment= \
|
|
|
|
case X$${_DEPENDS_FILE} in \
|
2006-11-03 18:19:42 -05:00
|
|
|
X) _DEPENDS_FILE=`mktemp /tmp/depends.XXXXXXXXX|| exit 1`; \
|
2003-08-04 10:37:10 -04:00
|
|
|
export _DEPENDS_FILE; \
|
|
|
|
trap "rm -f $${_DEPENDS_FILE}" 0 1 2 3 13 15;; \
|
|
|
|
esac
|
|
|
|
|
2003-08-02 05:53:27 -04:00
|
|
|
HTMLIFY= sed -e 's/&/\&/g' -e 's/>/\>/g' -e 's/</\</g'
|
|
|
|
|
2006-07-08 05:20:30 -04:00
|
|
|
|
|
|
|
REPORT_PROBLEM_LOGFILE?=
|
|
|
|
.if !empty(REPORT_PROBLEM_LOGFILE)
|
|
|
|
REPORT_PROBLEM?=echo "$$subdir ($@)">>${REPORT_PROBLEM_LOGFILE}
|
|
|
|
.else
|
|
|
|
REPORT_PROBLEM?=exit 1
|
|
|
|
.endif
|
|
|
|
|