Date: Mon, 17 Jun 2002 00:33:14 -0400 (EDT) From: Trevor Johnson <trevor@jpj.net> To: Doug Barton <DougB@FreeBSD.org> Cc: Ade Lovett <ade@FreeBSD.org>, Akinori MUSHA <knu@iDaemons.org>, Mikhail Teterin <mi+mx@aldan.algebra.com>, Pete Fritchman <petef@absolutbsd.org>, <portmgr@FreeBSD.org>, Maxim Sobolev <sobomax@FreeBSD.org>, <ports@FreeBSD.org>, <jmallett@FreeBSD.org> Subject: Re: REINPLACE Message-ID: <20020616234124.M2123-100000@blues.jpj.net> In-Reply-To: <3D0C2482.1D32A134@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Doug Barton wrote: > [...] You've determined that the problem is, "How do > we make a drop in replacement for perl -i?" Unfortunately, we've already > shown that this isn't possible. So, I'm trying to simplify the problem > by defining it as, "How do we accomplish the same result as perl -i as > simply as possible for the majority of ports, and then handle the > special cases seperately?" I think my problem is a lot easier to solve, > and my solution is more likely to succeed. Well, Perl tends to give similar results to Perl. :-) Perl is still available in -CURRENT, via ports/lang/perl5. Having to install it to work with certain ports is IMO no great tragedy, especially when it's under package management. Also a shorter, more easily remembered name for this macro would be a virtue, and "REPLACE" is unused. Here's my latest entry in the derby. When batching, it brings in Perl as a build dependency for every single port. For interactive builds, if Perl is needed and not found, the build fails with an error message asking the user to install it. This gives Perl-hating users a chance to fix the port to use sed instead. Index: /usr/ports/Mk/bsd.port.mk =================================================================== RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v retrieving revision 1.414 diff -u -r1.414 bsd.port.mk --- /usr/ports/Mk/bsd.port.mk 13 Jun 2002 18:20:40 -0000 1.414 +++ /usr/ports/Mk/bsd.port.mk 17 Jun 2002 04:15:54 -0000 @@ -623,13 +623,6 @@ .endif .endif -# Special macro for doing in-place file editing using regexps -.if ${OSVERSION} <= 500033 -REINPLACE_CMD?= ${PERL} -p -i.bak -.else -REINPLACE_CMD?= ${SED} -i.bak -.endif - # Get the object format. .if !defined(PORTOBJFORMAT) PORTOBJFORMAT!= test -x /usr/bin/objformat && /usr/bin/objformat || echo aout @@ -810,6 +803,18 @@ XFREE86_VERSION?= 3 .endif +.endif + +# macro for in-place editing using regular expressions +.if exists(/usr/bin/perl5) || exists(${LOCALBASE}/bin/perl5) +REPLACE?= ${PERL} -pi -e +.else +.if defined(BATCH) || defined(PACKAGE_BUILDING) +BUILD_DEPENDS+= perl${PERL_VERSION}:${PORTSDIR}/lang/perl5 +REPLACE?= ${PERL} -pi -e +.endif +REPLACE?= @${ECHO_MSG} "You must install Perl to build this port."; \ + ${FALSE} .endif # End of pre-makefile section. Go patch, go! -- Trevor Johnson To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020616234124.M2123-100000>