Skip to content

Commit

Permalink
install: use sed rather perl for substitutions
Browse files Browse the repository at this point in the history
Use sed instead of perl in configure and Makefile scripts as perl is not
required anymore to build documentation. sed is a lighter requirement to
build and install software.
  • Loading branch information
xdelaruelle committed Oct 7, 2017
1 parent aae8db6 commit 7de4c10
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion INSTALL.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ the tools to be found on your system:

* bash
* make
* perl
* sed
* grep
* cut
* runtest
Expand Down
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ include version.inc
endif

define translate-in-script
perl -pe 's|\@prefix\@|$(prefix)|g; \
s|\@libexecdir\@|$(libexecdir)|g; \
s|\@TCLSHDIR\@/tclsh|$(TCLSH)|g; \
s|\@TCLSH\@|$(TCLSH)|g; \
s|\@MODULES_RELEASE\@|$(MODULES_RELEASE)|g; \
s|\@MODULES_BUILD\@|$(MODULES_BUILD)|g; \
s|\@MODULES_BUILD_DATE\@|$(MODULES_BUILD_DATE)|g;' $< > $@
sed -e 's|@prefix@|$(prefix)|g' \
-e 's|@libexecdir@|$(libexecdir)|g' \
-e 's|@TCLSHDIR@/tclsh|$(TCLSH)|g' \
-e 's|@TCLSH@|$(TCLSH)|g' \
-e 's|@MODULES_RELEASE@|$(MODULES_RELEASE)|g' \
-e 's|@MODULES_BUILD@|$(MODULES_BUILD)|g' \
-e 's|@MODULES_BUILD_DATE@|$(MODULES_BUILD_DATE)|g' $< > $@
endef

ifeq ($(wildcard .git) $(wildcard version.inc.in),.git version.inc.in)
Expand All @@ -92,7 +92,7 @@ ChangeLog:
contrib/gitlog2changelog.py

README MIGRATING:
perl -pe 's|^\[\!\[.*\].*\n||;' $@.md > $@
sed -e '/^\[\!\[.*\].*/d' $@.md > $@

contrib/scripts/add.modules: contrib/scripts/add.modules.in
$(translate-in-script)
Expand Down
6 changes: 3 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ done

# test requirements availability
check_requirement make
check_requirement perl
check_requirement sed
check_requirement grep
check_requirement cut
check_requirement runtest '' "Install \`dejagnu' if you want to run the \
Expand Down Expand Up @@ -359,7 +359,7 @@ fi
translation_regexp=''
for arg in ${arglist}; do
echo "$arg = ${!arg}"
translation_regexp+="s|\@${arg}\@|${!arg}|g; "
translation_regexp+="-e s|@${arg}@|${!arg}|g "
done

# configure compat version sources
Expand All @@ -381,7 +381,7 @@ fi
# generate Makefiles
for target in ${targetlist}; do
echo "creating $target"
perl -pe "$translation_regexp" ${target}.in >$target
sed $translation_regexp ${target}.in >$target
done

exit 0
2 changes: 1 addition & 1 deletion contrib/rpm/environment-modules.spec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Source0: http://downloads.sourceforge.net/modules/modules-%{version}-beta

BuildRequires: tcl
BuildRequires: dejagnu
BuildRequires: perl
BuildRequires: sed
%if 0%{?rhel} && 0%{?rhel} <= 6
BuildRequires: net-tools
%else
Expand Down
14 changes: 7 additions & 7 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ all: html
endif

define translate-in-script
perl -pe 's|\@prefix\@|$(prefix)|g; \
s|\@libexecdir\@|$(libexecdir)|g; \
s|\@initdir\@|$(initdir)|g; \
s|\@modulefilesdir\@|$(modulefilesdir)|g; \
s|\@MODULES_RELEASE\@|$(MODULES_RELEASE)|g; \
s|\@MODULES_BUILD\@|$(MODULES_BUILD)|g; \
s|\@MODULES_BUILD_DATE\@|$(MODULES_BUILD_DATE)|g;' $< > $@
sed -e 's|@prefix@|$(prefix)|g' \
-e 's|@libexecdir@|$(libexecdir)|g' \
-e 's|@initdir@|$(initdir)|g' \
-e 's|@modulefilesdir@|$(modulefilesdir)|g' \
-e 's|@MODULES_RELEASE@|$(MODULES_RELEASE)|g' \
-e 's|@MODULES_BUILD@|$(MODULES_BUILD)|g' \
-e 's|@MODULES_BUILD_DATE@|$(MODULES_BUILD_DATE)|g' $< > $@
endef

# avoid shared definitions to be rebuilt by make
Expand Down
46 changes: 23 additions & 23 deletions init/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,39 +47,39 @@ all: $(ALL_SHELLS) $(ALL_CONFIG) $(EXAMPLE_MODFILES_SRCDIR)/modules
# if enabled translate to keep text after markup elsewhere remove the
# entire line
ifeq ($(setmanpath),y)
setmanpathre := \1\n
setmanpathre := s|@setmanpath@||g
else
setmanpathre :=
setmanpathre := /@setmanpath@/d
endif
ifeq ($(setbinpath),y)
setbinpathre := \1\n
setbinpathre := s|@setbinpath@||g
else
setbinpathre :=
setbinpathre := /@setbinpath@/d
endif
ifeq ($(compatversion),y)
compatversionre := \1\n
notcompatversionre :=
compatversionre := s|@compatversion@||g
notcompatversionre := /@notcompatversion@/d
else
compatversionre :=
notcompatversionre := \1\n
compatversionre := /@compatversion@/d
notcompatversionre := s|@notcompatversion@||g
endif

define translate-in-script
perl -pe 's|\@prefix\@|$(prefix)|g; \
s|\@libexecdir\@|$(libexecdir)|g; \
s|\@initdir\@|$(initdir)|g; \
s|\@modulefilesdir\@|$(modulefilesdir)|g; \
s|\@bindir\@|$(bindir)|g; \
s|\@mandir\@|$(mandir)|g; \
s|\@setmanpath\@(.*)\n|$(setmanpathre)|g; \
s|\@setbinpath\@(.*)\n|$(setbinpathre)|g; \
s|\@compatversion\@(.*)\n|$(compatversionre)|g; \
s|\@notcompatversion\@(.*)\n|$(notcompatversionre)|g; \
s|\@modulerc\@|$(modulerc)|g; \
s|\@modulepath\@|$(modulepath)|g; \
s|\@SHELLNAME\@|$@|g; \
s|\@VERSION\@|$(MODULES_RELEASE)$(MODULES_BUILD)|g; \
s|\@TCLSH\@|$(TCLSH)|g' $< > $@
sed -e 's|@prefix@|$(prefix)|g' \
-e 's|@libexecdir@|$(libexecdir)|g' \
-e 's|@initdir@|$(initdir)|g' \
-e 's|@modulefilesdir@|$(modulefilesdir)|g' \
-e 's|@bindir@|$(bindir)|g' \
-e 's|@mandir@|$(mandir)|g' \
-e '$(setmanpathre)' \
-e '$(setbinpathre)' \
-e '$(compatversionre)' \
-e '$(notcompatversionre)' \
-e 's|@modulerc@|$(modulerc)|g' \
-e 's|@modulepath@|$(modulepath)|g' \
-e 's|@SHELLNAME@|$@|g' \
-e 's|@VERSION@|$(MODULES_RELEASE)$(MODULES_BUILD)|g' \
-e 's|@TCLSH@|$(TCLSH)|g' $< > $@
endef

# avoid shared definitions to be rebuilt by make
Expand Down

0 comments on commit 7de4c10

Please sign in to comment.