Subject: Re: Building pkgsrc for alternative arch or OS rev?
To: Chris Ross <>
From: Eric Haszlakiewicz <>
List: current-users
Date: 01/24/2005 15:40:14
On Sun, Dec 26, 2004 at 08:12:49PM -0500, Chris Ross wrote:
>   Hi.  My main development machine is an i386 running -current.  
> However,
> I have a few machines that are much slower that are providing most of my
> services.  Is there a [good] way to build against the obj trees that I 
> also
> built on this same build machine, so that the pkgsrc binaries are built 
> to
> run on an alternative arch, or an alternative version of NetBSD?

	Use null and union mounts combined with chroot.
Here's what I've got in my fstab:

/usr/pkgsrc.current /space/netbsd/image-current/usr/pkgsrc null rw 0 0
/usr/pkgsrc.base /space/netbsd/image-current/usr/pkgsrc union -b,rw 0 0
/space/netbsd/image-netbsd-2-0/usr/pkgsrc.2.0 /space/netbsd/image-netbsd-2-0/usr
/pkgsrc null rw 0 0
/usr/pkgsrc.base /space/netbsd/image-netbsd-2-0/usr/pkgsrc union -b,rw 0 0

/usr/pkgsrc.base is the actual checked-out pkgsrc tree.
/usr/pkgsrc.current and /space/netbsd/image-netbsd-2-0/usr/pkgsrc.2.0
are storage location for files created while building for -current and 
/space/netbsd/image-netbsd-2-0 and .../image-current are _destdir_
locations, not obj trees. (i.e. untar the sets there)

I also null mount another directory into each one of the chroots and set
/usr/pkgsrc/distfiles to be a symlink pointing to that directory.  That
way I don't end up with multiple downloads of the same sources.
(that's the path as seen from _within_ the chroot)

To build packages for -netbsd-2 I do this:
	Update /usr/pkgsrc.base
	rm -r /space/.../usr/pkgsrc.2.0/*
	chroot /space/netbsd/image-netbsd-2-0
	cd /usr/pkgsrc
	Build the packages