summaryrefslogtreecommitdiff
path: root/sysutils/sysbuild
diff options
context:
space:
mode:
authorjmmv <jmmv@pkgsrc.org>2012-10-13 18:40:33 +0000
committerjmmv <jmmv@pkgsrc.org>2012-10-13 18:40:33 +0000
commit8a065b995da41bee0a7aa70225d6a675ddfd129f (patch)
treeff67109a3c97c1e8db0537d27388f9ccb7ab164c /sysutils/sysbuild
parent2907f52ae654eb7c400b07395e6bd31d8f39a499 (diff)
downloadpkgsrc-8a065b995da41bee0a7aa70225d6a675ddfd129f.tar.gz
Update to 2.4:
- Add a MKVARS variable to pass arbitrary variables to build.sh through -V. E.g. MKVARS="MKDEBUG=yes". - Move the documentation of the configuration file to a new sysbuild.conf(5).
Diffstat (limited to 'sysutils/sysbuild')
-rw-r--r--sysutils/sysbuild/Makefile10
-rw-r--r--sysutils/sysbuild/PLIST3
-rw-r--r--sysutils/sysbuild/files/sysbuild.1126
-rw-r--r--sysutils/sysbuild/files/sysbuild.conf.5161
-rw-r--r--sysutils/sysbuild/files/sysbuild.sh11
-rw-r--r--sysutils/sysbuild/files/sysbuild_test.sh32
6 files changed, 216 insertions, 127 deletions
diff --git a/sysutils/sysbuild/Makefile b/sysutils/sysbuild/Makefile
index 397b6366c02..7ac980b75da 100644
--- a/sysutils/sysbuild/Makefile
+++ b/sysutils/sysbuild/Makefile
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.21 2012/08/25 19:20:53 jmmv Exp $
+# $NetBSD: Makefile,v 1.22 2012/10/13 18:40:33 jmmv Exp $
-DISTNAME= sysbuild-2.3
+DISTNAME= sysbuild-2.4
CATEGORIES= sysutils
MASTER_SITES= # empty
DISTFILES= # empty
@@ -68,13 +68,13 @@ do-build:
| ${BUILDLINK_PREFIX.shtk}/bin/shtk build \
-s ${SH} -m ${file}_main -o ${WRKSRC}/${file} -
.endfor
-.for file in sysbuild.1 sysbuild4cron.1 default.conf
+.for file in sysbuild.1 sysbuild4cron.1 sysbuild.conf.5 default.conf
sed ${BUILD_SUBST} <${FILESDIR}/${file} >${WRKSRC}/${file}
.endfor
cp ${FILESDIR}/env.sh ${WRKSRC}
chmod +x ${WRKSRC}/env.sh
-INSTALLATION_DIRS+= bin ${PKGMANDIR}/man1 \
+INSTALLATION_DIRS+= bin ${PKGMANDIR}/man1 ${PKGMANDIR}/man5 \
share/examples/sysbuild share/sysbuild
do-install:
@@ -84,6 +84,8 @@ do-install:
${DESTDIR}${PREFIX}/${PKGMANDIR}/man1/
${INSTALL_MAN} ${WRKSRC}/sysbuild4cron.1 \
${DESTDIR}${PREFIX}/${PKGMANDIR}/man1/
+ ${INSTALL_MAN} ${WRKSRC}/sysbuild.conf.5 \
+ ${DESTDIR}${PREFIX}/${PKGMANDIR}/man5/
.for file in default.conf
${INSTALL_DATA} ${WRKSRC}/${file} ${DESTDIR}${EGDIR}
.endfor
diff --git a/sysutils/sysbuild/PLIST b/sysutils/sysbuild/PLIST
index cc30b85816e..61358651234 100644
--- a/sysutils/sysbuild/PLIST
+++ b/sysutils/sysbuild/PLIST
@@ -1,8 +1,9 @@
-@comment $NetBSD: PLIST,v 1.6 2012/08/25 19:20:53 jmmv Exp $
+@comment $NetBSD: PLIST,v 1.7 2012/10/13 18:40:33 jmmv Exp $
bin/sysbuild
bin/sysbuild4cron
man/man1/sysbuild.1
man/man1/sysbuild4cron.1
+man/man5/sysbuild.conf.5
share/examples/sysbuild/default.conf
share/sysbuild/env.sh
${TESTS}tests/sysbuild/Kyuafile
diff --git a/sysutils/sysbuild/files/sysbuild.1 b/sysutils/sysbuild/files/sysbuild.1
index b03c355a4da..20a579147c6 100644
--- a/sysutils/sysbuild/files/sysbuild.1
+++ b/sysutils/sysbuild/files/sysbuild.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: sysbuild.1,v 1.5 2012/08/25 19:20:53 jmmv Exp $
+.\" $NetBSD: sysbuild.1,v 1.6 2012/10/13 18:40:33 jmmv Exp $
.\" Copyright 2012 Google Inc.
.\" All rights reserved.
.\"
@@ -26,7 +26,7 @@
.\" 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.
-.Dd August 25, 2012
+.Dd October 13, 2012
.Dt SYSBUILD 1
.Os
.Sh NAME
@@ -109,6 +109,8 @@ The following options apply to all commands:
.Bl -tag -width XXXX
.It Fl c Ar config_name
Specifies the configuration file to use.
+The format of the file is described in
+.Xr sysbuild.conf 5 .
.Pp
If
.Ar config_name
@@ -135,8 +137,7 @@ The
.Ar variable
part of the argument must be any of the recognized configuration variables
described in
-.Sx Configuration file
-below.
+.Xr sysbuild.conf 5 .
The
.Ar value ,
if not empty, specifies the value to set the configuration variable to.
@@ -282,122 +283,6 @@ command as root only, set
to
.Sq false
in your user configuration files, and do your builds as another user.
-.Ss Configuration file
-Configuration files for
-.Nm
-are plain shell scripts that define a set of recognized variables.
-.Pp
-As scripts, they can perform any magic they desire to deduce the value of
-the configuration variables.
-For example, the default configuration file shipped with
-.Nm
-automatically deduces the value of the
-.Va NJOBS
-variable by looking at how many CPUs are available in the system.
-.Pp
-The following variables configure the source trees:
-.Bl -tag -width INCREMENTAL_BUILD
-.It Va CVSROOT
-Location of the CVS root from which to check out or update the src and xsrc
-modules.
-.Pp
-Default:
-.Sq :ext:anoncvs@anoncvs.NetBSD.org:/cvsroot
-.It Va CVSTAG
-CVS tag to use during checkouts or updates of the src and xsrc modules.
-.Pp
-Default: not defined.
-.It Va SRCDIR
-Path to the src module.
-If you want
-.Nm
-to perform an update of this directory before every build, you will need
-write access to it.
-Otherwise, you can use a read-only directory.
-.Pp
-Default:
-.Pa /usr/src .
-.It Va UPDATE_SOURCES
-Whether to perform an update of the source tree before every build or not.
-.Pp
-Default:
-.Sq true .
-.It Va XSRCDIR
-Path to the xsrc module.
-If you want
-.Nm
-to perform an update of this directory before every build, you will need
-write access to it.
-Otherwise, you can use a read-only directory.
-.Pp
-Defining this variable causes
-.Nm
-to build the X Window System as part of the build of
-.Nx .
-.Pp
-Default: not defined.
-.El
-.Pp
-The following variables configure the location of the build files:
-.Bl -tag -width INCREMENTAL_BUILD
-.It Va BUILD_ROOT
-Path to the directory in which to place build files.
-These include the obj tree, the destdir and the cross-build tools generated
-by the
-.Nm build.sh
-script.
-The contents of this directory are sorted by machine type so that it can be
-shared across builds for different machines.
-.Pp
-Default:
-.Pa ~/sysbuild/ .
-.It Va RELEASEDIR
-Path to the directory that will contain the build products (aka the release
-files).
-The contents of this directory are sorted by machine type so that it can be
-shared across builds for different machines.
-.Pp
-Default:
-.Pa ~/sysbuild/release .
-.El
-.Pp
-The following variables configure the build process:
-.Bl -tag -width INCREMENTAL_BUILD
-.It Va BUILD_TARGETS
-Whitespace-separated list of targets to pass to
-.Nm build.sh
-during builds.
-Targets can be prefixed by a machine name and a colon, in which case they only
-apply to that machine; for example,
-.Sq macppc:kernel=${HOME}/CUSTOM macppc:releasekernel=${HOME}/CUSTOM .
-.Pp
-Default:
-.Sq release .
-.It Va INCREMENTAL_BUILD
-Whether to perform update builds or not.
-An update build reuses existing obj, destdir and tools trees.
-.Pp
-Of special note is that
-.Nm
-will take care of pruning files likely to cause breakage during update
-builds before performing the build itself.
-As an example, this includes deleting all the modules from
-.Pa destdir/stand/<platform>/ .
-.Pp
-Default:
-.Sq false .
-.It Va MACHINES
-Whitespace-separated list of machine types to build for.
-.Pp
-Default: the name of the host machine type.
-.It Va NJOBS
-Number of parallel jobs to use during the build.
-If not set, disables parallel builds (which, due to
-.Nm make 1
-semantics, is not the same as setting this to 1).
-.Pp
-Default: not defined.
-.El
.Sh FILES
.Bl -tag -width XXXX
.It Pa @SYSBUILD_ETCDIR@/
@@ -419,6 +304,7 @@ flag is not provided.
.Sh SEE ALSO
.Xr cvs 1 ,
.Xr sysbuild4cron 1 ,
+.Xr sysbuild.conf 5 ,
.Xr hier 7 ,
.Pa /usr/src/BUILDING
.Sh AUTHORS
diff --git a/sysutils/sysbuild/files/sysbuild.conf.5 b/sysutils/sysbuild/files/sysbuild.conf.5
new file mode 100644
index 00000000000..12326c70dd0
--- /dev/null
+++ b/sysutils/sysbuild/files/sysbuild.conf.5
@@ -0,0 +1,161 @@
+.\" $NetBSD: sysbuild.conf.5,v 1.1 2012/10/13 18:40:33 jmmv Exp $
+.\" Copyright 2012 Google Inc.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions are
+.\" met:
+.\"
+.\" * Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" * 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.
+.\" * Neither the name of Google Inc. nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT
+.\" OWNER 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.
+.Dd October 13, 2012
+.Dt SYSBUILD.CONF 5
+.Os
+.Sh NAME
+.Nm sysbuild.conf
+.Nd configuration file format for the sysbuild tool
+.Sh DESCRIPTION
+Configuration files for
+.Xr sysbuild 1
+are plain shell scripts that define a set of recognized variables.
+.Pp
+As scripts, they can perform any magic they desire to deduce the value of
+the configuration variables.
+For example, the default configuration file shipped with
+.Xr sysbuild 1
+automatically deduces the value of the
+.Va NJOBS
+variable by looking at how many CPUs are available in the system.
+.Pp
+The following variables configure the source trees:
+.Bl -tag -width INCREMENTAL_BUILD
+.It Va CVSROOT
+Location of the CVS root from which to check out or update the src and xsrc
+modules.
+.Pp
+Default:
+.Sq :ext:anoncvs@anoncvs.NetBSD.org:/cvsroot
+.It Va CVSTAG
+CVS tag to use during checkouts or updates of the src and xsrc modules.
+.Pp
+Default: not defined.
+.It Va SRCDIR
+Path to the src module.
+If you want
+.Xr sysbuild 1
+to perform an update of this directory before every build, you will need
+write access to it.
+Otherwise, you can use a read-only directory.
+.Pp
+Default:
+.Pa /usr/src .
+.It Va UPDATE_SOURCES
+Whether to perform an update of the source tree before every build or not.
+.Pp
+Default:
+.Sq true .
+.It Va XSRCDIR
+Path to the xsrc module.
+If you want
+.Xr sysbuild 1
+to perform an update of this directory before every build, you will need
+write access to it.
+Otherwise, you can use a read-only directory.
+.Pp
+Defining this variable causes
+.Xr sysbuild 1
+to build the X Window System as part of the build of
+.Nx .
+.Pp
+Default: not defined.
+.El
+.Pp
+The following variables configure the location of the build files:
+.Bl -tag -width INCREMENTAL_BUILD
+.It Va BUILD_ROOT
+Path to the directory in which to place build files.
+These include the obj tree, the destdir and the cross-build tools generated
+by the
+.Nm build.sh
+script.
+The contents of this directory are sorted by machine type so that it can be
+shared across builds for different machines.
+.Pp
+Default:
+.Pa ~/sysbuild/ .
+.It Va RELEASEDIR
+Path to the directory that will contain the build products (aka the release
+files).
+The contents of this directory are sorted by machine type so that it can be
+shared across builds for different machines.
+.Pp
+Default:
+.Pa ~/sysbuild/release .
+.El
+.Pp
+The following variables configure the build process:
+.Bl -tag -width INCREMENTAL_BUILD
+.It Va BUILD_TARGETS
+Whitespace-separated list of targets to pass to
+.Nm build.sh
+during builds.
+Targets can be prefixed by a machine name and a colon, in which case they only
+apply to that machine; for example,
+.Sq macppc:kernel=${HOME}/CUSTOM macppc:releasekernel=${HOME}/CUSTOM .
+.Pp
+Default:
+.Sq release .
+.It Va INCREMENTAL_BUILD
+Whether to perform update builds or not.
+An update build reuses existing obj, destdir and tools trees.
+.Pp
+Of special note is that
+.Xr sysbuild 1
+will take care of pruning files likely to cause breakage during update
+builds before performing the build itself.
+As an example, this includes deleting all the modules from
+.Pa destdir/stand/<platform>/ .
+.Pp
+Default:
+.Sq false .
+.It Va MACHINES
+Whitespace-separated list of machine types to build for.
+.Pp
+Default: the name of the host machine type.
+.It Va MKVARS
+Whitespace-separated list of
+.Sq VARIABLE=value
+.Xr make 1
+variable definitions to be set during the build.
+A useful example would be:
+.Sq MKVARS="MKDEBUG=yes" .
+.Pp
+Default: not defined.
+.It Va NJOBS
+Number of parallel jobs to use during the build.
+If not set, disables parallel builds (which, due to
+.Nm make 1
+semantics, is not the same as setting this to 1).
+.Pp
+Default: not defined.
+.El
+.Sh SEE ALSO
+.Xr sysbuild 1
diff --git a/sysutils/sysbuild/files/sysbuild.sh b/sysutils/sysbuild/files/sysbuild.sh
index 8f7b50f66c2..b13d92d56bc 100644
--- a/sysutils/sysbuild/files/sysbuild.sh
+++ b/sysutils/sysbuild/files/sysbuild.sh
@@ -40,7 +40,8 @@ shtk_import process
#
# Please remember to update sysbuild(1) if you change this list.
SYSBUILD_CONFIG_VARS="BUILD_ROOT BUILD_TARGETS CVSROOT CVSTAG INCREMENTAL_BUILD
- MACHINES NJOBS RELEASEDIR SRCDIR UPDATE_SOURCES XSRCDIR"
+ MACHINES MKVARS NJOBS RELEASEDIR SRCDIR UPDATE_SOURCES
+ XSRCDIR"
# Paths to installed files.
@@ -95,6 +96,11 @@ do_one_build() {
rm -rf "${basedir}/tools"
fi
+ local Vflags=
+ for Vflag in $(shtk_config_get_default MKVARS ""); do
+ Vflags="${Vflags} -V${Vflag}"
+ done
+
local xflag=
local Xflag=
if shtk_config_has XSRCDIR; then
@@ -130,6 +136,7 @@ do_one_build() {
-R"$(shtk_config_get RELEASEDIR)" \
-T"${basedir}/tools" \
-U \
+ ${Vflags} \
${Xflag} \
${jflag} \
-m"${machine}" \
@@ -270,7 +277,7 @@ sysbuild_fetch() {
if shtk_config_has XSRCDIR; then
shtk_cli_info "Updating X11 source tree"
shtk_cvs_fetch "${cvsroot}" xsrc \
- "$(shtk_config_get_default CVSTAG '')" "$(shtk_config_get XSRCDIR)"
+ "$(shtk_config_get_default CVSTAG '')" "$(shtk_config_get XSRCDIR)"
fi
}
diff --git a/sysutils/sysbuild/files/sysbuild_test.sh b/sysutils/sysbuild/files/sysbuild_test.sh
index dc12934d565..94af42f2add 100644
--- a/sysutils/sysbuild/files/sysbuild_test.sh
+++ b/sysutils/sysbuild/files/sysbuild_test.sh
@@ -396,6 +396,35 @@ EOF
}
+atf_test_case build__mkvars
+build__mkvars_body() {
+ mkdir -p sysbuild/src
+ create_mock_binary sysbuild/src/build.sh
+
+ atf_check -o save:stdout -e save:stderr sysbuild \
+ -c /dev/null -o CVSROOT="${MOCK_CVSROOT}" \
+ -o MKVARS="MKDEBUG=yes FOO=bar" build -f
+
+ cat >expout <<EOF
+Command: build.sh
+Directory: ${HOME}/sysbuild/src
+Arg: -D${HOME}/sysbuild/$(uname -m)/destdir
+Arg: -M${HOME}/sysbuild/$(uname -m)/obj
+Arg: -N2
+Arg: -R${HOME}/sysbuild/release
+Arg: -T${HOME}/sysbuild/$(uname -m)/tools
+Arg: -U
+Arg: -VMKDEBUG=yes
+Arg: -VFOO=bar
+Arg: -m$(uname -m)
+Arg: -u
+Arg: release
+
+EOF
+ atf_check -o file:expout cat commands.log
+}
+
+
atf_test_case build__with_x11
build__with_x11_body() {
create_mock_cvsroot "${MOCK_CVSROOT}"
@@ -488,6 +517,7 @@ CVSROOT = :ext:anoncvs@anoncvs.NetBSD.org:/cvsroot
CVSTAG is undefined
INCREMENTAL_BUILD = false
MACHINES = $(uname -m)
+MKVARS is undefined
NJOBS is undefined
RELEASEDIR = ${HOME}/sysbuild/release
SRCDIR = ${HOME}/sysbuild/src
@@ -571,6 +601,7 @@ CVSROOT = foo bar
CVSTAG = the-new-tag
INCREMENTAL_BUILD = false
MACHINES = $(uname -m)
+MKVARS is undefined
NJOBS is undefined
RELEASEDIR = ${HOME}/sysbuild/release
SRCDIR is undefined
@@ -870,6 +901,7 @@ atf_init_test_cases() {
atf_add_test_case build__many_machines
atf_add_test_case build__machine_targets__ok
atf_add_test_case build__machine_targets__unmatched
+ atf_add_test_case build__mkvars
atf_add_test_case build__with_x11
atf_add_test_case build__some_args