tech-toolchain archive

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

Per-shell override of path names in make(1)



Hi all,
attached is the core of a patch from pkgsrc that complements and extends
the DEFSHELL_CUSTOM handling. The patch allows the default location for
each of the shells (sh, ksh, csh) to be set individually via
environment.

Any objections to merge this?

Joerg
Index: job.c
===================================================================
RCS file: /data/repo/netbsd/src/usr.bin/make/job.c,v
retrieving revision 1.135
diff -u -p -r1.135 job.c
--- job.c       19 Jan 2008 06:52:14 -0000      1.135
+++ job.c       6 Feb 2008 22:30:34 -0000
@@ -239,6 +239,11 @@ static Shell    shells[] = {
      */
 {
     DEFSHELL_CUSTOM,
+#ifdef DEFSHELL_CUSTOM_NAME
+    DEFSHELL_CUSTOM_NAME,
+#else
+    DEFSHELL_CUSTOM,
+#endif
     FALSE, "", "", "", 0,
     FALSE, "echo \"%s\"\n", "%s\n", "{ %s \n} || exit $?\n", "'\n'", '#',
     "",
@@ -250,7 +255,7 @@ static Shell    shells[] = {
      * sun UNIX anyway, one can even control error checking.
      */
 {
-    "sh",
+    DEFAULT_SH, "sh",
     FALSE, "", "", "", 0,
     FALSE, "echo \"%s\"\n", "%s\n", "{ %s \n} || exit $?\n", "'\n'", '#',
 #if defined(MAKE_NATIVE) && defined(__NetBSD__)
@@ -264,7 +269,7 @@ static Shell    shells[] = {
      * KSH description. 
      */
 {
-    "ksh",
+    DEFAULT_KSH, "ksh",
     TRUE, "set +v", "set -v", "set +v", 6,
     FALSE, "echo \"%s\"\n", "%s\n", "{ %s \n} || exit $?\n", "'\n'", '#',
     "v",
@@ -276,7 +281,7 @@ static Shell    shells[] = {
      * however, it is unable to do error control nicely.
      */
 {
-    "csh",
+    DEFAULT_CSH, "csh",
     TRUE, "unset verbose", "set verbose", "unset verbose", 10,
     FALSE, "echo \"%s\"\n", "csh -c \"%s || exit 0\"\n", "", "'\\\n'", '#',
     "v", "e",
@@ -285,7 +290,7 @@ static Shell    shells[] = {
      * UNKNOWN.
      */
 {
-    NULL,
+    NULL, NULL,
     FALSE, NULL, NULL, NULL, 0,
     FALSE, NULL, NULL, NULL, NULL, 0,
     NULL, NULL,
@@ -2064,7 +2069,7 @@ Shell_Init(void)
            shellName++;
        } else
 #endif
-       shellPath = str_concat(_PATH_DEFSHELLDIR, shellName, STR_ADDSLASH);
+       shellPath = commandShell->path;
     }
     if (commandShell->exit == NULL) {
        commandShell->exit = "";
Index: job.h
===================================================================
RCS file: /data/repo/netbsd/src/usr.bin/make/job.h,v
retrieving revision 1.34
diff -u -p -r1.34 job.h
--- job.h       1 Oct 2007 22:14:09 -0000       1.34
+++ job.h       6 Feb 2008 22:28:00 -0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.h,v 1.34 2007/10/01 22:14:09 sjg Exp $     */
+/*     $NetBSD: job.h,v 1.4 2007/09/06 19:23:26 joerg Exp $    */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -202,6 +202,7 @@ typedef struct Job {
  * echo "%s\n" as a template.
  */
 typedef struct Shell {
+    const char  *path;
     const char  *name;         /* the name of the shell. For Bourne and C
                                 * shells, this is used only to find the
                                 * shell description when used as the single
Index: pathnames.h
===================================================================
RCS file: /data/repo/netbsd/src/usr.bin/make/pathnames.h,v
retrieving revision 1.16
diff -u -p -r1.16 pathnames.h
--- pathnames.h 24 Jun 2005 04:33:25 -0000      1.16
+++ pathnames.h 6 Feb 2008 22:33:14 -0000
@@ -39,11 +39,18 @@
 #include <paths.h>
 #endif
 
+#ifndef        DEFAULT_CSH
+#define        DEFAULT_CSH             "/bin/csh"
+#endif
+#ifndef        DEFAULT_KSH
+#define        DEFAULT_KSH             "/bin/ksh"
+#endif
+#ifndef        DEFAULT_SH
+#define        DEFAULT_SH              "/bin/sh"
+#endif
+
 #define        _PATH_OBJDIR            "obj"
 #define        _PATH_OBJDIRPREFIX      "/usr/obj"
-#ifndef _PATH_DEFSHELLDIR
-#define        _PATH_DEFSHELLDIR       "/bin"
-#endif
 #define        _PATH_DEFSYSMK          "sys.mk"
 #ifndef _PATH_DEFSYSPATH
 #define        _PATH_DEFSYSPATH        "/usr/share/mk"


Home | Main Index | Thread Index | Old Index