From 3cd09c318abce9c9e6979f1a7ff2e3c0117af258 Mon Sep 17 00:00:00 2001
From: Evgeny Grin <k2k@narod.ru>
Date: Fri, 19 May 2023 18:06:02 +0300
Subject: [PATCH 2/3] Use configure detected or user specified sed in build
system
Sometimes system default sed is not the best option.
With this modification user may easily override sed used by build system
without editing any file.
Signed-off-by: Karlson2k (Evgeny Grin) <k2k@narod.ru>
---
autogen.sh | 2 +-
configure.ac | 2 +-
contrib/Makefile.am | 8 ++++----
doc/man/date-of-man-include.am | 6 +++---
m4.include/mc-glib.m4 | 2 +-
m4.include/mc-version.m4 | 2 +-
maint/utils/find-dup-includes/runme.sh | 2 +-
maint/utils/update-years.sh | 4 ++--
po/Rules-pot-defaults | 2 +-
version.sh | 2 +-
10 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/autogen.sh b/autogen.sh
index ca46179af..ee76efc22 100755
a
|
b
|
rm -f INSTALL && ln -s doc/INSTALL |
13 | 13 | |
14 | 14 | # Generate po/POTFILES.in |
15 | 15 | ${XGETTEXT:-xgettext} --keyword=_ --keyword=N_ --keyword=Q_ --output=- \ |
16 | | `find . -name '*.[ch]'` | sed -ne '/^#:/{s/#://;s/:[0-9]*/\ |
| 16 | `find . -name '*.[ch]'` | ${SED-sed} -ne '/^#:/{s/#://;s/:[0-9]*/\ |
17 | 17 | /g;s/ //g;p;}' | \ |
18 | 18 | grep -v '^$' | sort | uniq >po/POTFILES.in |
19 | 19 | |
diff --git a/configure.ac b/configure.ac
index 07c987e00..90934491c 100644
a
|
b
|
po/Makefile.in |
708 | 708 | |
709 | 709 | dnl https://stackoverflow.com/questions/30897170/ac-subst-does-not-expand-variable/30932102#30932102 |
710 | 710 | AC_CONFIG_FILES( |
711 | | [misc/syntax/Syntax], [sed -i -e "s%\${prefix}%$PREFIX%" misc/syntax/Syntax], [export PREFIX=$prefix] |
| 711 | [misc/syntax/Syntax], [${SED-sed} -i -e "s%\${prefix}%$PREFIX%" misc/syntax/Syntax], [export PREFIX=$prefix] |
712 | 712 | ) |
713 | 713 | |
714 | 714 | AC_CONFIG_FILES([ |
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 4a97905d9..7065279b1 100644
a
|
b
|
EXTRA_DIST = \ |
19 | 19 | $(noinst_DATA) |
20 | 20 | |
21 | 21 | mc.csh: $(top_builddir)/config.status $(srcdir)/mc.csh.in |
22 | | sed "s%@""pkglibexecdir@%$(pkglibexecdir)%" $(srcdir)/mc.csh.in > mc.csh |
| 22 | $(SED) "s%@""pkglibexecdir@%$(pkglibexecdir)%" $(srcdir)/mc.csh.in > mc.csh |
23 | 23 | |
24 | 24 | mc.sh: $(top_builddir)/config.status $(srcdir)/mc.sh.in |
25 | | sed "s%@""pkglibexecdir@%$(pkglibexecdir)%" $(srcdir)/mc.sh.in > mc.sh |
| 25 | $(SED) "s%@""pkglibexecdir@%$(pkglibexecdir)%" $(srcdir)/mc.sh.in > mc.sh |
26 | 26 | |
27 | 27 | mc-wrapper.csh: $(top_builddir)/config.status $(srcdir)/mc-wrapper.csh.in |
28 | | sed "s%@""bindir@%$(bindir)%" $(srcdir)/mc-wrapper.csh.in > mc-wrapper.csh |
| 28 | $(SED) "s%@""bindir@%$(bindir)%" $(srcdir)/mc-wrapper.csh.in > mc-wrapper.csh |
29 | 29 | |
30 | 30 | mc-wrapper.sh: $(top_builddir)/config.status $(srcdir)/mc-wrapper.sh.in |
31 | | sed "s%@""bindir@%$(bindir)%" $(srcdir)/mc-wrapper.sh.in > mc-wrapper.sh |
| 31 | $(SED) "s%@""bindir@%$(bindir)%" $(srcdir)/mc-wrapper.sh.in > mc-wrapper.sh |
32 | 32 | |
diff --git a/doc/man/date-of-man-include.am b/doc/man/date-of-man-include.am
index c6b1e692c..2770b5368 100644
a
|
b
|
MAN_DATE_CMD = \ |
13 | 13 | |
14 | 14 | mc.1: $(srcdir)/mc.1.in |
15 | 15 | MAN_FILE=$<; MAN_DATE=$$($(MAN_DATE_CMD)); \ |
16 | | sed $(SED_PARAMETERS) $< > $@ |
| 16 | $(SED) $(SED_PARAMETERS) $< > $@ |
17 | 17 | |
18 | 18 | mcedit.1: $(srcdir)/mcedit.1.in |
19 | 19 | MAN_FILE=$<; MAN_DATE=$$($(MAN_DATE_CMD)); \ |
20 | | sed $(SED_PARAMETERS) $< > $@ |
| 20 | $(SED) $(SED_PARAMETERS) $< > $@ |
21 | 21 | |
22 | 22 | mcview.1: $(srcdir)/mcview.1.in |
23 | 23 | MAN_FILE=$<; MAN_DATE=$$($(MAN_DATE_CMD)); \ |
24 | | sed $(SED_PARAMETERS) $< > $@ |
| 24 | $(SED) $(SED_PARAMETERS) $< > $@ |
diff --git a/m4.include/mc-glib.m4 b/m4.include/mc-glib.m4
index ba4901f79..400820729 100644
a
|
b
|
AC_DEFUN([mc_G_MODULE_SUPPORTED], [ |
49 | 49 | esac |
50 | 50 | |
51 | 51 | if test -n "$lib"; then |
52 | | lib1=`echo $i | sed 's/^-l//'` |
| 52 | lib1=`echo $i | ${SED-sed} 's/^-l//'` |
53 | 53 | if test -f "$GLIB_LIBDIR/lib${lib1}.a"; then |
54 | 54 | add="$GLIB_LIBDIR/lib${lib1}.a" |
55 | 55 | else |
diff --git a/m4.include/mc-version.m4 b/m4.include/mc-version.m4
index 51b6b77c4..ba89b5f99 100644
a
|
b
|
dnl @modified Andrew Borodin <aborodin@vmail.ru> |
10 | 10 | |
11 | 11 | AC_DEFUN([mc_VERSION],[ |
12 | 12 | if test -f ${srcdir}/mc-version.h; then |
13 | | VERSION=$(grep '^#define MC_CURRENT_VERSION' ${srcdir}/mc-version.h | sed 's/.*"\(.*\)"$/\1/') |
| 13 | VERSION=$(grep '^#define MC_CURRENT_VERSION' ${srcdir}/mc-version.h | ${SED-sed} 's/.*"\(.*\)"$/\1/') |
14 | 14 | else |
15 | 15 | VERSION="unknown" |
16 | 16 | fi |
diff --git a/maint/utils/find-dup-includes/runme.sh b/maint/utils/find-dup-includes/runme.sh
index 9e7c5802d..040e8586d 100755
a
|
b
|
findIncludeDupsInDir() { |
37 | 37 | dir_name=$1; shift |
38 | 38 | |
39 | 39 | for i in $(find "${dir_name}" -name '*.[ch]'); do |
40 | | file_name=$(echo $i | sed 's@'"${MC_SOURCE_ROOT_DIR}/"'@@g') |
| 40 | file_name=$(echo $i | ${SED-sed} 's@'"${MC_SOURCE_ROOT_DIR}/"'@@g') |
41 | 41 | [ $(grep "^\s*${file_name}$" -c "${MC_SOURCE_ROOT_DIR}/maint/utils/find-dup-includes/exclude-list.cfg") -ne 0 ] && continue |
42 | 42 | "${MC_SOURCE_ROOT_DIR}/maint/utils/find-dup-includes/find-in-one-file.pl" "${i}" |
43 | 43 | done |
diff --git a/maint/utils/update-years.sh b/maint/utils/update-years.sh
index 1188fb1c8..7370d2559 100755
a
|
b
|
LINE="Copyright (C)" |
9 | 9 | for i in "$SOURCES"; do |
10 | 10 | # replace year: XXXX-YYYY -> XXXX-ZZZZ |
11 | 11 | # add year: XXXX -> XXXX-ZZZZ |
12 | | sed -i -e " |
| 12 | ${SED-sed} -i -e " |
13 | 13 | 1,20 { |
14 | 14 | /$LINE/s/-[0-9]\{4\}$/-$YEAR/ |
15 | 15 | }; |
… |
… |
for i in "$SOURCES"; do |
19 | 19 | done |
20 | 20 | |
21 | 21 | # special case |
22 | | sed -i -e "/$LINE/s/-[0-9]\{4\} the/-$YEAR the/" src/editor/editwidget.c |
| 22 | ${SED-sed} -i -e "/$LINE/s/-[0-9]\{4\} the/-$YEAR the/" src/editor/editwidget.c |
diff --git a/po/Rules-pot-defaults b/po/Rules-pot-defaults
index 2cf834ede..1c51b56e2 100644
a
|
b
|
|
1 | 1 | |
2 | 2 | update-po: Makefile |
3 | 3 | $(MAKE) $(DOMAIN).pot-update && \ |
4 | | sed \ |
| 4 | $(SED) \ |
5 | 5 | -e '/#, fuzzy/d' \ |
6 | 6 | -e 's/Project-Id-Version: PACKAGE VERSION/Project-Id-Version: $(PACKAGE) $(VERSION)/' \ |
7 | 7 | -e 's/^"Plural-Forms: nplurals=INTEGER;/# "Plural-Forms: nplurals=INTEGER;/' \ |
diff --git a/version.sh b/version.sh
index 0565b7448..970ecb5a6 100755
a
|
b
|
SHOR_MC_VERSION="${PREV_MC_VERSION}" |
63 | 63 | |
64 | 64 | if [ -r "${VERSION_FILE}" ] |
65 | 65 | then |
66 | | PREV_MC_VERSION=`sed -n 's/^#define MC_CURRENT_VERSION "\(.*\)"$/\1/p' "${VERSION_FILE}"` |
| 66 | PREV_MC_VERSION=`${SED-sed} -n 's/^#define MC_CURRENT_VERSION "\(.*\)"$/\1/p' "${VERSION_FILE}"` |
67 | 67 | CURR_MC_VERSION="${PREV_MC_VERSION}" |
68 | 68 | SHOR_MC_VERSION="${PREV_MC_VERSION}" |
69 | 69 | fi |