Date: Fri, 19 Aug 2011 01:30:30 +0400 From: Eygene Ryabinkin <rea@freebsd.org> To: Matt Burke <mattblists@icritical.com> Cc: freebsd-hackers@freebsd.org Subject: Re: Alternate source trees Message-ID: <vmm15mlbc2yxSO/NSSar6m2ctdM@xmusdHALH2VtzUYFiT%2BWRPSso%2Bo> In-Reply-To: <4E4A5DFC.7010807@icritical.com> References: <4E4A5DFC.7010807@icritical.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?vmm15mlbc2yxSO/NSSar6m2ctdM>