From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 18 21:30:35 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58BC41065673 for ; Thu, 18 Aug 2011 21:30:35 +0000 (UTC) (envelope-from rea@codelabs.ru) Received: from 0.mx.codelabs.ru (0.mx.codelabs.ru [144.206.177.45]) by mx1.freebsd.org (Postfix) with ESMTP id E363B8FC0A for ; Thu, 18 Aug 2011 21:30:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=codelabs.ru; s=two; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=Ce3t3CtqWnZjAVJeSjWQ9jY8JYOkD2y9mo5BIdrcKp8=; b=B7Vme87m2pDFF3d8uzqnR4r2BMfxcYpiJHOm/HBZ4TulcF/RtIBqW5X/vzI99UpbCFfPEErXv/JEhHoJOaIDvQ1y9tj2NlfrTzKfinIbBHdO8Mcphb1/O1RRVO7d0I4dQDhFSbq3m71JdcIbMxdRCTN8PA4hJZsOmYqTPTM0CBhr0lbsnMf37HgFSsjCXzRMdHuKQHlXEIVcOAB9WQJ9IFy6Tet/pPSj5u35q4CMR+JCUP9ZdOeNKHndMoJNzLG2mEiu6ufnsff59CvEAQcyhE5UQy4wdgJrKT2P9Ztr7ZvK7Y3kutLnp8ynnj4UajZOM5jbGwx+Kzq5RNyB3kkrFg==; Received: from phoenix.codelabs.ru (ppp91-77-176-196.pppoe.mtu-net.ru [91.77.176.196]) by 0.mx.codelabs.ru with esmtpsa (TLSv1:AES256-SHA:256) id 1QuAAa-000LW4-Sv; Fri, 19 Aug 2011 01:30:33 +0400 Date: Fri, 19 Aug 2011 01:30:30 +0400 From: Eygene Ryabinkin To: Matt Burke Message-ID: References: <4E4A5DFC.7010807@icritical.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Oiv9uiLrevHtW1RS" Content-Disposition: inline In-Reply-To: <4E4A5DFC.7010807@icritical.com> Sender: rea@codelabs.ru Cc: freebsd-hackers@freebsd.org Subject: Re: Alternate source trees X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 21:30:35 -0000 --Oiv9uiLrevHtW1RS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Tue, Aug 16, 2011 at 01:09:32PM +0100, Matt Burke wrote: > How does the build process know about the non-symlinked path anyway? > I can't see where (or understand why) it uses "pwd -P" Make(1)'s .OBJDIR is used: {{{ .OBJDIR A path to the directory where the targets are built. = At startup, make searches for an alternate directory to place target files. It will attempt to change into th= is special directory and will search this directory for makefiles not found in the current directory. The fol- lowing directories are tried in order: 1. ${MAKEOBJDIRPREFIX}/`pwd` 2. ${MAKEOBJDIR} 3. obj.${MACHINE} 4. obj 5. /usr/obj/`pwd` The first directory that make successfully changes into is used. If either MAKEOBJDIRPREFIX or MAKEOBJDIR is = set in the environment but make is unable to change into t= he corresponding directory, then the current directory is used without checking the remainder of the list. If t= hey are undefined and make is unable to change into any of the remaining three directories, then the current dire= c- tory is used. Note, that MAKEOBJDIRPREFIX and MAKEOBJ= DIR must be environment variables and should not be set on make's command line. The make utility sets .OBJDIR to the canonical path gi= ven by getcwd(3). }}} getcwd(3) always fully resolves current path, so symlinking won't be taken into account. > I'm trying to setup a box to do automated FreeBSD builds for other hosts > from multiple source trees. >=20 > I have a couple of source trees mounted - for legibility's sake let's say > /build/stable and /build/current. I also have a few obj dirs for different > targets. The current obj tree is symlinked to /usr/obj, and this works fi= ne. >=20 > The problem comes when I symlink /usr/src: when I buildworld, I get > /usr/obj/build/current/[...] instead of the desired /usr/obj/usr/src/[...] > This is presumably fine when installing on the same machine, but it breaks > when using it on another host with /usr/src and /usr/obj mounted over nfs. Hmm, current Makefile system for src sets MAKEOBJDIRPREFIX via ?=3D, so you're out of luck with symlinking on the build machine. May be you can mount /build/stable or /build/current on the target machine via NFS (and, of course, /usr/obj or other directory that you can choose with the MAKEOBJPREFIX, this leaves room for multi-architecture object trees on the same build host) and invoke make from the relevant directory? Another possibility, if for some reason you want /usr/src to point to the correct place at your "destination" machines, to always mount /build across hosts where you're installing the stuff and to symlink /usr/src to the proper location inside the /build. --=20 Eygene Ryabinkin ,,,^..^,,, [ Life's unfair - but root password helps! | codelabs.ru ] [ 82FE 06BC D497 C0DE 49EC 4FF0 16AF 9EAE 8152 ECFB | freebsd.org ] --Oiv9uiLrevHtW1RS Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (FreeBSD) iF4EAREIAAYFAk5NhHYACgkQFq+eroFS7PtavgD/UnTX8SK1QnKL948YH9rJK89M gUNKktxD2fCHHAwZAlEA/iBTJ3laLeXgguN/KwNtc+pL8zv08uLkWrUw7MOmN11u =8T5P -----END PGP SIGNATURE----- --Oiv9uiLrevHtW1RS--