I needed to test a single FreeBSD port today for a specific release. The FreeBSD project maintains a series of reference build machines for this type of work, but normally I maintain an entire ports tree checkout for this type of work.
The FreeBSD ports tree has 20k+ individual software packages maintained in it, and I was not in the mood to checkout all of that onto a host for the purpose of validating a build of QEMU on FreeBSD 10.
Turns out, if you pay attention, you can indeed do some individual checkouts of things in a sparse fashion and get results that are useful. Your mileage may vary here depending on the needed dependencies, but this should be a useful hint to getting started.
I will only address how to do this with Subversion, but I’m sure that the folks who use git will have no trouble seeing how to duplicate this scenario.
- svn co –depth files svn+ssh://repo.freebsd.org/ports/head fbsd_ports
- cd fbsd_ports
- svn co svn+ssh://repo.freebsd.org/ports/head/Mk
- svn co svn+ssh://repo.freebsd.org/ports/head/Templates
- svn co –depth files svn+ssh://repo.freebsd.org/ports/head/lang
- cd lang
- svn co svn+ssh://repo.freebsd.org/ports/head/lang/perl5.20
- svn co svn+ssh://repo.freebsd.org/ports/head/lang/python27
- cd ..
- svn co –depth files svn+ssh://repo.freebsd.org/ports/head/emulators
- cd emulators
- svn co svn+ssh://repo.freebsd.org/ports/head/emulators/qemu-user-static
- svn co svn+ssh://repo.freebsd.org/ports/head/emulators/qemu-sbruno
My goal, was to build qemu-user-static for FreeBSD 10. There’s a bunch of dependencies here, so I’ll try and unwind them a bit.
In order to build any port, you need the files contained in the top of tree. The support Makefiles in Mk/ and Templates/ are required to do a lot of things and may or may not be used as short cuts/helpers in the Makefiles of individual ports.
The Makefile of any directory that you traverse to get to your port will need to exist (emulators/Makefile for example)
The lang/perl and lang/python ports are needed here as there is some pollution in the Makefiles that requires something to be parsed during builds. This probably shouldn’t be there, but is beyond the scope of what I wanted to get done this morning.
Checking out the individual ports into their proper locations and setting PORTSDIR in your environment to your new directory structure (/home/sbruno/fbsd_ports) will now allow you to use your new checkout in some fashion to build.