summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2004-04-07 17:45:59 +0000
committerwlemb <wlemb>2004-04-07 17:45:59 +0000
commit8ceee8e98c76d3ba7c8fffa753ea6cf9570d4f10 (patch)
treec5d12743d6e6e3c1afdb641115c48db7de946c02
parent5791884bd22828a08737aa34fb3924726b8209ba (diff)
downloadgroff-8ceee8e98c76d3ba7c8fffa753ea6cf9570d4f10.tar.gz
Make scripts like nroff.sh and neqn.sh portable across various
(Unix-like) shell implementations from Cygwin, MSYS, etc., which use non-POSIX path separators. The idea is to extend those scripts to decide at run-time (of the script) which path separator to use. * arch/misc/Makefile.sub: New file. * arch/misc/shdeps.sh: New file, generating OS dependency fixups. This script handles @GROFF_BIN_PATH_SETUP@, replacing it with a proper definition of the variable `GROFF_RUNTIME'. * Makefile.in (SH_DEPS_SED_SCRIPT): New variable. (MDEFINES): Add SH_DEPS_SED_SCRIPT. (PROGDEPDIRS): New variable. `FORCE' it. (PROGDIRS): Add PROGDEPDIRS. * src/preproc/eqn/Makefile.sub (neqn): Call SH_DEPS_SED_SCRIPT. Don't substitute @SEP@ and @BINDIR@. * src/preproc/eqn/neqn.sh: Use @GROFF_BIN_PATH_SETUP@. (PATH): Use GROFF_RUNTIME. * src/roff/nroff/Makefile.sub (nroff): Call SH_DEPS_SED_SCRIPT. Don't substitute @SEP@ and @BINDIR@. * src/roff/nroff/nroff.sh: Use @GROFF_BIN_PATH_SETUP@. (PATH): Use GROFF_RUNTIME.
-rw-r--r--ChangeLog37
-rw-r--r--Makefile.in8
-rw-r--r--src/preproc/eqn/Makefile.sub5
-rw-r--r--src/preproc/eqn/neqn.sh4
-rw-r--r--src/roff/nroff/Makefile.sub5
-rw-r--r--src/roff/nroff/nroff.sh12
6 files changed, 57 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 673a9fb0..439ed896 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,40 @@
+2004-04-07 Werner Lemberg <wl@gnu.org>
+
+ * Makefile.sub (DISTCLEANFILES): Add `test-groff'.
+
+2004-04-06 Keith Marshall <keith.d.marshall@ntlworld.com>
+
+ Make scripts like nroff.sh and neqn.sh portable across various
+ (Unix-like) shell implementations from Cygwin, MSYS, etc., which use
+ non-POSIX path separators. The idea is to extend those scripts to
+ decide at run-time (of the script) which path separator to use.
+
+ * arch/misc/Makefile.sub: New file.
+ * arch/misc/shdeps.sh: New file, generating OS dependency fixups.
+ This script handles @GROFF_BIN_PATH_SETUP@, replacing it with
+ a proper definition of the variable `GROFF_RUNTIME'.
+
+ * Makefile.in (SH_DEPS_SED_SCRIPT): New variable.
+ (MDEFINES): Add SH_DEPS_SED_SCRIPT.
+ (PROGDEPDIRS): New variable.
+ `FORCE' it.
+ (PROGDIRS): Add PROGDEPDIRS.
+
+ * src/preproc/eqn/Makefile.sub (neqn): Call SH_DEPS_SED_SCRIPT.
+ Don't substitute @SEP@ and @BINDIR@.
+ * src/preproc/eqn/neqn.sh: Use @GROFF_BIN_PATH_SETUP@.
+ (PATH): Use GROFF_RUNTIME.
+
+ * src/roff/nroff/Makefile.sub (nroff): Call SH_DEPS_SED_SCRIPT.
+ Don't substitute @SEP@ and @BINDIR@.
+ * src/roff/nroff/nroff.sh: Use @GROFF_BIN_PATH_SETUP@.
+ (PATH): Use GROFF_RUNTIME.
+
+2004-04-05 Keith Marshall <keith.d.marshall@ntlworld.com>
+
+ * src/roff/nroff/nroff.sh: Implement work-around for sh.exe from
+ Cygwin which doesn't handle stderr correctly.
+
2004-03-08 Werner LEMBERG <wl@gnu.org>
* Makefile.comm (install_dev, uninstall_dev): Protect `for' loops
diff --git a/Makefile.in b/Makefile.in
index 78501076..6b06de48 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -337,6 +337,8 @@ ETAGSCCFLAG=-C
PERLPATH=@PERLPATH@
# Sed command with which to edit sh scripts.
SH_SCRIPT_SED_CMD=@SH_SCRIPT_SED_CMD@
+# Sed script to deal with OS dependencies in sh scripts.
+SH_DEPS_SED_SCRIPT=$(top_builddir)/arch/misc/shdeps.sed
# The program to create directory hierarchies.
mkinstalldirs= $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -386,6 +388,7 @@ MDEFINES= \
"SH_SEP=$(SH_SEP)" \
"SHELL=$(SHELL)" \
"SH_SCRIPT_SED_CMD=$(SH_SCRIPT_SED_CMD)" \
+ "SH_DEPS_SED_SCRIPT=$(SH_DEPS_SED_SCRIPT)" \
"TTYDEVDIRS=$(TTYDEVDIRS)" \
"YACC=$(YACC)" \
"YACCFLAGS=$(YACCFLAGS)" \
@@ -463,7 +466,8 @@ CCPROGDIRS=\
src/utils/lkbib \
src/utils/addftinfo
CPROGDIRS=src/utils/pfbtops
-PROGDIRS=$(CCPROGDIRS) $(CPROGDIRS)
+PROGDEPDIRS=arch/misc
+PROGDIRS=$(PROGDEPDIRS) $(CCPROGDIRS) $(CPROGDIRS)
DEVDIRS=\
font/devps \
font/devdvi \
@@ -597,7 +601,7 @@ $(DEVDIRS) $(OTHERDEVDIRS) $(TTYDEVDIRS): FORCE
-f $$srcdir/Makefile.sub \
-f $(top_srcdir)/Makefile.dev $(do)
-$(INCDIRS) $(OTHERDIRS): FORCE
+$(INCDIRS) $(PROGDEPDIRS) $(OTHERDIRS): FORCE
@$(ENVSETUP); \
if test $(srcdir) = .; then \
srcdir=.; \
diff --git a/src/preproc/eqn/Makefile.sub b/src/preproc/eqn/Makefile.sub
index 7312343a..c1f59727 100644
--- a/src/preproc/eqn/Makefile.sub
+++ b/src/preproc/eqn/Makefile.sub
@@ -44,11 +44,10 @@ CLEANADD=neqn
all: neqn
-neqn: neqn.sh
+neqn: neqn.sh $(SH_DEPS_SED_SCRIPT)
-rm -f $@
sed -e 's/@g@/$(g)/g' \
- -e 's|@BINDIR@|$(bindir)|g' \
- -e 's|@SEP@|$(SH_SEP)|g' \
+ -f $(SH_DEPS_SED_SCRIPT) \
-e $(SH_SCRIPT_SED_CMD) $(srcdir)/neqn.sh >$@
chmod +x $@
diff --git a/src/preproc/eqn/neqn.sh b/src/preproc/eqn/neqn.sh
index 43fe1e85..f2b5fdfc 100644
--- a/src/preproc/eqn/neqn.sh
+++ b/src/preproc/eqn/neqn.sh
@@ -2,8 +2,8 @@
# Provision of this shell script should not be taken to imply that use of
# GNU eqn with groff -Tascii|-Tlatin1|-Tutf8|-Tcp1047 is supported.
-: ${GROFF_BIN_PATH=@BINDIR@}
-PATH=$GROFF_BIN_PATH@SEP@$PATH
+@GROFF_BIN_PATH_SETUP@
+PATH="$GROFF_RUNTIME$PATH"
export PATH
exec @g@eqn -Tascii ${1+"$@"}
diff --git a/src/roff/nroff/Makefile.sub b/src/roff/nroff/Makefile.sub
index abd6d4a5..ffd2ccd8 100644
--- a/src/roff/nroff/Makefile.sub
+++ b/src/roff/nroff/Makefile.sub
@@ -4,10 +4,9 @@ CLEANADD=nroff
all: nroff
-nroff: nroff.sh
+nroff: nroff.sh $(SH_DEPS_SED_SCRIPT)
rm -f $@
- sed -e "s|@BINDIR@|$(bindir)|g" \
- -e "s|@SEP@|$(SH_SEP)|g" \
+ sed -f $(SH_DEPS_SED_SCRIPT) \
-e $(SH_SCRIPT_SED_CMD) \
-e "s|@VERSION@|$(version)$(revision)|" $(srcdir)/nroff.sh >$@
chmod +x $@
diff --git a/src/roff/nroff/nroff.sh b/src/roff/nroff/nroff.sh
index 9c9cc768..4c5c00bd 100644
--- a/src/roff/nroff/nroff.sh
+++ b/src/roff/nroff/nroff.sh
@@ -5,7 +5,7 @@ prog="$0"
# Default device.
# First try the "locale charmap" command, because it's most reliable.
# On systems where it doesn't exist, look at the environment variables.
-case "`locale charmap 2>/dev/null`" in
+case "`exec 2>/dev/null ; locale charmap`" in
UTF-8)
T=-Tutf8 ;;
ISO-8859-1)
@@ -84,11 +84,15 @@ for i
shift
done
+# Set up the `GROFF_BIN_PATH' variable
+# to be exported in the current `GROFF_RUNTIME' environment.
+
+@GROFF_BIN_PATH_SETUP@
+export GROFF_BIN_PATH
+
# This shell script is intended for use with man, so warnings are
# probably not wanted. Also load nroff-style character definitions.
-: ${GROFF_BIN_PATH=@BINDIR@}
-export GROFF_BIN_PATH
-PATH=$GROFF_BIN_PATH@SEP@$PATH groff -mtty-char $T $opts ${1+"$@"}
+PATH="$GROFF_RUNTIME$PATH" groff -mtty-char $T $opts ${1+"$@"}
# eof