| 1 | [wiki:howto <- Back to the HOWTO section] |
| 2 | |
| 3 | = How to Patch a Port on Your System = |
| 4 | |
| 5 | * Audience: People who want to change the code of an existing port |
| 6 | * Requires: MacPorts >= 2.1.2? |
| 7 | |
| 8 | == Introduction == |
| 9 | |
| 10 | 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. |
| 11 | |
| 12 | == Installation == |
| 13 | |
| 14 | === Step 1: '''Get your port's sourcecode''' === |
| 15 | |
| 16 | {{{ |
| 17 | port patch arb |
| 18 | find /opt/local/var/macports -name 'arb*' |
| 19 | }}} |
| 20 | |
| 21 | I found: |
| 22 | {{{ |
| 23 | /opt/local/var/macports/distfiles/arb |
| 24 | /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_science_arb/arb/work/arbsrc_8210/ |
| 25 | }}} |
| 26 | |
| 27 | === Step 2: '''Modify the source with your patch''' === |
| 28 | |
| 29 | {{{ |
| 30 | cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_science_arb/arb/work/ |
| 31 | cp Makefile Makefile.orig |
| 32 | vi Makefile |
| 33 | * make changes, compile, test * |
| 34 | }}} |
| 35 | |
| 36 | === Step 3: '''Make a patch''' === |
| 37 | |
| 38 | {{{ |
| 39 | diff -u Makefile.orig Makefile > /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/science/arb/files/patch-ARB-makefile2.diff |
| 40 | port edit arb (add the patch-ARB-makefile2.diff file to the list of patches) |
| 41 | }}} |
| 42 | |
| 43 | === Step 4: '''Make it real''' === |
| 44 | |
| 45 | {{{ |
| 46 | port install arb |
| 47 | }}} |
| 48 | |
| 49 | [wiki:howto <- Back to the HOWTO section] |