aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Mk/Scripts/check-stagedir.sh21
-rw-r--r--Mk/bsd.stage.mk4
2 files changed, 19 insertions, 6 deletions
diff --git a/Mk/Scripts/check-stagedir.sh b/Mk/Scripts/check-stagedir.sh
index 820034028d9f..67a2162e7b5c 100644
--- a/Mk/Scripts/check-stagedir.sh
+++ b/Mk/Scripts/check-stagedir.sh
@@ -24,7 +24,7 @@ esac
# validate environment
envfault=
for i in STAGEDIR PREFIX LOCALBASE WRKDIR WRKSRC MTREE_FILE \
- TMPPLIST DATADIR DOCSDIR EXAMPLESDIR
+ TMPPLIST DOCSDIR EXAMPLESDIR PLIST_SUB
do
if ! ( eval ": \${${i}?}" ) 2>/dev/null ; then
envfault="${envfault}${envfault:+" "}${i}"
@@ -98,14 +98,27 @@ fi
done
} > ${WRKDIR}/.mtree
+for i in $PLIST_SUB
+do
+ echo $i
+done | awk -F= '{print length($2), $1, $2 | "sort -nr" }' | while read l k v
+do
+ if [ $l -ne 0 ]
+ then
+ echo "s,${v},%%${k}%%,g;"
+ fi
+done > ${WRKDIR}/.plist_sub
+
+sed_plist_sub=`cat ${WRKDIR}/.plist_sub`
+
### HANDLE FILES
find ${STAGEDIR} -type f -o -type l | sort | sed -e "s,${STAGEDIR},," >${WRKDIR}/.staged-files
comm -13 ${WRKDIR}/.plist-files ${WRKDIR}/.staged-files \
| sed \
-e "s,${DOCSDIR},%%PORTDOCS%%%%DOCSDIR%%,g" \
-e "s,${EXAMPLESDIR},%%PORTEXAMPLES%%%%EXAMPLESDIR%%,g" \
- -e "s,${DATADIR},%%DATADIR%%,g" \
- -e "s,${PREFIX}/,,g" | grep -v "^share/licenses" || [ $? = 1 ]
+ -e "s,${PREFIX}/,,g" \
+ -e "${sed_plist_sub}" | grep -v "^share/licenses" || [ $? = 1 ]
### HANDLE DIRS
cat ${WRKDIR}/.plist-dirs-unsorted ${WRKDIR}/.mtree | sort -u >${WRKDIR}/.traced-dirs
@@ -115,6 +128,6 @@ comm -13 ${WRKDIR}/.traced-dirs ${WRKDIR}/.staged-dirs \
-e 's,^,@dirrmtry ,' \
-e "s,\(.*\)${DOCSDIR},%%PORTDOCS%%\1%%DOCSDIR%%,g" \
-e "s,\(.*\)${EXAMPLESDIR},%%PORTEXAMPLES%%\1%%EXAMPLESDIR%%,g" \
- -e "s,${DATADIR},%%DATADIR%%,g" \
-e "s,${PREFIX}/,,g" \
+ -e "${sed_plist_sub}" \
-e 's,@dirrmtry \(/.*\),@unexec rmdir >/dev/null 2>\&1 \1 || :,' | grep -v "^@dirrmtry share/licenses" || [ $? = 1 ]
diff --git a/Mk/bsd.stage.mk b/Mk/bsd.stage.mk
index 8b1a5c14cbeb..08e1a6367a8b 100644
--- a/Mk/bsd.stage.mk
+++ b/Mk/bsd.stage.mk
@@ -24,9 +24,9 @@ CO_ENV+= STAGEDIR=${STAGEDIR} \
WRKSRC=${WRKSRC} \
MTREE_FILE=${MTREE_FILE} \
TMPPLIST=${TMPPLIST} \
- DATADIR=${DATADIR} \
DOCSDIR=${DOCSDIR} \
- EXAMPLESDIR=${EXAMPLESDIR}
+ EXAMPLESDIR=${EXAMPLESDIR} \
+ PLIST_SUB="${PLIST_SUB:NPREFIX=*:NLOCALBASE=*:NOSREL=*:NLIB32DIR=*:NDOCSDIR=*:NEXAMPLESDIR=*}"
.if !target(stage-dir)
stage-dir: