From c836d9acadb691a21b28cafe9c77f5710f4564f0 Mon Sep 17 00:00:00 2001 From: Mark Linimon Date: Wed, 1 Dec 2010 02:32:49 +0000 Subject: [PATCH] Canonicalize the use of SRC_BASE to fix INDEX and duds builds on head nodes that don't have /usr/src. On pointyhat, this "just happens to work"; on a cleanly installed system like pointyhat-west, it didn't. Add overrides for Linux compatibility (again, it "just happened to work" on pointyhat). Move the code that sets PORTSDIR and SRC_BASE to the server side only. The code that overrides OSVERSION, OSREL, and BRANCH _must_ remain in the common code. --- Tools/portbuild/scripts/buildenv | 62 +++++++++++++++++++------------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/Tools/portbuild/scripts/buildenv b/Tools/portbuild/scripts/buildenv index 59119c20a31f..b49ef5c3884a 100644 --- a/Tools/portbuild/scripts/buildenv +++ b/Tools/portbuild/scripts/buildenv @@ -71,19 +71,46 @@ buildenv () { branch=$3 builddir=$4 - # Don't pick up host OPTIONS + # set up things for INDEX/duds builds + + # first, don't pick up host OPTIONS export PORT_DBDIR=/nonexistent + # Have to use realpath because 'make index' doesn't deal with + # symlinks in PORTSDIR - kk 020311 + if [ -d ${builddir}/ports/ ]; then + export PORTSDIR=$(realpath ${builddir}/ports) + else + export PORTSDIR=/nonexistent + fi + + if [ -d ${builddir}/src/ ]; then + export SRC_BASE=$(realpath ${builddir}/src) + else + export SRC_BASE=/nonexistent + fi + + # for archs that support COMPAT_IA32, set some flags for INDEX. + # Client kernels should be built appropriately. + for i in ${ARCHS_SUPPORTING_COMPAT_IA32}; do + if [ ${i} = ${arch} ]; then + export HAVE_COMPAT_IA32_KERN="yes" + export HAVE_COMPAT_IA32_LIBS="yes" + break + fi + done + for i in ${ARCHS_REQUIRING_LINPROCFS}; do + if [ ${i} = ${arch} ]; then + export LINUX_OSRELEASE=${DEFAULT_LINUX_OSRELEASE} + break + fi + done + buildenv.common ${pb} ${arch} ${branch} ${builddir} # override things destined for bsd.port.mk - export LOCALBASE=/usr/local export DISTDIR=${builddir}/distfiles export PACKAGES=${builddir}/packages - export PKGSUFFIX=.tbz - - # now unused: - # export PKGZIPCMD=bzip2 branchbase=$(get_branch_base ${branch}) if [ -z "${branchbase}" ]; then @@ -126,25 +153,12 @@ buildenv.common() { branch=$3 builddir=$4 - # Have to use realpath because 'make index' doesn't deal with - # symlinks in PORTSDIR - kk 020311 - if [ -d ${builddir}/ports/ ]; then - export PORTSDIR=$(realpath ${builddir}/ports) - else - export PORTSDIR=/nonexistent + if [ -f ${SRC_BASE}/sys/sys/param.h ]; then + export OSVERSION=$(awk '/^#define __FreeBSD_version/ {print $3}' < ${SRC_BASE}/sys/sys/param.h) fi - if [ -d ${builddir}/src/ ]; then - export SRCBASE=$(realpath ${builddir}/src) - else - export SRCBASE=/nonexistent - fi - - if [ -f ${SRCBASE}/sys/sys/param.h ]; then - export OSVERSION=$(awk '/^#define __FreeBSD_version/ {print $3}' < ${SRCBASE}/sys/sys/param.h) - fi - if [ -f ${SRCBASE}/sys/conf/newvers.sh ]; then - export OSREL=$(awk 'BEGIN {FS="\""}; /^REVISION/ {print $2}' < ${SRCBASE}/sys/conf/newvers.sh) - export BRANCH=$(awk 'BEGIN {FS="\""}; /^BRANCH/ {print $2}' < ${SRCBASE}/sys/conf/newvers.sh) + if [ -f ${SRC_BASE}/sys/conf/newvers.sh ]; then + export OSREL=$(awk 'BEGIN {FS="\""}; /^REVISION/ {print $2}' < ${SRC_BASE}/sys/conf/newvers.sh) + export BRANCH=$(awk 'BEGIN {FS="\""}; /^BRANCH/ {print $2}' < ${SRC_BASE}/sys/conf/newvers.sh) fi export ARCH=${arch}