Thursday, May 22, 2014

Hacking on a FreeBSD port

I have been trying to check out the CURRENT branch of FreeBSD so that I can start playing with the kernel - ran into a tiny problem: for some reason FreeBSD folks use subversion (yuck) to manage the code. The port of subversion in the ports tree, however, segfaults on my machine. It does generate a core so I recompiled the port with debug symbols and then ran gdb on the program and the core file and got a file/line within the file where it is segfaulting. All I want to do is insert a printf() statement there.

Below is the sequence of commands to do it - I am sure there are better ways but hey...

(as root):

cd /usr/ports/

make clean distclean fetch

make extract

cp work/(path/filename) work/(path/filename).orig

vim work(/path/filename)
make the change

make makepatch (this will add your change to /usr/ports//files/ for "next time")
rm -rf work

make fetch
make extract
make build

The produced executable under /usr/ports//work/ should now have your change in it.

No comments: