Install OpenBSD packages to alternate directories


I run OpenBSD on a few Soekris 4801s. To get an image “prepped” for the Soekris, I use the directions on the Installing OpenBSD on Flash website. Periodically I need to apply patches to the images, which requires me to adjust the “make install” process to install the package to an alternative location. To apply a patch to a package and install it to an alternate location, I first apply the patch to the package that contains the errata:

$ cd /usr/src/usr.sbin/dhcpd

$ patch -p0 < 006_dhcpd.patch

After the patch is applied, I use the build procedure outlined in the patch header to create the binaries and supporting infrastructure:

$ make obj && make

/usr/src/usr.sbin/dhcpd/obj -> /usr/obj/usr.sbin/dhcpd
cc -O2 -pipe -Wall -c /usr/src/usr.sbin/dhcpd/bootp.c
cc -O2 -pipe -Wall -c /usr/src/usr.sbin/dhcpd/confpars.c
cc -O2 -pipe -Wall -c /usr/src/usr.sbin/dhcpd/db.c
cc -O2 -pipe -Wall -c /usr/src/usr.sbin/dhcpd/dhcp.c
cc -O2 -pipe -Wall -c /usr/src/usr.sbin/dhcpd/dhcpd.c
cc -O2 -pipe -Wall -c /usr/src/usr.sbin/dhcpd/bpf.c
cc -O2 -pipe -Wall -c /usr/src/usr.sbin/dhcpd/packet.c
cc -O2 -pipe -Wall -c /usr/src/usr.sbin/dhcpd/errwarn.c
cc -O2 -pipe -Wall -c /usr/src/usr.sbin/dhcpd/dispatch.c
cc -O2 -pipe -Wall -c /usr/src/usr.sbin/dhcpd/print.c
cc -O2 -pipe -Wall -c /usr/src/usr.sbin/dhcpd/memory.c
cc -O2 -pipe -Wall -c /usr/src/usr.sbin/dhcpd/options.c
cc -O2 -pipe -Wall -c /usr/src/usr.sbin/dhcpd/inet.c
cc -O2 -pipe -Wall -c /usr/src/usr.sbin/dhcpd/conflex.c
cc -O2 -pipe -Wall -c /usr/src/usr.sbin/dhcpd/parse.c
cc -O2 -pipe -Wall -c /usr/src/usr.sbin/dhcpd/alloc.c
cc -O2 -pipe -Wall -c /usr/src/usr.sbin/dhcpd/tables.c
cc -O2 -pipe -Wall -c /usr/src/usr.sbin/dhcpd/tree.c
cc -O2 -pipe -Wall -c /usr/src/usr.sbin/dhcpd/hash.c
cc -O2 -pipe -Wall -c /usr/src/usr.sbin/dhcpd/convert.c
cc -O2 -pipe -Wall -c /usr/src/usr.sbin/dhcpd/icmp.c
cc -o dhcpd bootp.o confpars.o db.o dhcp.o dhcpd.o bpf.o packet.o errwarn.o dispatch.o print.o memory.o options.o inet.o conflex.o parse.o alloc.o tables.o tree.o hash.o convert.o icmp.o

Once the package is built, I use the DESTDIR variable to control where the package is installed:

$ DESTDIR=/usr/images/img make install

install -c -s -o root -g bin -m 555 dhcpd /usr/images/img/usr/sbin/dhcpd
install -c -o root -g bin -m 444 dhcpd.cat8 /usr/images/img/usr/share/man/cat8/dhcpd.0
install -c -o root -g bin -m 444 dhcpd.conf.cat5 /usr/images/img/usr/share/man/cat5/dhcpd.conf.0
install -c -o root -g bin -m 444 dhcpd.leases.cat5 /usr/images/img/usr/share/man/cat5/dhcpd.leases.0
install -c -o root -g bin -m 444 dhcp-options.cat5 /usr/images/img/usr/share/man/cat5/dhcp-options.0

I poked around on google to see which variables are available to control the build process, but was unable to find a complete list. There is a ton of cool stuff in /usr/ports/infrastructure/mk/bsd.port.mk, and I plan to cover some on the niftier variables in a future post.

This article was posted by Matty on 2006-09-02 20:39:00 -0400 -0400