Commit 50f557f4 authored by Franco Fichtner's avatar Franco Fichtner

pkg: ok, 500% harder than found in the last commit

Transition away from making the internals known, so rework
the whole tree.mk to expand better to dynamic destinations.
parent 96f5e7fa
......@@ -214,14 +214,13 @@ scripts: want-git
install: force
@${MAKE} -C ${.CURDIR}/contrib install DESTDIR=${DESTDIR}
@${MAKE} -C ${.CURDIR}/src install_boot DESTDIR=${DESTDIR}
@${MAKE} -C ${.CURDIR}/src install DESTDIR=${DESTDIR} \
CORE_NAME=${CORE_NAME} CORE_ABI=${CORE_ABI} \
CORE_PACKAGESITE=${CORE_PACKAGESITE} \
CORE_REPOSITORY=${CORE_REPOSITORY}
bootstrap: force
@${MAKE} -C ${.CURDIR}/src install_bootstrap DESTDIR=${DESTDIR} \
@${MAKE} -C ${.CURDIR}/src install-bootstrap DESTDIR=${DESTDIR} \
NO_SAMPLE=please CORE_PACKAGESITE=${CORE_PACKAGESITE} \
CORE_NAME=${CORE_NAME} CORE_ABI=${CORE_ABI} \
CORE_REPOSITORY=${CORE_REPOSITORY}
......
all:
TREES_=${TREES}
ROOT_=${ROOT}
.for TARGET in ${TREES} ${EXTRAS}
.for TARGET in _ ${EXTRA:C/.*/_&/g}
.if "${TREES_${TARGET}}" == ""
TREES_${TARGET}=${TARGET}
.endif
install${TARGET}: force
.for TREE in ${TREES${TARGET}}
.if "${ROOT_${TARGET}}" == ""
ROOT_${TARGET}=${ROOT}
.endif
# fixup root target dir
ROOT_${TARGET}:=${ROOT_${TARGET}:S/^\/$//}
install-${TARGET}: force
.for TREE in ${TREES_${TARGET}}
@REALTARGET=/$$(dirname ${TREE}); \
mkdir -p ${DESTDIR}${ROOT${TARGET}}$${REALTARGET}; \
cp -vr ${TREE} ${DESTDIR}${ROOT${TARGET}}$${REALTARGET}
mkdir -p ${DESTDIR}${ROOT_${TARGET}}$${REALTARGET}; \
cp -vr ${TREE} ${DESTDIR}${ROOT_${TARGET}}$${REALTARGET}
@(cd ${TREE}; find * -type f ! -name "*.pyc") | while read FILE; do \
if [ "$${FILE%%.in}" != "$${FILE}" ]; then \
sed -i '' \
......@@ -17,20 +25,20 @@ install${TARGET}: force
-e "s=%%CORE_REPOSITORY%%=${CORE_REPOSITORY}=g" \
-e "s=%%CORE_NAME%%=${CORE_NAME}=g" \
-e "s=%%CORE_ABI%%=${CORE_ABI}=g" \
"${DESTDIR}${ROOT${TARGET}}/${TREE}/$${FILE}"; \
mv -v "${DESTDIR}${ROOT${TARGET}}/${TREE}/$${FILE}" \
"${DESTDIR}${ROOT${TARGET}}/${TREE}/$${FILE%%.in}"; \
"${DESTDIR}${ROOT_${TARGET}}/${TREE}/$${FILE}"; \
mv -v "${DESTDIR}${ROOT_${TARGET}}/${TREE}/$${FILE}" \
"${DESTDIR}${ROOT_${TARGET}}/${TREE}/$${FILE%%.in}"; \
fi; \
FILE="$${FILE%%.in}"; \
if [ -n "${NO_SAMPLE}" -a "$${FILE%%.sample}" != "$${FILE}" ]; then \
mv -v "${DESTDIR}${ROOT${TARGET}}/${TREE}/$${FILE}" \
"${DESTDIR}${ROOT${TARGET}}/${TREE}/$${FILE%%.sample}"; \
mv -v "${DESTDIR}${ROOT_${TARGET}}/${TREE}/$${FILE}" \
"${DESTDIR}${ROOT_${TARGET}}/${TREE}/$${FILE%%.sample}"; \
fi; \
done
.endfor
plist${TARGET}: force
.for TREE in ${TREES${TARGET}}
plist-${TARGET}: force
.for TREE in ${TREES_${TARGET}}
@(cd ${TREE}; find * -type f ! -name "*.pyc") | while read FILE; do \
FILE="$${FILE%%.in}"; PREFIX=""; \
if [ -z "${NO_SAMPLE}" -a "$${FILE%%.sample}" != "$${FILE}" ]; then \
......@@ -39,14 +47,17 @@ plist${TARGET}: force
if [ -n "${NO_SAMPLE}" ]; then \
FILE="$${FILE%%.sample}"; \
fi; \
echo "$${PREFIX}${ROOT${TARGET}}/${TREE}/$${FILE}"; \
echo "$${PREFIX}${ROOT_${TARGET}:}/${TREE}/$${FILE}"; \
done
.endfor
.endfor
install: install_
plist: plist_
.for TARGET in ${TREES}
install: install-${TARGET}
plist: plist-${TARGET}
.endfor
force:
.PHONY: force
ROOT= /usr/local
TREES= etc opnsense sbin wizard www
TREES= boot etc opnsense sbin wizard www
EXTRA= boot bootstrap
ROOT= /usr/local
ROOT_boot= /
ROOT_boot= # /
TREES_boot= boot
EXTRAS= bootstrap
ROOT_bootstrap= /usr/local
TREES_bootstrap=etc/pkg
ROOT_bootstrap= /usr/local
.include "../Mk/tree.mk"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment