2023-01-25 10:25:09 +01:00
|
|
|
# Copyright (c) 2015-2023 Franco Fichtner <franco@opnsense.org>
|
2017-01-01 14:46:04 +01:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2022-05-13 12:19:23 +02:00
|
|
|
STEPS= audit arm base boot chroot clean clone compress confirm \
|
|
|
|
connect core distfiles download dvd fingerprint info \
|
|
|
|
kernel list make.conf nano options packages plugins ports \
|
2023-08-09 08:20:08 +02:00
|
|
|
prefetch print rebase release rename serial sign \
|
2022-05-13 12:19:23 +02:00
|
|
|
skim test update upload verify vga vm xtools
|
2023-04-17 10:41:23 +02:00
|
|
|
SCRIPTS= custom distribution factory hotfix nightly watch
|
2019-07-02 08:26:40 +02:00
|
|
|
|
2021-01-26 19:54:59 +01:00
|
|
|
.PHONY: ${STEPS} ${SCRIPTS}
|
2015-05-17 19:48:27 +02:00
|
|
|
|
2015-05-17 20:26:21 +02:00
|
|
|
PAGER?= less
|
|
|
|
|
2019-01-02 16:07:00 +01:00
|
|
|
.MAKE.JOB.PREFIX?= # tampers with some of our make invokes
|
|
|
|
|
2015-05-17 20:26:21 +02:00
|
|
|
all:
|
|
|
|
@cat ${.CURDIR}/README.md | ${PAGER}
|
|
|
|
|
2017-08-27 06:04:54 +02:00
|
|
|
lint-steps:
|
2017-09-05 06:22:39 +02:00
|
|
|
.for STEP in common ${STEPS}
|
2016-03-04 15:46:37 +01:00
|
|
|
@sh -n ${.CURDIR}/build/${STEP}.sh
|
2017-08-27 06:04:54 +02:00
|
|
|
.endfor
|
|
|
|
|
2018-10-12 08:33:47 +02:00
|
|
|
lint-composite:
|
2017-08-27 06:04:54 +02:00
|
|
|
.for SCRIPT in ${SCRIPTS}
|
2018-10-12 08:33:47 +02:00
|
|
|
@sh -n ${.CURDIR}/composite/${SCRIPT}.sh
|
2017-08-27 06:04:54 +02:00
|
|
|
.endfor
|
|
|
|
|
2018-10-12 08:33:47 +02:00
|
|
|
lint: lint-steps lint-composite
|
2016-03-04 15:46:37 +01:00
|
|
|
|
2016-12-23 16:27:48 +01:00
|
|
|
# Special vars to load early build.conf settings:
|
|
|
|
|
2021-08-19 10:15:55 +02:00
|
|
|
ROOTDIR?= /usr
|
|
|
|
|
|
|
|
TOOLSDIR?= ${ROOTDIR}/tools
|
2016-12-26 11:08:46 +01:00
|
|
|
TOOLSBRANCH?= master
|
2021-02-02 09:21:41 +01:00
|
|
|
|
2021-07-26 22:28:27 +02:00
|
|
|
.if defined(CONFIGDIR)
|
|
|
|
_CONFIGDIR= ${CONFIGDIR}
|
|
|
|
.elif defined(SETTINGS)
|
2021-07-26 14:10:53 +02:00
|
|
|
_CONFIGDIR= ${TOOLSDIR}/config/${SETTINGS}
|
|
|
|
.elif !defined(CONFIGDIR)
|
2021-07-30 09:26:17 +02:00
|
|
|
__CONFIGDIR!= find -s ${TOOLSDIR}/config -name "build.conf" -type f
|
|
|
|
.for DIR in ${__CONFIGDIR}
|
|
|
|
. if exists(${DIR}) && empty(_CONFIGDIR)
|
|
|
|
_CONFIGDIR= ${DIR:C/\/build\.conf$//}
|
|
|
|
. endif
|
|
|
|
.endfor
|
2021-02-02 09:21:41 +01:00
|
|
|
.endif
|
|
|
|
|
2021-07-30 09:26:17 +02:00
|
|
|
.-include "${_CONFIGDIR}/build.conf.local"
|
|
|
|
.include "${_CONFIGDIR}/build.conf"
|
2015-05-16 11:35:18 +02:00
|
|
|
|
2015-05-17 19:48:27 +02:00
|
|
|
# Bootstrap the build options if not set:
|
|
|
|
|
2015-05-16 11:35:18 +02:00
|
|
|
NAME?= OPNsense
|
2016-07-10 16:49:31 +02:00
|
|
|
TYPE?= ${NAME:tl}
|
2021-04-06 09:02:35 +02:00
|
|
|
SUFFIX?= # empty
|
2016-07-21 21:40:28 +02:00
|
|
|
_ARCH!= uname -p
|
2016-07-17 15:38:10 +02:00
|
|
|
ARCH?= ${_ARCH}
|
2021-07-30 09:26:17 +02:00
|
|
|
ABI?= ${_CONFIGDIR:C/^.*\///}
|
2016-12-26 11:08:46 +01:00
|
|
|
KERNEL?= SMP
|
2022-01-04 09:50:44 +01:00
|
|
|
ADDITIONS?= # empty
|
|
|
|
DEBUG?= # empty
|
2019-05-07 10:02:53 +02:00
|
|
|
DEVICE?= A10
|
2021-02-02 13:38:01 +01:00
|
|
|
COMSPEED?= 115200
|
2021-08-20 11:35:28 +02:00
|
|
|
UEFI?= arm dvd serial vga vm
|
2022-02-17 09:17:56 +01:00
|
|
|
ZFS?= # empty
|
2017-07-16 04:57:23 +02:00
|
|
|
GITBASE?= https://github.com/opnsense
|
2016-02-02 21:08:53 +01:00
|
|
|
MIRRORS?= https://opnsense.c0urier.net \
|
2023-08-04 08:10:20 +02:00
|
|
|
https://mirrors.nycbug.org/pub/opnsense \
|
|
|
|
https://mirror.wdc1.us.leaseweb.net/opnsense \
|
|
|
|
https://mirror.sfo12.us.leaseweb.net/opnsense \
|
|
|
|
https://mirror.fra10.de.leaseweb.net/opnsense \
|
|
|
|
https://mirror.ams1.nl.leaseweb.net/opnsense
|
2018-03-17 09:13:29 +01:00
|
|
|
SERVER?= user@does.not.exist
|
2019-05-08 06:22:54 +02:00
|
|
|
UPLOADDIR?= .
|
2015-05-16 11:35:18 +02:00
|
|
|
_VERSION!= date '+%Y%m%d%H%M'
|
|
|
|
VERSION?= ${_VERSION}
|
2016-02-28 22:57:54 +01:00
|
|
|
STAGEDIRPREFIX?=/usr/obj
|
2019-12-23 07:13:45 +01:00
|
|
|
|
2021-04-06 09:02:35 +02:00
|
|
|
EXTRABRANCH?= # empty
|
|
|
|
|
2021-02-01 16:35:18 +01:00
|
|
|
COREBRANCH?= stable/${ABI}
|
2023-07-26 13:34:52 +02:00
|
|
|
COREVERSION?= # empty
|
2021-08-19 10:15:55 +02:00
|
|
|
COREDIR?= ${ROOTDIR}/core
|
2021-02-01 16:35:18 +01:00
|
|
|
COREENV?= CORE_PHP=${PHP} CORE_ABI=${ABI} CORE_PYTHON=${PYTHON}
|
2021-04-06 09:02:35 +02:00
|
|
|
|
|
|
|
PLUGINSBRANCH?= stable/${ABI}
|
2021-08-19 10:15:55 +02:00
|
|
|
PLUGINSDIR?= ${ROOTDIR}/plugins
|
2021-04-06 09:02:35 +02:00
|
|
|
PLUGINSENV?= PLUGIN_PHP=${PHP} PLUGIN_ABI=${ABI} PLUGIN_PYTHON=${PYTHON}
|
|
|
|
|
|
|
|
PORTSBRANCH?= master
|
2021-08-19 10:15:55 +02:00
|
|
|
PORTSDIR?= ${ROOTDIR}/ports
|
2021-04-06 09:02:35 +02:00
|
|
|
PORTSENV?= # empty
|
|
|
|
|
2021-08-02 10:51:18 +02:00
|
|
|
PORTSREFURL?= https://git.FreeBSD.org/ports.git
|
2021-08-19 10:15:55 +02:00
|
|
|
PORTSREFDIR?= ${ROOTDIR}/freebsd-ports
|
2021-08-02 10:51:18 +02:00
|
|
|
PORTSREFBRANCH?=main
|
2021-04-06 09:02:35 +02:00
|
|
|
|
2021-02-01 16:35:18 +01:00
|
|
|
SRCBRANCH?= stable/${ABI}
|
2021-08-19 10:15:55 +02:00
|
|
|
SRCDIR?= ${ROOTDIR}/src
|
2019-02-24 18:33:44 +01:00
|
|
|
|
2016-02-02 16:47:06 +01:00
|
|
|
# A couple of meta-targets for easy use and ordering:
|
2015-05-17 19:48:27 +02:00
|
|
|
|
2022-01-18 11:40:28 +01:00
|
|
|
kernel ports distfiles: base
|
2021-01-27 16:22:47 +01:00
|
|
|
audit plugins: ports
|
2016-02-02 16:47:06 +01:00
|
|
|
core: plugins
|
2017-01-06 19:24:20 +01:00
|
|
|
packages test: core
|
2022-05-17 10:56:20 +02:00
|
|
|
arm dvd nano serial vga vm: kernel core
|
2021-01-26 11:36:07 +01:00
|
|
|
sets: kernel distfiles packages
|
2021-04-06 09:02:35 +02:00
|
|
|
images: dvd nano serial vga vm
|
2021-10-14 20:18:01 +02:00
|
|
|
release: dvd nano serial vga
|
2015-05-16 13:38:54 +02:00
|
|
|
|
2015-05-17 19:48:27 +02:00
|
|
|
# Expand target arguments for the script append:
|
|
|
|
|
|
|
|
.for TARGET in ${.TARGETS}
|
|
|
|
_TARGET= ${TARGET:C/\-.*//}
|
|
|
|
.if ${_TARGET} != ${TARGET}
|
2021-02-05 12:28:30 +01:00
|
|
|
.if ${SCRIPTS:M${_TARGET}}
|
|
|
|
${_TARGET}_ARGS+= ${TARGET:C/^[^\-]*(\-|\$)//}
|
|
|
|
.else
|
2015-05-17 19:48:27 +02:00
|
|
|
${_TARGET}_ARGS+= ${TARGET:C/^[^\-]*(\-|\$)//:S/,/ /g}
|
2021-02-05 12:28:30 +01:00
|
|
|
.endif
|
2015-05-17 19:48:27 +02:00
|
|
|
${TARGET}: ${_TARGET}
|
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
|
2016-05-20 16:12:11 +02:00
|
|
|
.if "${VERBOSE}" != ""
|
2015-09-09 16:20:18 +02:00
|
|
|
VERBOSE_FLAGS= -x
|
2016-07-17 15:38:10 +02:00
|
|
|
.else
|
|
|
|
VERBOSE_HIDDEN= @
|
2015-08-21 11:07:49 +02:00
|
|
|
.endif
|
|
|
|
|
2023-02-03 14:34:12 +01:00
|
|
|
.for _VERSION in ABI DEBUG LUA PERL PHP PYTHON RUBY SSL VERSION ZFS
|
2018-04-05 08:23:30 +02:00
|
|
|
VERSIONS+= PRODUCT_${_VERSION}=${${_VERSION}}
|
2018-04-01 12:24:11 +02:00
|
|
|
.endfor
|
|
|
|
|
2015-05-17 19:48:27 +02:00
|
|
|
# Expand build steps to launch into the selected
|
|
|
|
# script with the proper build options set:
|
|
|
|
|
|
|
|
.for STEP in ${STEPS}
|
2017-08-27 06:04:54 +02:00
|
|
|
${STEP}: lint-steps
|
2016-07-17 15:38:10 +02:00
|
|
|
${VERBOSE_HIDDEN} cd ${.CURDIR}/build && \
|
2016-12-26 11:08:46 +01:00
|
|
|
sh ${VERBOSE_FLAGS} ./${.TARGET}.sh -a ${ARCH} -F ${KERNEL} \
|
2023-02-07 09:19:08 +01:00
|
|
|
-n ${NAME} -v "${VERSIONS}" -s ${_CONFIGDIR} \
|
2015-07-09 14:32:50 +02:00
|
|
|
-S ${SRCDIR} -P ${PORTSDIR} -p ${PLUGINSDIR} -T ${TOOLSDIR} \
|
2016-07-05 08:55:27 +02:00
|
|
|
-C ${COREDIR} -R ${PORTSREFDIR} -t ${TYPE} -k "${PRIVKEY}" \
|
|
|
|
-K "${PUBKEY}" -l "${SIGNCHK}" -L "${SIGNCMD}" -d ${DEVICE} \
|
2021-02-02 13:38:01 +01:00
|
|
|
-m ${MIRRORS:Ox:[1]} -o "${STAGEDIRPREFIX}" -c ${COMSPEED} \
|
2016-12-23 16:55:19 +01:00
|
|
|
-b ${SRCBRANCH} -B ${PORTSBRANCH} -e ${PLUGINSBRANCH} \
|
2017-01-12 08:22:37 +01:00
|
|
|
-g ${TOOLSBRANCH} -E ${COREBRANCH} -G ${PORTSREFBRANCH} \
|
2022-02-18 10:48:38 +01:00
|
|
|
-H "${COREENV}" -u "${UEFI:tl}" -U "${SUFFIX}" \
|
2018-04-01 12:24:11 +02:00
|
|
|
-V "${ADDITIONS}" -O "${GITBASE}" -r "${SERVER}" \
|
2021-09-09 13:09:54 +02:00
|
|
|
-h "${PLUGINSENV}" -I "${UPLOADDIR}" -D "${EXTRABRANCH}" \
|
|
|
|
-A "${PORTSREFURL}" -J "${PORTSENV}" ${${STEP}_ARGS}
|
2015-05-16 11:35:18 +02:00
|
|
|
.endfor
|
2017-08-27 06:04:54 +02:00
|
|
|
|
|
|
|
.for SCRIPT in ${SCRIPTS}
|
2018-10-12 08:33:47 +02:00
|
|
|
${SCRIPT}: lint-composite
|
2023-02-07 08:02:13 +01:00
|
|
|
${VERBOSE_HIDDEN} cd ${.CURDIR} && \
|
2019-06-10 17:55:58 +02:00
|
|
|
sh ${VERBOSE_FLAGS} ./composite/${SCRIPT}.sh ${${SCRIPT}_ARGS}
|
2017-08-27 06:04:54 +02:00
|
|
|
.endfor
|
2022-01-18 08:56:37 +01:00
|
|
|
|
|
|
|
_OS!= uname -r
|
|
|
|
_OS:= ${_OS:C/-.*//}
|
|
|
|
.if "${_OS}" != "${OS}"
|
2022-01-20 12:34:34 +01:00
|
|
|
.error Expected OS version ${OS} for ${_CONFIGDIR}; to continue anyway set OS=${_OS}
|
2022-01-18 08:56:37 +01:00
|
|
|
.endif
|