Building ports in a chrooted tree

Alexander Leidinger Alexander at Leidinger.net
Tue Apr 22 11:47:50 PDT 2003


On 22 Apr 2003 11:58:39 -0400
Mike Patterson <mpatters at cs.uwaterloo.ca> wrote:

> I'm interested in creating a clean build environment for ports,
> something like the one used on bento.  (See last paragraph for my
> reasons, and feel free to let me know if I've apparently been smoking
> substances of doubtful legality.)

If you just want to have a pristine environment like after a freshly
installed FreeBSD you don't need something like the bento scripts.

In the work in progress for my SystemOnCD port I implemented some
Makefile-fu which builds other ports in a pristine environment. You just
need the complete source of the target version of the OS and it should
be buildable on the actual version of the build machine.

Just grab http://www.leidinger.net/FreeBSD/SystemOnCD-WIP.tar.bz2,
extract it to somewhere with a lot of space and create
the /usr/ports/packages directory.

Now you just need to cd into the SystemOnCD directory, and run e.g.
   make -DCREATE_PACKAGES -DCOPY_DISTFILES WANTED_PORTS="www/apache13 www/mod_php4 shells/zsh"

You need to run this as root, as we have to mount an instance of devfs
into the fresh build environment.

Simplified explanation of what this does:
This builds the world, installs it into a subdir, copies /usr/ports into
subdir/usr/ports (so you should have no build of a port in progress,
else every object and source file of this port will get copied into the
subdir too), chroots into it and then builds all ports in WANTED_PORTS.
If you already have a /usr/obj with a finished buildworld and/or
buildkernel you can add -DNO_BUILDWORLD and/or -DNO_BUILDKERNEL to the
command line of make.

When it finishes without errors, you should have some packages in
/usr/ports/packages.

Bye,
Alexander.

P.S.: Don't burn the generated ISO image on a CD, it doesn't do anything
useful at the moment.
-- 
              The best things in life are free, but the
                expensive ones are still worth a look.

http://www.Leidinger.net                       Alexander @ Leidinger.net
  GPG fingerprint = C518 BC70 E67F 143F BE91  3365 79E2 9C60 B006 3FE7


More information about the freebsd-ports mailing list