Permalink
Browse files

OS-2173 libmakestate shenanigans are janky

  • Loading branch information...
1 parent 884461b commit 5e17a8e16f7b70b2cc857990af81929ee82438c4 @rmustacc rmustacc committed Apr 26, 2013
Showing with 56 additions and 83 deletions.
  1. +10 −33 make/dmake.patch
  2. +46 −50 make/prefix.patch
View
@@ -1,18 +1,18 @@
-From fb00928e476a57195ee6775bd16567c0afc66837 Mon Sep 17 00:00:00 2001
+From 564c276dca99fef84cd381281514d4d0000c28e3 Mon Sep 17 00:00:00 2001
From: Robert Mustacchi <rm@joyent.com>
-Date: Mon, 25 Mar 2013 18:58:29 +0000
+Date: Fri, 26 Apr 2013 00:20:46 +0000
Subject: [PATCH] add dmake support
---
- src/make_src/Make/bin/make/common/doname.cc | 6 +--
- src/make_src/Make/bin/make/common/main.cc | 42 ++++++++++----------
- src/make_src/Make/bin/make/common/parallel.cc | 14 ++++++-
- src/make_src/Make/bin/make/smake/src/Variant.mk | 8 +++-
- .../Make/lib/mksdmsi18n/src/libmksdmsi18n_init.cc | 8 +++-
- src/make_src/Make/lib/mksh/src/dosys.cc | 4 +-
+ src/make_src/Make/bin/make/common/doname.cc | 6 +---
+ src/make_src/Make/bin/make/common/main.cc | 33 ++++++++++++--------
+ src/make_src/Make/bin/make/common/parallel.cc | 14 +++++++-
+ src/make_src/Make/bin/make/smake/src/Variant.mk | 8 ++++-
+ .../Make/lib/mksdmsi18n/src/libmksdmsi18n_init.cc | 8 ++++-
+ src/make_src/Make/lib/mksh/src/dosys.cc | 4 ++-
src/make_src/Make/lib/mksh/src/mksh.cc | 2 +-
src/make_src/rules/master.mk | 3 +-
- 8 files changed, 54 insertions(+), 33 deletions(-)
+ 8 files changed, 53 insertions(+), 25 deletions(-)
diff --git a/src/make_src/Make/bin/make/common/doname.cc b/src/make_src/Make/bin/make/common/doname.cc
index c06ba2f..8a38a13 100644
@@ -52,7 +52,7 @@ index c06ba2f..8a38a13 100644
/* Scan the list of conditional properties and restore the old value */
/* to each one Reverse the order relative to when we assigned macros */
diff --git a/src/make_src/Make/bin/make/common/main.cc b/src/make_src/Make/bin/make/common/main.cc
-index 1289837..889eae8 100644
+index 5ca4c93..789f149 100644
--- a/src/make_src/Make/bin/make/common/main.cc
+++ b/src/make_src/Make/bin/make/common/main.cc
@@ -39,15 +39,17 @@
@@ -168,29 +168,6 @@ index 1289837..889eae8 100644
#endif
#endif
-@@ -2131,13 +2138,6 @@ set_sgs_support()
- sprintf(newpath64, "%s=%s", LD_SUPPORT_ENV_VAR_64, oldpath64);
- }
-
--#if defined(TEAMWARE_MAKE_CMN)
--
-- /* function maybe_append_str_to_env_var() is defined in avo_util library
-- * Serial make should not use this library !!!
-- */
-- maybe_append_str_to_env_var(newpath, LD_SUPPORT_MAKE_LIB);
--#else
- if (oldpath == NULL) {
- sprintf("%s%s%s/%s:%s",
- newpath, MAKE_PREFIX, LD_SUPPORT_MAKE_LIB_DIR,
-@@ -2162,7 +2162,7 @@ set_sgs_support()
- LD_SUPPORT_MAKE_LIB) + 1;
-
- }
--#endif
-+
- putenv(newpath);
- if (prev_path) {
- free(prev_path);
diff --git a/src/make_src/Make/bin/make/common/parallel.cc b/src/make_src/Make/bin/make/common/parallel.cc
index 1831415..477e50d 100644
--- a/src/make_src/Make/bin/make/common/parallel.cc
View
@@ -1,19 +1,19 @@
-From cb159d83ea69804861fdb85ae9a49e5537cc1d9e Mon Sep 17 00:00:00 2001
+From 90624ceffd11ff81ad4d2bfd3c1c3e58dad68d46 Mon Sep 17 00:00:00 2001
From: Robert Mustacchi <rm@joyent.com>
Date: Sat, 23 Mar 2013 15:44:40 +0000
-Subject: [PATCH 2/3] make should support a prefix
+Subject: [PATCH] make should support a prefix
---
src/build | 17 +++-
- src/make_src/Make/bin/make/common/main.cc | 90 +++++++++++++++++++---
+ src/make_src/Make/bin/make/common/main.cc | 90 +++++++++++++++++------
src/make_src/Make/bin/make/common/read.cc | 20 +++++
src/make_src/Make/bin/make/make.svr4/Makefile | 12 ++--
src/make_src/Make/bin/make/make.xpg4/Makefile | 6 +-
src/make_src/Make/bin/make/smake/src/Variant.mk | 6 +-
src/make_src/Make/lib/makestate/src/Variant.mk | 12 ++-
src/make_src/rules/derived.mk | 2 +-
src/make_src/rules/master.mk | 3 +-
- 9 files changed, 133 insertions(+), 35 deletions(-)
+ 9 files changed, 124 insertions(+), 44 deletions(-)
diff --git a/src/build b/src/build
index 967f5af..65e0603 100755
@@ -62,7 +62,7 @@ index 967f5af..65e0603 100755
+#cd $DESTDIR/$PREFIX
+#find . -type f -print | sed 's/^/ /'
diff --git a/src/make_src/Make/bin/make/common/main.cc b/src/make_src/Make/bin/make/common/main.cc
-index e594d59..1289837 100644
+index e594d59..7334fb5 100644
--- a/src/make_src/Make/bin/make/common/main.cc
+++ b/src/make_src/Make/bin/make/common/main.cc
@@ -117,8 +117,20 @@ extern void job_adjust_fini();
@@ -75,7 +75,7 @@ index e594d59..1289837 100644
+#define LD_SUPPORT_ENV_VAR_64 NOCATGETS("SGS_SUPPORT_64")
#define LD_SUPPORT_MAKE_LIB NOCATGETS("libmakestate.so.1")
+#define LD_SUPPORT_MAKE_LIB_DIR NOCATGETS("/lib")
-+#define LD_SUPPORT_MAKE_LIB_DIR_64 NOCATGETS("/lib/64")
++#define LD_SUPPORT_MAKE_LIB_DIR_64 NOCATGETS("/64")
+
+#ifdef PREFIX
+#define MTOSTR(x) #x
@@ -87,7 +87,7 @@ index e594d59..1289837 100644
/*
* typedefs & structs
-@@ -2070,26 +2082,53 @@ int done=0;
+@@ -2070,46 +2082,80 @@ int done=0;
* if it's not already in there.
* The SGS_SUPPORT env var and libmakestate.so.1 is used by
* the linker ld to report .make.state info back to make.
@@ -114,75 +114,71 @@ index e594d59..1289837 100644
if (oldpath == NULL) {
- len = strlen(LD_SUPPORT_ENV_VAR) + 1 +
- strlen(LD_SUPPORT_MAKE_LIB) + 1;
-+ len = snprintf(NULL, 0, "%s=%s%s/%s:%s",
++ len = snprintf(NULL, 0, "%s=%s/%s/%s:%s",
+ LD_SUPPORT_ENV_VAR_32,
+ MAKE_PREFIX,
+ LD_SUPPORT_MAKE_LIB_DIR,
+ LD_SUPPORT_MAKE_LIB, LD_SUPPORT_MAKE_LIB) + 1;
newpath = (char *) malloc(len);
- sprintf(newpath, "%s=", LD_SUPPORT_ENV_VAR);
-+ sprintf(newpath, "%s=", LD_SUPPORT_ENV_VAR_32);
++ sprintf(newpath, "%s=%s/%s/%s:%s",
++ LD_SUPPORT_ENV_VAR_32,
++ MAKE_PREFIX,
++ LD_SUPPORT_MAKE_LIB_DIR,
++ LD_SUPPORT_MAKE_LIB, LD_SUPPORT_MAKE_LIB);
} else {
- len = strlen(LD_SUPPORT_ENV_VAR) + 1 + strlen(oldpath) + 1 +
- strlen(LD_SUPPORT_MAKE_LIB) + 1;
-+ len = snprintf(NULL, 0, "%s=%s:%s%s/%s:%s",
++ len = snprintf(NULL, 0, "%s=%s:%s/%s/%s:%s",
+ LD_SUPPORT_ENV_VAR_32, oldpath, MAKE_PREFIX,
+ LD_SUPPORT_MAKE_LIB_DIR, LD_SUPPORT_MAKE_LIB,
+ LD_SUPPORT_MAKE_LIB) + 1;
newpath = (char *) malloc(len);
- sprintf(newpath, "%s=%s", LD_SUPPORT_ENV_VAR, oldpath);
-+ sprintf(newpath, "%s=%s", LD_SUPPORT_ENV_VAR_32, oldpath);
+- }
+-
+-#if defined(TEAMWARE_MAKE_CMN)
+-
+- /* function maybe_append_str_to_env_var() is defined in avo_util library
+- * Serial make should not use this library !!!
+- */
+- maybe_append_str_to_env_var(newpath, LD_SUPPORT_MAKE_LIB);
+-#else
+- if (oldpath == NULL) {
+- sprintf(newpath, "%s%s", newpath, LD_SUPPORT_MAKE_LIB);
++ sprintf(newpath, "%s=%s:%s/%s/%s:%s",
++ LD_SUPPORT_ENV_VAR_32, oldpath, MAKE_PREFIX,
++ LD_SUPPORT_MAKE_LIB_DIR, LD_SUPPORT_MAKE_LIB,
++ LD_SUPPORT_MAKE_LIB);
+ }
+
+ oldpath64 = getenv(LD_SUPPORT_ENV_VAR_64);
+ if (oldpath64 == NULL) {
-+ len = snprintf(NULL, 0, "%s=%s%s/%s:%s",
++ len = snprintf(NULL, 0, "%s=%s/%s/%s/%s:%s",
+ LD_SUPPORT_ENV_VAR_64, MAKE_PREFIX, LD_SUPPORT_MAKE_LIB_DIR,
-+ LD_SUPPORT_MAKE_LIB_DIR_64, LD_SUPPORT_MAKE_LIB) + 1;
-+ newpath64 = (char *) malloc(len);
-+ sprintf(newpath64, "%s=", LD_SUPPORT_ENV_VAR_64);
-+ } else {
-+ len = snprintf(NULL, 0, "%s=%s:%s%s/%s:%s",
-+ LD_SUPPORT_ENV_VAR_64, oldpath64, MAKE_PREFIX,
+ LD_SUPPORT_MAKE_LIB_DIR_64, LD_SUPPORT_MAKE_LIB,
+ LD_SUPPORT_MAKE_LIB) + 1;
+ newpath64 = (char *) malloc(len);
-+ sprintf(newpath64, "%s=%s", LD_SUPPORT_ENV_VAR_64, oldpath64);
- }
-
- #if defined(TEAMWARE_MAKE_CMN)
-@@ -2100,9 +2139,28 @@ set_sgs_support()
- maybe_append_str_to_env_var(newpath, LD_SUPPORT_MAKE_LIB);
- #else
- if (oldpath == NULL) {
-- sprintf(newpath, "%s%s", newpath, LD_SUPPORT_MAKE_LIB);
-+ sprintf(newpath, "%s%s%s/%s:%s",
-+ MAKE_PREFIX, LD_SUPPORT_MAKE_LIB_DIR,
-+ LD_SUPPORT_MAKE_LIB, LD_SUPPORT_MAKE_LIB) + 1;
++ sprintf(newpath64, "%s=%s/%s/%s/%s:%s",
++ LD_SUPPORT_ENV_VAR_64, MAKE_PREFIX, LD_SUPPORT_MAKE_LIB_DIR,
++ LD_SUPPORT_MAKE_LIB_DIR_64, LD_SUPPORT_MAKE_LIB,
++ LD_SUPPORT_MAKE_LIB);
} else {
- sprintf(newpath, "%s:%s", newpath, LD_SUPPORT_MAKE_LIB);
-+ sprintf(newpath, "%s:%s%s/%s:%s",
-+ newpath, MAKE_PREFIX,
-+ LD_SUPPORT_MAKE_LIB_DIR, LD_SUPPORT_MAKE_LIB,
-+ LD_SUPPORT_MAKE_LIB) + 1;
-+
-+ }
-+
-+ if (oldpath64 == NULL) {
-+ sprintf(newpath64, "%s%s%s/%s:%s",
-+ MAKE_PREFIX, LD_SUPPORT_MAKE_LIB_DIR_64,
++ len = snprintf(NULL, 0, "%s=%s:%s/%s/%s/%s:%s",
++ LD_SUPPORT_ENV_VAR_64, oldpath64, MAKE_PREFIX,
++ LD_SUPPORT_MAKE_LIB_DIR, LD_SUPPORT_MAKE_LIB_DIR_64,
+ LD_SUPPORT_MAKE_LIB, LD_SUPPORT_MAKE_LIB) + 1;
-+
-+ } else {
-+ sprintf(newpath64, "%s:%s%s/%s:%s",
-+ newpath64, MAKE_PREFIX,
-+ LD_SUPPORT_MAKE_LIB_DIR_64, LD_SUPPORT_MAKE_LIB,
-+ LD_SUPPORT_MAKE_LIB) + 1;
-+
++ newpath64 = (char *) malloc(len);
++ sprintf(newpath64, "%s=%s:%s/%s/%s/%s:%s",
++ LD_SUPPORT_ENV_VAR_64, oldpath64, MAKE_PREFIX,
++ LD_SUPPORT_MAKE_LIB_DIR, LD_SUPPORT_MAKE_LIB_DIR_64,
++ LD_SUPPORT_MAKE_LIB, LD_SUPPORT_MAKE_LIB);
}
- #endif
+-#endif
++
putenv(newpath);
-@@ -2110,6 +2168,12 @@ set_sgs_support()
+ if (prev_path) {
free(prev_path);
}
prev_path = newpath;
@@ -347,5 +343,5 @@ index eae7f19..f113efe 100644
LINTFLAGS += -buxz
--
-1.7.7.2
+1.7.3.4

0 comments on commit 5e17a8e

Please sign in to comment.