On 2021/02/25 22:02, Marc Espie wrote:
> On Thu, Feb 25, 2021 at 08:25:55PM +0000, Stuart Henderson wrote:
> > This comes up often enough that I think it's worth adding to bsd.port.mk
> > rather than handling with custom commands. ok?
> 
> I love the idea.
> I would prefer an if !empty() rather than defined and have it always defined.
> 
> It will also need a bit of love in sqlports, though there is already some
> list of files for Makefiles (I can do that once it's commited)

Oh that makes sense yes. (Some example use of this crept into my
p5-Pod-Parser port, that still had post-extract so that it worked on
a current tree too).

Index: bsd.port.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
retrieving revision 1.1549
diff -u -p -r1.1549 bsd.port.mk
--- bsd.port.mk 20 Feb 2021 18:05:04 -0000      1.1549
+++ bsd.port.mk 25 Feb 2021 21:10:19 -0000
@@ -169,6 +169,7 @@ PACKAGE_REPOSITORY ?= ${PORTSDIR}/packag
 
 FIX_EXTRACT_PERMISSIONS ?= No
 FIX_CLEANUP_PERMISSIONS ?= No
+FIX_CRLF_FILES ?=
 
 .if !exists(${X11BASE}/man/mandoc.db)
 .  if exists(${X11BASE}/man/whatis.db)
@@ -2688,6 +2689,9 @@ _post-extract-finalize:
 .endfor
 .if ${FIX_EXTRACT_PERMISSIONS:L} == "yes"
        @chmod -R a+rX ${WRKDIR}
+.endif
+.if !empty(FIX_CRLF_FILES)
+       @cd ${WRKSRC} && perl -i -pe 's/\r$$//' ${FIX_CRLF_FILES}
 .endif
 
 # run as _pbuild



> > Index: ports/infrastructure/mk/bsd.port.mk
> > ===================================================================
> > RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
> > retrieving revision 1.1549
> > diff -u -p -r1.1549 bsd.port.mk
> > --- ports/infrastructure/mk/bsd.port.mk     20 Feb 2021 18:05:04 -0000      
> > 1.1549
> > +++ ports/infrastructure/mk/bsd.port.mk     25 Feb 2021 20:23:27 -0000
> > @@ -2688,6 +2688,9 @@ _post-extract-finalize:
> >  .endfor
> >  .if ${FIX_EXTRACT_PERMISSIONS:L} == "yes"
> >     @chmod -R a+rX ${WRKDIR}
> > +.endif
> > +.if defined(FIX_CRLF_FILES)
> > +   @cd ${WRKSRC} && perl -i -pe 's/\r$$//' ${FIX_CRLF_FILES}
> >  .endif
> >  
> >  # run as _pbuild
> > Index: src/share/man//man5/bsd.port.mk.5
> > ===================================================================
> > RCS file: /cvs/src/share/man/man5/bsd.port.mk.5,v
> > retrieving revision 1.537
> > diff -u -p -r1.537 bsd.port.mk.5
> > --- src/share/man//man5/bsd.port.mk.5       4 Feb 2021 22:12:03 -0000       
> > 1.537
> > +++ src/share/man//man5/bsd.port.mk.5       25 Feb 2021 20:23:06 -0000
> > @@ -1842,6 +1842,11 @@ to world-readable at the end of
> >  Used for some distfile contents which have paranoid permissions for no 
> > reason.
> >  Defaults to
> >  .Sq \&No .
> > +.It Ev FIX_CRLF_FILES
> > +Names of files with line endings that need to be corrected after 
> > extraction.
> > +Sometimes a port will include files with MS-DOS line endings,
> > +to avoid problems with patches (especially when sent by email)
> > +these should be corrected.
> >  .It Ev FLAVOR
> >  The port's current options.
> >  Set by the user, and tested by the port to activate wanted functionalities.
> > 
> > 
> Somewhat incomplete... it needs to be referenced in 
> extract like FIX_EXTRACT_PERMISSIONS is.
> 
> And the wording is not clear "at the end of extract" is also 
> what FIX_EXTRACT_PEMISSIONS says.  And it's way cleared than "after 
> extraction"

Reply via email to