bug-gnu-utils
[Top][All Lists]
Advanced

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

djgpp specific suggestion for gawk


From: Juan Manuel Guerrero
Subject: djgpp specific suggestion for gawk
Date: Mon, 13 Feb 2006 01:02:56 +0100
User-agent: KMail/1.8.2

Here is a patch that suggests some small improvements concerning the djgpp port
of gawk.  It concerns primarily the assumptions for the hard coded paths in the
Makefile and in pc/config.h.  First the djgpp ports of the GNU programs try to
reproduce the directory structure defined by the original packages.  This means
that the directory produced by the GNU programs in /usr/local is reproduced by
djgpp in its main installation directory.  Where the main installation directory
lives is define by the environment variable DJDIR and evaluated by the crt0.o
code of every application at runtime.  This implies that, e.g., if somewhere in
the code the tmp directory is hard code like this:
#define TMPDIR "/tmp"
the appropriate way to code it for a djgpp port would look like this:
#define TMPDIR "/dev/env/DJDIR/tmp"
All this is only an example.  The issue is the hard coded library search path
in the macro DEFPATH.  I have replaced the original code with the following
snippet:

#if defined(__DJGPP__) && (__DJGPP__ > 2 || __DJGPP_MINOR__ >= 3)
# define DEFPATH  ".;/dev/env/DJDIR/share/awk"
#else
# define DEFPATH  ".;c:/lib/awk;c:/gnu/lib/awk"
#endif

If we are compiling with djgpp 2.03 or later where the "/dev/env/DJDIR"
functionality is available, gawk should search at /dev/env/DJDIR/share/awk for
its scripts.
I have changed the /pc/Makefile adding the variable pkgdatadir to code where
the gawk's stuff should be installed and I have allowed to check for the 
environ-
ment variable DJGPP to reset the variable prefix to DJDIR and pkgdatadir to
$(prefix)//share/awk.
Suggestions, objections, comments are welcome.

Regards,
Juan Manuel Guerrero



Sun Feb 13 00:20:16 2006  Juan M. Guerrero  <address@hidden>

        * config.h: Let DEFPATH reflect DJGPP installation directory tree.
        * Makefile: pkgdatadir variable defined to $(prefix)/lib/awk.
        * Makefile: In DJGPP section use the DJGPP environment variable to
          redefine the pkgdatadir variable.


diff -aprNU5 gawk-3.1.5.orig/pc/Makefile gawk-3.1.5/pc/Makefile
--- gawk-3.1.5.orig/pc/Makefile 2005-06-26 06:31:28.000000000 +0000
+++ gawk-3.1.5/pc/Makefile      2006-01-12 02:03:48.000000000 +0000
@@ -71,10 +71,11 @@ MAK = $(MAKE) $(MAKEFILE)
 # Define the base directory for the install. "make install" will install
 # in bin, lib/awk, man, and info under $(prefix)/. Most likely, you should
 # edit config.h so that $(prefix)/lib/awk appears as part of DEFPATH.
 #prefix =
 prefix = c:/gnu
+pkgdatadir = $(prefix)/lib/awk
 #
 # Define the install method. Method 1 is Unix-like (and requires cat,
 # cp, mkdir, sed, and sh); method 2 uses gawk and batch files.
 install = 1
 #------------------------------------------------------------------------
@@ -104,10 +105,14 @@ DO_PBIND= $($(PBIND))
 
 #========================================================================
 #========================== DJGPP =======================================
 #========================================================================
 
+ifneq ($(DJGPP),)
+prefix = $(DJDIR)
+pkgdatadir = $(prefix)/share/awk
+endif
 LDJG = $(CC) $(LF) -o gawk.exe $(LDRSP) $(LF2)
 PLDJG = $(CC) $(LF) -o pgawk.exe $(PLDRSP) $(LF2)
 BDJG = stubify -g awk.exe | stubedit awk.exe runfile=gawk
 
 djgpp:
@@ -387,13 +392,13 @@ install1: 
        echo extproc sh $(prefix)/bin/igawk.cmd > igawk.cmd
        echo shift >> igawk.cmd
        cat pc/awklib/igawk >> igawk.cmd
        sed "s;igawk;$(prefix)/bin/igawk;" pc/awklib/igawk.bat > igawk.bat
        sh mkinstal.sh $(prefix)/bin
-       sh mkinstal.sh $(prefix)/lib/awk $(prefix)/man/man1 $(prefix)/info
+       sh mkinstal.sh $(pkgdatadir) $(prefix)/man/man1 $(prefix)/info
        cp *awk.exe igawk.bat igawk.cmd pc/awklib/igawk $(prefix)/bin
-       cp awklib/eg/lib/* pc/awklib/igawk.awk $(prefix)/lib/awk
+       cp awklib/eg/lib/* pc/awklib/igawk.awk $(pkgdatadir)
        cp doc/*.1 $(prefix)/man/man1
        cp doc/gawk.info $(prefix)/info
 
 # install2 is equivalent to install1, but doesn't require cp, sed, etc.
 install2:
diff -aprNU5 gawk-3.1.5.orig/pc/config.h gawk-3.1.5/pc/config.h
--- gawk-3.1.5.orig/pc/config.h 2005-07-26 18:07:42.000000000 +0000
+++ gawk-3.1.5/pc/config.h      2006-01-12 02:04:44.000000000 +0000
@@ -345,11 +345,15 @@
 #if ULONG_MAX == 4294967295UL
 # define SIZEOF_UNSIGNED_LONG 4
 #endif
 
 /* Library search path */
-#define DEFPATH  ".;c:/lib/awk;c:/gnu/lib/awk"
+#if defined(__DJGPP__) && (__DJGPP__ > 2 || __DJGPP_MINOR__ >= 3)
+# define DEFPATH  ".;/dev/env/DJDIR/share/awk"
+#else
+# define DEFPATH  ".;c:/lib/awk;c:/gnu/lib/awk"
+#endif
 
 #if defined (_MSC_VER)
 #if !defined(__STDC__)
 # define __STDC__ 1
 #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]