#!/bin/sh # # XXX lockfile and interlock with mkbindist to avoid overlapping # builds if [ $# -lt 2 ]; then echo "usage: makeworld [] [args]" exit 1 fi arch=$1 branch=$2 shift 2 buildid="latest" if [ $# -gt 0 ]; then case "$1" in -client) ;; -nocvs|-novcs) ;; *) buildid="$1" shift ;; esac fi pbc=${PORTBUILD_CHECKOUT:-/a/portbuild} pbd=${PORTBUILD_DATA:-/a/portbuild} builddir=${pbd}/${arch}/${branch}/builds/${buildid} if [ ! -d ${builddir} ]; then echo "build directory ${builddir} does not exist!" exit 1 fi . ${pbc}/admin/conf/admin.conf . ${pbc}/conf/server.conf . ${pbc}/conf/common.conf . ${pbd}/${arch}/portbuild.conf if [ -f ${builddir}/portbuild.conf ]; then . ${builddir}/portbuild.conf fi # NB: we can't use buildenv because it sets ARCH and MACHINE_ARCH that # confuses cross-builds export TARGET_ARCH=${arch} # Workaround needed for zfs - 20090321 erwin export NO_FSCHG=1 export MAKEOBJDIRPREFIX=${WORLDDIR}/obj client=0 novcs=0 # optional arguments while [ $# -gt 0 ]; do case "$1" in -client) client=1 ;; -nocvs|-novcs) novcs=1 ;; *) args="$1 ${args}" ;; esac shift done # XXX MCL I don't know what -client is supposed to do. if [ "$client" = "1" ]; then SRC_BASE=${pbd}/${arch}/src-client shift 1 else SRC_BASE=${builddir}/src # allow for per-build make.conf if [ -f ${builddir}/make.conf.server ]; then export __MAKE_CONF=${builddir}/make.conf.server else export __MAKE_CONF=/dev/null fi # allow for per-build src.conf if [ -f ${builddir}/src.conf.server ]; then export SRCCONF=${builddir}/src.conf.server else export SRCCONF=/dev/null fi fi cd ${SRC_BASE} || exit $? if [ "$novcs" = "0" ]; then echo "==> Updating source tree" # XXX MCL 20121120 not yet tested. ${VCS_UPDATE_COMMAND} ${SRC_BASE} || exit $? fi echo "==> Starting make buildworld" make buildworld ${args} || exit $? echo "==> Cleaning up destdir" destdir=${WORLDDIR}/${arch}/${branch} rm -rf ${destdir}/ chflags -R noschg ${destdir}/ rm -rf ${destdir}/ mkdir -p ${destdir} || exit $? echo "==> Starting make installworld" if [ "$client" = "0" ]; then export NEWSPARC_TIMETYPE=__int64_t make installworld DESTDIR=${destdir} || exit $? echo "==> Starting make distribute" make DESTDIR=${destdir} distrib-dirs && \ make DESTDIR=${destdir} distribution || exit $? else echo "==> Not doing installworld of client source tree" fi