Solved Applying an unofficial patch on a port


Noob question maybe but I am kind of desperate here. I can't figure out how to apply a custom patch on a port. I only have basic knowledge about ports.

My company is asking me to make security/teleport version 8.x.x or more work on FreeBSD. The current version present in ports/pkg (4.3.9) won't work with our Debian machines running 9.x.x. I found this unified patch hanging around which was reported to work but I really don't know how to apply it. Everything I found so far about applying patches to ports did not really work. I'd appreciate it if somebody could help me with this so I don't get fired.

The patch:
Go to the diff you posted the link to, then click on Raw Unified to get the raw patch contents.
Go to your ports collection, create a text file with the content of that raw patch shown.
Then git apply that patch and build the port as usual (assuming that you're using git for your ports tree - otherwise just patch(1).

You might also want to comment on that bug report afterwards as to whether this patch is still working.
You might also be able to rename the patch to patch-somename and place it in the security/teleport files section. That's the standard method for applying patches. (Create the patch as jbodenmann explained). (untested by me with this port and patch).
[...] and place it in the security/teleport files section.
I checked before posting - the patch seems to be relative to the ports collection root:
--- a/security/teleport/Makefile  
+++ b/security/teleport/Makefile  


--- a/security/teleport/distinfo  
+++ b/security/teleport/distinfo

Glad to hear that it worked out!

Please don't forget to leave a comment on the bug report regarding your success of using that patch and marking this topic/thread as solved!