# Patching a port



## jubajuba (Apr 27, 2011)

Hi,

I'm pretty new to FreeBSD (currently using 8.1-RELEASE on amd64) and want to apply a patch to a port the "proper" way. How would I go about doing this? The actual port I want to patch is net-p2p/rtorrent because of the rtorrent / ncurses 5.8 problem described here. (At least I hope it's this bug affecting me.)

I've put patch.txt in /usr/ports/net-p2p/rtorrent/files/ as described in the bug report, but it does not seem to be doing much good. I guess I'm doing it wrong.

Patching the source in the distfile would invalidate the checksum, so AFAIK that's not an option. Could anyone tell me how I could apply the patch and build the port?


----------



## SirDice (Apr 27, 2011)

We've got handbooks for everything :e
Porter's Handbook: 4.4 Patching


----------



## wblock@ (Apr 27, 2011)

jubajuba said:
			
		

> Hi,
> 
> I'm pretty new to FreeBSD (currently using 8.1-RELEASE on amd64) and want to apply a patch to a port the "proper" way. How would I go about doing this? The actual port I want to patch is net-p2p/rtorrent because of the rtorrent / ncurses 5.8 problem described here. (At least I hope it's this bug affecting me.)
> 
> I've put patch.txt in /usr/ports/net-p2p/rtorrent/files/ as described in the bug report, but it does not seem to be doing much good. I guess I'm doing it wrong.



The patch file ought to be called patch-src-display-canvas.h, but that's just for neatness and maintainability.  It should still work regardless of the patch file name.

`# cd /usr/ports/net-p2p/rtorrent`
`# make clean && make patch`

You should see it applying the patch.  Then continue on to build and install the port:
`# make && make deinstall && make install`


----------



## jubajuba (Apr 28, 2011)

Thank you both for helpful answers. I now know how to patch ports, hope others will find the post useful.


----------

