wiki:howto/PatchLocal

Version 2 (modified by macports.org@…, 11 years ago) (diff)

Testing the port, after testing the program

<- Back to the HOWTO section

How to Patch a Port on Your System

  • Audience: People who want to change the code of an existing port
  • Requires: MacPorts >= 2.1.2?

Introduction

If you've ever found a port that doesn't work, then found a patch for it with Google, the next step is to apply the patch to the source code, then compile, test, and install the new version of the port so you can use it and get on with your work. This HOWTO will show you how to do that. In this example, I'll be using the 'arb' program as an example.

Installation

Step 1: Get your port's sourcecode

port patch arb
find /opt/local/var/macports -name 'arb*'

I found:

/opt/local/var/macports/distfiles/arb
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_science_arb/arb/work/arbsrc_8210/

Step 2: Modify the source with your patch

cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_science_arb/arb/work/
cp Makefile Makefile.orig
vi Makefile
* make changes, compile it, test it *

Step 3: Make a patch

diff -u Makefile.orig Makefile > /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/science/arb/files/patch-ARB-makefile2.diff
port edit arb     (add the patch-ARB-makefile2.diff file to the list of patches)

Step 4: Test the modified port

port clean arb
port build arb

Step 4: Make it real

port install arb

<- Back to the HOWTO section