modifying patch files

Jack Howarth howarth at bromo.med.uc.edu
Sat Sep 12 08:39:09 PDT 2009


On Sat, Sep 12, 2009 at 07:38:12AM -0700, David Evans wrote:
> 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.
> 

Thanks. So far my first port from fink hasn't turned out that well. The molmol
build that works fine under openmotif4 (2.3.2) on fink doesn't properly display
its windows under the openmotif and glw packages in MacPorts. I am afraid I
am bumping into a bug in one of those packages. After I clean the port up a bit,
I'll submit so that the openmotif and glw maintainers can take a look at this
issue.
               Jack


More information about the macports-dev mailing list