build: arch-dependent STAGEDIR, print target, clean-obj target

This commit is contained in:
Franco Fichtner 2016-07-19 08:39:00 +02:00
parent ae9fee5ff5
commit bda0830a43
5 changed files with 60 additions and 4 deletions

View File

@ -1,5 +1,5 @@
STEPS= base boot cdrom chroot clean core distfiles \
kernel nano plugins ports prefetch rebase \
kernel nano plugins ports prefetch print rebase \
release serial sign skim test vga vm xtools
.PHONY: ${STEPS}

View File

@ -248,6 +248,7 @@ Available clean options are:
* images: remove all images
* kernel: remove kernel set
* nano: remove nano image
* obj: remove all object directories
* packages: remove packages set
* plugins: remove plugins from packages set
* ports: alias for "packages" option
@ -285,3 +286,8 @@ command will use chroot(8) to enter the active build jail:
There's also the posh way to boot a final image using bhyve(8):
# make boot-<image>
Last but not least, in case build variables needs to be inspected,
they can be printed selectively using:
# make print-<variable1>[,<variable2>]

View File

@ -65,6 +65,16 @@ for ARG in ${@}; do
echo ">>> Removing nano image"
rm -f ${IMAGESDIR}/*-nano-${PRODUCT_ARCH}.*
;;
obj)
echo ">>> Removing object directories"
for DIR in $(find ${STAGEDIRPREFIX}${TOOLSDIR} -type d -depth 3); do
setup_stage ${DIR}
done
for DIR in $(find /usr/obj -type d -depth 1); do
setup_stage ${DIR}
rm -rf ${DIR}
done
;;
packages|ports)
echo ">>> Removing packages set"
rm -f ${SETSDIR}/packages-*-${PRODUCT_FLAVOUR}-${PRODUCT_ARCH}.tar

View File

@ -198,7 +198,7 @@ EDITOR=${EDITOR} PAGER=${PAGER}"
# define build and config directories
export CONFIGDIR="${TOOLSDIR}/config/${PRODUCT_SETTINGS}"
export STAGEDIR="${STAGEDIRPREFIX}${CONFIGDIR}/${PRODUCT_FLAVOUR}"
export STAGEDIR="${STAGEDIRPREFIX}${CONFIGDIR}/${PRODUCT_FLAVOUR}:${PRODUCT_ARCH}"
export DEVICEDIR="${TOOLSDIR}/device"
export PACKAGESDIR="/.pkg"
@ -216,8 +216,10 @@ export PRODUCT_RELEASE="${PRODUCT_NAME}-${PRODUCT_VERSION}-${PRODUCT_FLAVOUR}"
export PRODUCT_PKGNAMES="${PRODUCT_TYPE} ${PRODUCT_TYPE}-stable ${PRODUCT_TYPE}-devel"
export PRODUCT_PKGNAME="${PRODUCT_TYPE}${PRODUCT_SUFFIX}"
# print environment to showcase all of our variables
env | sort
if [ "${SELF}" != print ]; then
# print environment to showcase all of our variables
env | sort
fi
git_checkout()
{
@ -762,6 +764,8 @@ setup_stage()
MOUNTDIRS="/dev /mnt ${SRCDIR} ${PORTSDIR} ${COREDIR} ${PLUGINSDIR}"
STAGE=${1}
local PID DIR
shift
# kill stale pids for chrooted daemons

36
build/print.sh Normal file
View File

@ -0,0 +1,36 @@
#!/bin/sh
# Copyright (c) 2016 Franco Fichtner <franco@opnsense.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
SELF=print
. ./common.sh && $(${SCRUB_ARGS})
for ARG in ${@}; do
echo ${ARG}=\"$(printenv ${ARG})\"
done