From 5ea61132067ed682ea5ca1a156cab0a4895296d5 Mon Sep 17 00:00:00 2001 From: a Date: Mon, 31 Oct 2016 22:08:46 +0100 Subject: [PATCH] Phase out sed and rely entirely on perl --- Makefile.skel | 36 ++++++++++++++++-------------------- README.md | 1 - configure.ac | 2 +- doc/pinkybar.1 | 2 -- doc/pinkybar.texi | 2 -- 5 files changed, 17 insertions(+), 26 deletions(-) diff --git a/Makefile.skel b/Makefile.skel index e4088ac..c608a32 100644 --- a/Makefile.skel +++ b/Makefile.skel @@ -21,23 +21,32 @@ # When dealing with different operating # systems the things get pretty ugly quickly. # I did learned my lesson with the previous bash -# bootstrap script. -# -# perl and sed are distributed -# out of the box in linux and *BSD. +# bootstrap script, including the difference +# between BSD and GNU sed versions. define stay_portable $(shell perl -Mstrict -Mwarnings -e $(1)) endef +define reflace + $(shell perl -Mstrict -Mwarnings -pi -e 'if ($$. == 10) { $$_=""; print "$(1)","\n"; }' $(2)) +endef + +define reflace2 + $(shell perl -Mstrict -Mwarnings -pi -e 's/$(1)/$(2)/g;' $(3)) +endef + +define reflace3 + $(shell perl -Mstrict -Mwarnings -pi -e 's/$(1)/$(2)/g;s/$(3)/$(4)/g;' $(5)) +endef + BSDCF := -D_DEFAULT_SOURCE -L/usr/local/lib POSIXCF := -D_POSIX_C_SOURCE=200112L BSDLIBS := AMCF := SRCTOAPPEND := -SEDEXE := gsed OSENTERED := $(strip $(call stay_portable,'print uc "${ARG1}";')) DEFTITS := m4_define\(\[OSENTERED\], \[$(OSENTERED)\]\) @@ -60,28 +69,15 @@ else AMCF += $(POSIXCF) DEFTITS += m4_define\(\[LINUKS\], \[cryMeAriver\]\) SRCTOAPPEND += linux_functions.c - SEDEXE := sed endif endif -define reflace - @$(SEDEXE) -i -e $(1) $(2) -endef - -define reflace2 - @$(SEDEXE) -i -e 's|$(1)|$(2)|g' $(3) -endef - -define reflace3 - @$(SEDEXE) -i -e 's|$(1)|$(2)|g' -e 's|$(3)|$(4)|g' $(5) -endef - - all: - $(call reflace,'10s|.*|$(DEFTITS)|g',configure.ac) + $(call reflace,$(DEFTITS),configure.ac) $(call reflace3,{amCF},$(AMCF),{srcFiles},$(SRCTOAPPEND),src/Makefile.am) $(call reflace2,{bzdlibs},$(BSDLIBS),src/Makefile.am) + # ... .PHONY: all diff --git a/README.md b/README.md index c9d4e2b..a19df8f 100644 --- a/README.md +++ b/README.md @@ -403,7 +403,6 @@ Execute the program without supplying any command line options and it will parse * libtool * m4 * gawk -* gsed * perl * gmake diff --git a/configure.ac b/configure.ac index ca1e4a4..6fcf0c5 100644 --- a/configure.ac +++ b/configure.ac @@ -7,7 +7,7 @@ AC_CONFIG_HEADERS([src/config.h]) AM_INIT_AUTOMAKE([1.13 -Wall no-define foreign subdir-objects dist-xz no-dist-gzip std-options]) AM_SILENT_RULES([yes]) -{sed will replace this line} +{perl will replace this line} # With the addition of more runtime compile and # link tests, this option is no longer necessary. diff --git a/doc/pinkybar.1 b/doc/pinkybar.1 index 915d721..a92cc21 100644 --- a/doc/pinkybar.1 +++ b/doc/pinkybar.1 @@ -1058,8 +1058,6 @@ m4 .IP \[bu] 2 gawk .IP \[bu] 2 -gsed -.IP \[bu] 2 perl .IP \[bu] 2 gmake diff --git a/doc/pinkybar.texi b/doc/pinkybar.texi index 1c5bfd5..7fe26e4 100644 --- a/doc/pinkybar.texi +++ b/doc/pinkybar.texi @@ -855,8 +855,6 @@ m4 @item gawk @item -gsed -@item perl @item gmake -- 2.11.0