build: pass port options as PORTSENV

This way we can hook it into build configuration and also it
looks final enough to document it soon.
This commit is contained in:
Franco Fichtner 2021-04-06 09:02:35 +02:00
parent 8c18ee7ccd
commit 3c3330f385
3 changed files with 46 additions and 59 deletions

View File

@ -71,7 +71,7 @@ CONFIGDIR?= ${TOOLSDIR}/config/${SETTINGS}
NAME?= OPNsense
TYPE?= ${NAME:tl}
SUFFIX?= #-devel
SUFFIX?= # empty
FLAVOUR?= OpenSSL LibreSSL # first one is default
_ARCH!= uname -p
ARCH?= ${_ARCH}
@ -95,21 +95,27 @@ _VERSION!= date '+%Y%m%d%H%M'
VERSION?= ${_VERSION}
STAGEDIRPREFIX?=/usr/obj
PORTSREFURL?= https://git-01.md.hardenedbsd.org/HardenedBSD/hardenedbsd-ports.git
EXTRABRANCH?= # empty
COREBRANCH?= stable/${ABI}
COREDIR?= /usr/core
COREENV?= CORE_PHP=${PHP} CORE_ABI=${ABI} CORE_PYTHON=${PYTHON}
PLUGINSBRANCH?= stable/${ABI}
PLUGINSDIR?= /usr/plugins
PLUGINSENV?= PLUGIN_PHP=${PHP} PLUGIN_ABI=${ABI} PLUGIN_PYTHON=${PYTHON}
PORTSBRANCH?= master
PORTSDIR?= /usr/ports
PORTSENV?= # empty
PORTSREFURL?= https://git.hardenedbsd.org/hardenedbsd/hardenedbsd-ports.git
PORTSREFDIR?= /usr/hardenedbsd-ports
PORTSREFBRANCH?=master
PLUGINSENV?= PLUGIN_PHP=${PHP} PLUGIN_ABI=${ABI} PLUGIN_PYTHON=${PYTHON}
PLUGINSDIR?= /usr/plugins
PLUGINSBRANCH?= stable/${ABI}
PORTSDIR?= /usr/ports
PORTSBRANCH?= master
COREDIR?= /usr/core
COREBRANCH?= stable/${ABI}
COREENV?= CORE_PHP=${PHP} CORE_ABI=${ABI} CORE_PYTHON=${PYTHON}
SRCDIR?= /usr/src
SRCBRANCH?= stable/${ABI}
EXTRABRANCH?= #master
SRCDIR?= /usr/src
# A couple of meta-targets for easy use and ordering:
@ -119,7 +125,7 @@ core: plugins
packages test: core
dvd nano serial vga vm: kernel core
sets: kernel distfiles packages
images: dvd nano serial vga vm #arm
images: dvd nano serial vga vm
release: dvd nano serial vga
# Expand target arguments for the script append:
@ -165,7 +171,8 @@ ${STEP}: lint-steps
-H "${COREENV}" -u "${UEFI:tl}" -U "${SUFFIX}" -i ${COMPORT} \
-V "${ADDITIONS}" -O "${GITBASE}" -r "${SERVER}" \
-q "${VERSIONS}" -h "${PLUGINSENV}" -I "${UPLOADDIR}" \
-D "${EXTRABRANCH}" -A "${PORTSREFURL}" ${${STEP}_ARGS}
-D "${EXTRABRANCH}" -A "${PORTSREFURL}" -J "${PORTSENV}" \
${${STEP}_ARGS}
.endfor
.for SCRIPT in ${SCRIPTS}

View File

@ -28,7 +28,7 @@
set -e
OPTS="A:a:B:b:C:c:D:d:E:e:F:f:G:g:H:h:I:i:K:k:L:l:m:n:O:o:P:p:q:R:r:S:s:T:t:U:u:v:V:"
OPTS="A:a:B:b:C:c:D:d:E:e:F:f:G:g:H:h:I:i:J:K:k:L:l:m:n:O:o:P:p:q:R:r:S:s:T:t:U:u:v:V:"
while getopts ${OPTS} OPT; do
case ${OPT} in
@ -83,6 +83,15 @@ while getopts ${OPTS} OPT; do
h)
export PLUGINSENV=${OPTARG}
;;
I)
export UPLOADDIR=${OPTARG}
;;
i)
export PRODUCT_COMPORT=${OPTARG}
;;
J)
export PORTSENV=${OPTARG}
;;
K)
if [ -n "${OPTARG}" ]; then
export PRODUCT_PUBKEY=${OPTARG}
@ -93,12 +102,6 @@ while getopts ${OPTS} OPT; do
export PRODUCT_PRIVKEY=${OPTARG}
fi
;;
I)
export UPLOADDIR=${OPTARG}
;;
i)
export PRODUCT_COMPORT=${OPTARG}
;;
L)
if [ -n "${OPTARG}" ]; then
export PRODUCT_SIGNCMD=${OPTARG}

View File

@ -31,47 +31,24 @@ SELF=ports
. ./common.sh
DEPEND=yes
PRUNE=yes
SILENT=yes
eval ${PORTSENV}
ARGS=
ARGS=${*}
DEPS=
for ARG in ${@}; do
OPT=${ARG%%%*}
VAL=${ARG##*%}
if [ "${OPT}" = "${ARG}" ]; then
ARGS="${ARGS} ${ARG}"
else
case ${VAL} in
yes)
;;
no)
;;
*)
echo ">>> Unknown option value for ${ARG}"
exit 1
;;
esac
case ${OPT} in
depend)
DEPEND=${VAL}
;;
prune)
PRUNE=${VAL}
;;
silent)
SILENT=${VAL}
;;
*)
echo ">>> Unknown option name: ${ARG}"
exit 1
;;
esac
fi
for OPT in DEPEND PRUNE SILENT; do
VAL=$(eval echo \$${OPT});
case ${VAL} in
yes|no)
;;
'')
eval ${OPT}=yes
;;
*)
echo ">>> Syntax error ${OPT}=${VAL}: use 'yes' or 'no'"
exit 1
;;
esac
done
MAKECMD="make"