tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

New option: TOOLS_PATH.gexpr



I've packaged wklejto ( https://github.com/napcok/wklejto )
and I realised that I need new option: TOOLS_PATH.gexpr for
GNU expr provided by coreutils.

expr from NetBSD and GNU expr work differently:
$ gexpr http://wklejto.org/w/b8125f30 : '^http://wklejto.org/w/[0-9a-f]\+'
29
$ expr http://wklejto.org/w/b8125f30 : '^http://wklejto.org/w/[0-9a-f]\+'
0

The patch was tested on Linux (CentOS 7) and NetBSD-current,
both with pkgsrc-current.

Test case is wip/wklejto.

Please review and merge the attached patch.
Index: tools/defaults.mk
===================================================================
RCS file: /public/netbsd-rsync/pkgsrc/mk/tools/defaults.mk,v
retrieving revision 1.61
diff -u -r1.61 defaults.mk
--- tools/defaults.mk	6 Mar 2014 07:34:20 -0000	1.61
+++ tools/defaults.mk	25 Apr 2015 12:23:15 -0000
@@ -82,6 +82,7 @@
 _TOOLS_VARNAME.find=		FIND
 _TOOLS_VARNAME.gawk=		AWK
 _TOOLS_VARNAME.gem=		GEM
+_TOOLS_VARNAME.gexpr=		EXPR
 _TOOLS_VARNAME.gm4=		M4
 _TOOLS_VARNAME.gmake=		GMAKE
 _TOOLS_VARNAME.grep=		GREP
@@ -170,6 +171,7 @@
 _TOOLS_VARNAME_GNU.false=	FALSE ac_cv_path_FALSE
 _TOOLS_VARNAME_GNU.find=	FIND
 _TOOLS_VARNAME_GNU.gawk=	AWK
+_TOOLS_VARNAME_GNU.gexpr=	EXPR
 _TOOLS_VARNAME_GNU.gm4=		M4
 _TOOLS_VARNAME_GNU.grep=	GREP ac_cv_path_GREP
 _TOOLS_VARNAME_GNU.gsed=	SED
Index: tools/replace.mk
===================================================================
RCS file: /public/netbsd-rsync/pkgsrc/mk/tools/replace.mk,v
retrieving revision 1.274
diff -u -r1.274 replace.mk
--- tools/replace.mk	1 Feb 2015 08:48:56 -0000	1.274
+++ tools/replace.mk	25 Apr 2015 12:34:27 -0000
@@ -105,6 +105,9 @@
 .  if !empty(_USE_TOOLS:Mgawk)		# gawk > awk
 _USE_TOOLS:=	${_USE_TOOLS:Nawk}
 .  endif
+.  if !empty(_USE_TOOLS:Mgexpr)		# gexpr > expr
+_USE_TOOLS:=	${_USE_TOOLS:Nexpr}
+.  endif
 .  if !empty(_USE_TOOLS:Mgm4)		# gm4 > m4
 _USE_TOOLS:=	${_USE_TOOLS:Nm4}
 .  endif
@@ -160,6 +163,12 @@
 _TOOLS_DEPMETHOD.gawk=		${_TOOLS_DEPMETHOD.awk}
 .  endif
 .endif
+.if !empty(_USE_TOOLS:Mgexpr)		# gexpr > expr
+.  if (${_TOOLS_DEPMETHOD.gexpr} == "TOOL_DEPENDS") && \
+      defined(_TOOLS_DEPMETHOD.expr)
+_TOOLS_DEPMETHOD.gexpr=		${_TOOLS_DEPMETHOD.expr}
+.  endif
+.endif
 .if !empty(_USE_TOOLS:Mgm4)		# gm4 > m4
 .  if (${_TOOLS_DEPMETHOD.gm4} == "TOOL_DEPENDS") && \
       defined(_TOOLS_DEPMETHOD.m4)
@@ -438,6 +447,18 @@
 .  endif
 .endif
 
+.if !defined(TOOLS_IGNORE.gexpr) && !empty(_USE_TOOLS:Mgexpr)
+.  if !empty(PKGPATH:Msysutils/coreutils)
+MAKEFLAGS+=			TOOLS_IGNORE.gexpr=
+.  elif !empty(_TOOLS_USE_PKGSRC.gexpr:M[yY][eE][sS])
+TOOLS_DEPENDS.gexpr?=		coreutils:../../sysutils/coreutils
+TOOLS_CREATE+=			gexpr
+TOOLS_FIND_PREFIX+=		TOOLS_PREFIX.gexpr=gexpr
+TOOLS_PATH.gexpr=		${TOOLS_PREFIX.gexpr}/bin/gexpr
+.  endif
+TOOLS_ALIASES.gexpr=		expr
+.endif
+
 .if !defined(TOOLS_IGNORE.gm4) && !empty(_USE_TOOLS:Mgm4)
 .  if !empty(PKGPATH:Mdevel/m4)
 MAKEFLAGS+=			TOOLS_IGNORE.gm4=
Index: tools/tools.Cygwin.mk
===================================================================
RCS file: /public/netbsd-rsync/pkgsrc/mk/tools/tools.Cygwin.mk,v
retrieving revision 1.13
diff -u -r1.13 tools.Cygwin.mk
--- tools/tools.Cygwin.mk	16 Feb 2015 11:01:40 -0000	1.13
+++ tools/tools.Cygwin.mk	25 Apr 2015 12:23:15 -0000
@@ -41,7 +41,7 @@
 TOOLS_PLATFORM.echo?=		echo			# shell builtin
 TOOLS_PLATFORM.egrep?=		/bin/egrep
 TOOLS_PLATFORM.env?=		/bin/env
-TOOLS_PLATFORM.expr?=		/bin/expr
+TOOLS_PLATFORM.expr?=		%{TOOLS_PLATFORM.gexpr}
 TOOLS_PLATFORM.false?=		false			# shell builtin
 TOOLS_PLATFORM.fgrep?=		/bin/fgrep
 TOOLS_PLATFORM.file?=		/bin/file
@@ -56,6 +56,7 @@
 .if exists(/bin/gettext)
 TOOLS_PLATFORM.gettext?=	/bin/gettext
 .endif
+TOOLS_PLATFORM.gexpr?=		/bin/expr
 .if exists(/bin/m4)
 TOOLS_PLATFORM.gm4?=		/bin/m4
 .endif
Index: tools/tools.Linux.mk
===================================================================
RCS file: /public/netbsd-rsync/pkgsrc/mk/tools/tools.Linux.mk,v
retrieving revision 1.59
diff -u -r1.59 tools.Linux.mk
--- tools/tools.Linux.mk	16 Feb 2015 11:01:40 -0000	1.59
+++ tools/tools.Linux.mk	25 Apr 2015 12:23:15 -0000
@@ -77,11 +77,7 @@
 TOOLS_PLATFORM.egrep?=		/usr/bin/egrep
 .endif
 TOOLS_PLATFORM.env?=		/usr/bin/env
-.if exists(/usr/bin/expr)
-TOOLS_PLATFORM.expr?=		/usr/bin/expr
-.elif exists(/bin/expr)
-TOOLS_PLATFORM.expr?=		/bin/expr
-.endif
+TOOLS_PLATFORM.expr?=		${TOOLS_PLATFORM.gexpr}
 TOOLS_PLATFORM.false?=		false			# shell builtin
 .if exists(/bin/fgrep)
 TOOLS_PLATFORM.fgrep?=		/bin/fgrep
@@ -98,6 +94,11 @@
 .if exists(/usr/bin/gettext)
 TOOLS_PLATFORM.gettext?=	/usr/bin/gettext
 .endif
+.if exists(/bin/expr)
+TOOLS_PLATFORM.gexpr?=		/bin/expr
+.elif exists(/usr/bin/gexpr)
+TOOLS_PLATFORM.gexpr?=		/usr/bin/expr
+.endif
 .if exists(/usr/bin/m4)
 TOOLS_PLATFORM.gm4?=		/usr/bin/m4
 .endif


Home | Main Index | Thread Index | Old Index