[KDE/Mac] How can I change one piece of code in a MacPorts installation?

René J.V. Bertin rjvbertin at gmail.com
Fri Jul 25 11:24:31 UTC 2014


On 25/07/2014 09:24, Ian Wadham wrote:
> 
> What do I need to do to get a new version of fixCrashInKCrash.patch
> incorporated into MacPorts' kdelibs4, and to keep cycling through that process
> until kcrash.cpp and its patch are providing all the info I am looking for?  IOW,
> how do you develop and test a patch for MacPorts?  Assuming you don't get
> it right first time every time… :-)
> 
> Cheers, Ian W.

Hi Ian,

Not to kick in any open doors, but if you want to modify (re-create) an existing patch, you'd need the original sources.

So what I'd do is do a `port -k -v extract kdelibs4` to have everything built and "installed", chdir into /opt/local/var/macports/build/*_kde_kdelibs4/kdelibs4/work/kdelibs-4.12.5 and do something like
`cp -p path-to/{,orig.}patchable-file.ext` for all files you are going to be modifying. You can then do a `port -v -k destroot kdelibs4` to build and "install" the current version. Note the -k that will prevent the build and working directories from being cleaned.

At this point, you have both the original file(s) and the version(s) with the current patches. Modify them as needed, and just do a make inside /opt/local/var/macports/build/*_kde_kdelibs4/kdelibs4/work/build to rebuild, and/or a make install to rebuild and install into destroot. Testing is a bit of an issue as I don't think there is a possibility to reinstall a port without first uninstalling it explicitly, which might mess with your working directory even with -k. However, once your patched code builds, you can chdir to /opt/local/var/macports/build/*_kde_kdelibs4/kdelibs4/work/ and then do the `diff -u kdelibs-4.12.5/path-to/{orig.,}patched-file.ext` on the file(s) you modified, concatenating the output of all those diff commands into `port dir kdelibs4`/files/fixCrashInKCrash.patch . NB: mind the place of the comma in the {,orig.} and {orig.,} constructs! ;)

PS: I often use a personal working directory where I keep backups of the original and modified files (in case the MacPorts working directories get mangled) as well as a symlink to /opt/local/var/macports/build/*_kde_kdelibs4/kdelibs4/work .

HTH,
René



More information about the kde-mac mailing list