Gentoo Prefix NetBSD
Start by installing bash via pkgsrc, because thats what I use for the guide.
The following is added to ~/.bashrc:
The EPREFIX part is your choice. Another popular option is EPREFIX=/usr/gentoo
Now we need the main tools. We are trying to follow the Gentoo Prefix Bootstrap Process for UNIX-like systems but NetBSD requires a lot of changes to get it working. Anyways, you need the following two files:
Save them in your home directory. In fact anything you download, put it there for the purpose of this guide.
There is no Gentoo Prefix Profile for NetBSD on x86_64 so get profile-x86_64-pc-netbsd.tgz and put it in your home directory.
We have to edit bootstrap-prefix.sh to add support for our profile. Open it up and add the following sections:
m4 and bison must be installed *before* bash. We can just go down the list until we get to m4
Bootstrapping m4 will probably fail due to problems with fseeko.c and fflush.c. Download patch-lib-fflush.c and also patch-lib-fseeko.c and put them in your home directory. Because the script will overwrite everything each time its run, we have to patch the source tarball and replace the original.
This time it should work with our fixed tarball
Now we can go ahead and bootstrap bash
Next up... coreutils which also has fflush.c and fseeko.c. It will fail but we run it first to download the source.
When it aborts we go ahead and patch the source tarball exactly like we did for m4. Just patch the coreutils-8.16 not both. With luck it will build cleanly and install itself.
We get a breather now, several packages should bootstrap without issues.
At this point we are going to get the tree and portage. We will use latest_tree to hopefully pick up some bug fixes.
Soon we will have serious errors with libtool unless something is done. Edit your ~/.bashrc and insert this: