modifying patch files
David Evans
devans at macports.org
Sat Sep 12 07:39:49 PDT 2009
Jeremy Lavergne wrote:
>> I have run into an issue that is unclear on MacPorts. In fink
>> we often would put placekeepers in a patch such as @FINKPREFIX@
>> and use the command...
>>
>> sed 's|@FINKPREFIX@|%p|g' <%{PatchFile} | patch -p1
>>
>> to replace the @FINKPREFIX@ with the actual fink installation directory.
>> How do you handle this situation in MacPorts where you want to
>> generalize the MacPorts prefix in a Makefile patch for instance
>> to survive the case of a user installing MacPorts in a non-default
>> location other than /opt/local?
>
>
> patchfiles patch-patched_file.diff
>
> ...
>
> reinplace s|@FINKPREFIX@|${prefix}|g patched_file
>
Actually you want to put the reinplace in a post-patch phase like this
post-patch {
reinplace "s|@FINKPREFIX@|${prefix}|g" ${worksrcpath}/patched_file
}
This way the file in question will be patched to include the place
holder and
then the place holder will be replaced with the appropriate substitution
after
all patches have been completed.
More information about the macports-dev
mailing list