Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Dec 2012 07:37:17 -0800
From:      Garrett Cooper <yanegomi@gmail.com>
To:        Michael Vale <masked@internode.on.net>
Cc:        freebsd-hackers@freebsd.org, freebsd-arch@freebsd.org, freebsd-ports@freebsd.org, "Simon J. Gerraty" <sjg@juniper.net>
Subject:   Re: Cross Compiling of ports Makefiles.
Message-ID:  <CAGH67wT8=Nwhy=40k=x18Qk2KaWL-pJ7QQhs94kz=hLXBUupJA@mail.gmail.com>
In-Reply-To: <641F54E990B14A0AB0A287AE7F810192@forexamplePC>
References:  <E49F944634B24A7387BC937CBE19D2D9@forexamplePC> <20121227180044.7947F58094@chaos.jnpr.net> <641F54E990B14A0AB0A287AE7F810192@forexamplePC>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Dec 31, 2012 at 6:33 AM, Michael Vale <masked@internode.on.net> wro=
te:
> -----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=92s 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=3D/usr/local
make all
make install DESTDIR=3D/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.

> 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=92s DESTDIR ${makeobjDESTDIR} before running do-install.  Now i=
=92ve
>> 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=3D/usr/obj/crossoutroot/
> DESTDIR=3D${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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGH67wT8=Nwhy=40k=x18Qk2KaWL-pJ7QQhs94kz=hLXBUupJA>