From owner-freebsd-arch@FreeBSD.ORG Mon Dec 31 16:32:00 2012 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9AEBE961; Mon, 31 Dec 2012 16:32:00 +0000 (UTC) (envelope-from masked@internode.on.net) Received: from ipmail05.adl6.internode.on.net (ipmail05.adl6.internode.on.net [IPv6:2001:44b8:8060:ff02:300:1:6:5]) by mx1.freebsd.org (Postfix) with ESMTP id 7A80E8FC08; Mon, 31 Dec 2012 16:31:59 +0000 (UTC) Received: from ppp221-140.static.internode.on.net (HELO forexamplePC) ([150.101.221.140]) by ipmail05.adl6.internode.on.net with SMTP; 01 Jan 2013 03:01:54 +1030 Message-ID: <62E9D311E3F4410C93F39BF78047F4C4@forexamplePC> From: "Michael Vale" To: "Garrett Cooper" References: <20121227180044.7947F58094@chaos.jnpr.net> <641F54E990B14A0AB0A287AE7F810192@forexamplePC> In-Reply-To: Subject: Re: Cross Compiling of ports Makefiles. Date: Tue, 1 Jan 2013 03:31:53 +1100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="Windows-1252"; reply-type=original Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 16.4.3505.912 X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3505.912 Cc: freebsd-hackers@freebsd.org, "Simon J. Gerraty" , freebsd-ports@freebsd.org, freebsd-arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Dec 2012 16:32:00 -0000 -----Original Message----- From: Garrett Cooper Sent: Tuesday, January 01, 2013 2:37 AM To: Michael Vale Cc: freebsd-hackers@freebsd.org ; freebsd-arch@freebsd.org ; freebsd-ports@freebsd.org ; Simon J. Gerraty Subject: Re: Cross Compiling of ports Makefiles. On Mon, Dec 31, 2012 at 6:33 AM, Michael Vale wrote: > -----Original Message----- From: Simon J. Gerraty > Sent: Friday, December 28, 2012 5:00 AM > To: Michael Vale > Cc: freebsd-hackers@freebsd.org ; freebsd-arch@freebsd.org ; > freebsd-ports@freebsd.org > Subject: Re: Cross Compiling of ports Makefiles. > > >> Doing the same thing could also prevent the need for a DESTDIR JAIL >> install at all and just use the real build machine’s build env, rather >> than a jail. Regardless. We still have to install these targets and >> their DESTDIR is skewed. There is a few options, > > > I think I know what you mean, but not clear on the "their DESTDIR is > skewed" bit. You were probably thinking of PREFIX, not DESTDIR. DESTDIR in ports-land should be an install directory wherein if I do... ./configure --prefix=/usr/local make all make install DESTDIR=/chroot/ It would install all (well, ok most if it needs to touch more of the base system) of the package files into /chroot/usr/local and pathing would be setup appropriately that way. Ahh, What I think I meant was their DESTDIR is skewed because it installs into ${JAILDIR}, not ${DESTDIR}${ROOTFS}, which could just == ${DESTDIR}. ${PREFIX} cannot be used as it is required to be correct for pkg register, pkgdb, ldconfig etc. > I'm not sure what I meant here either. Thank-you for taking the time to > read the entire e-mail! :) > >> One is to have a MAKEOBJDIRPREFIX like option, and redefine every >> target’s DESTDIR ${makeobjDESTDIR} before running do-install. Now i’ve >> yet to complete this stage, but I believe this is the way to do it. > > Would it be sufficient to have an INSTALL_PREFIX and/or INSTALL_DESTDIR > so that DESTDIR can be different during install ? > [I was recently experimenting with something similar...] > > > So how would that work? > > pre-install: > INSTALL_DESTDIR=/usr/obj/crossoutroot/ > DESTDIR=${INSTALL_DESTDIR} > > do-install: > > ? I will try something like that. > > Thank-you for taking the time to reply Simon, I've thought about this item quite a bit and while I might not have hashed out all of the internal details, I think that it should go something like this: 0. Run standard build/install targets which will go and create necessary binaries into a predefined world dir. Once the installation is complete (installworld / distribution)... 1. Mount the necessary mountpoints. 2. Install the "host-compiled" tools into a predefined set of directories. Example: /chroot/h/bin /chroot/h/sbin /chroot/h/usr/bin /chroot/h/usr/libexec /chroot/h/usr/sbin 3. Do a nullfs overlay of the "host-compiled" tools on top of the target system's equivalent directories in order to provide the needed bits for executing the build. 4. Verify sanity for the install base (just in case the new binaries don't run on the host system due to KPI differences) with a basic check like we use for make in `upgrade_checks`. 5. Mock up the build environment to look like the target system, like what's described . 6. Jump into the world dir. 7. Start building/installing packages. Notes: I'm suggesting steps 2. and 3. because while fixing hardcoding in ports packages is a noble effort, there's just way too much work to be done in order to accomplish the job (we have other problems to contend with around the ports tree) and it's an ongoing battle trying to get everyone to use sane build methodologies (I'm making an assumption based on several projects I've used, but many devs aren't capable build system engineers because it takes a bit of mental skewing, so hardcoding abounds in a number of places). Doing this will allow us to have a working prototype quicker, so in the event that others wish to make the process more streamlined in the future, they could do so. Whether or not this handled in the FreeBSD build system or outside it is an implementation detail, but for the sake of modularity (and to keep KISS principle with the FreeBSD build system, which I would argue is complicated enough) I would say make them separate processes. Besides, we already have canned methods for doing this in NanoBSD, PicoBSD, etc already -- and they really could deserve some consolidation (speaking of which, have you looked at using these in zrouter?). You might want to look at FreeNAS 8.x's build architecture and use that as a starting point for how to do things. imp@ designed the initial system, I (gcooper@) modified it heavily, and jhixson@/jpaetzel@ modified it more after I left iXsystems in order to work with their plugin architecture. I can send you a copy of the system I was starting to architect ("Avatar") if you wish. Overall, I like the direction you're going in and I'm glad someone is picking this up. I greatly appreciate it because it's been on my laundry list of items that need to get done for some time :). HTH, -Garrett _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" ----- No virus found in this message. Checked by AVG - www.avg.com Version: 2013.0.2805 / Virus Database: 2637/5998 - Release Date: 12/30/12 ----- No virus found in this message. Checked by AVG - www.avg.com Version: 2013.0.2805 / Virus Database: 2637/5998 - Release Date: 12/30/12