Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

OS-2091 add open source dmake to illumos-extra

OS-2092	illumos-extra components should use open source dmake
OS-2093 illumos-extra components need to use pkgsrc sgstools
  • Loading branch information...
commit 80b887badffc72a06b859e69851fa8760dd6e69b 1 parent 7cfe094
@rmustacc rmustacc authored
View
5 Makefile
@@ -45,6 +45,7 @@ SUBDIRS = \
libm \
libxml \
libz \
+ make \
ncurses \
node.js \
nss-nspr \
@@ -71,6 +72,7 @@ STRAP_SUBDIRS = \
libm \
libxml \
libz \
+ make \
nss-nspr \
openssl1x \
perl
@@ -101,6 +103,9 @@ dialog: ncurses
socat: openssl1x
wget: openssl1x libidn
openldap: openssl1x
+libm: make
+g11n: make
+perl: libm
#
# pkg-config may be installed. This will actually only hurt us rather than help
View
15 Makefile.defs
@@ -18,7 +18,7 @@
#
# CDDL HEADER END
#
-# Copyright (c) 2012, Joyent, Inc.
+# Copyright (c) 2013, Joyent, Inc.
#
BASE = $(PWD)
@@ -41,6 +41,9 @@ GXX.host = /opt/local/bin/g++
GCC.host.64 = $(GCC.host) -m64
GXX.host.64 = $(GXX.host) -m64
+LEX = /opt/local/bin/lex
+YACC = /opt/local/bin/yacc
+
SYSINCDIRS = /usr/include
SYSLIBDIRS = /usr/lib /lib
@@ -50,6 +53,16 @@ BUILD64 =
CPPFLAGS = $(SYSINCDIRS:%=-isystem $(DESTDIR)/%)
#
+# These are all definitions that relate to Sun Make. There are basically two
+# different sets that we care about. The first is the boostrap make. This is
+# used to build the strap make. Once we have the strap make, it is used for all
+# other makes. Beacuse MAKE is used extensively to mean GNU make in these
+# makefiles, we instead use SUN_MAKE and SUM_MAKE_STRAP.
+#
+SUN_MAKE_STRAP=/opt/local/bin/dmake
+SUN_MAKE=$(DESTDIR)/../proto.strap/usr/bin/dmake
+
+#
# Because of bugs in ntp, we need to be able to refer to the target specific
# flags as well as the generic flags later on.
#
View
9 g11n/Makefile
@@ -18,18 +18,19 @@
#
# CDDL HEADER END
#
-# Copyright 2012, Joyent, Inc. All rights reserved.
+# Copyright 2013, Joyent, Inc. All rights reserved.
#
-MAKE=/usr/ccs/bin/make
+include ../Makefile.defs
+
SRC=$(shell (pwd))
LIBDIR=${DESTDIR}/usr/lib/iconv
all:
- @(cd src; pwd; SRC=$(SRC) $(MAKE) all)
+ @(cd src; pwd; SRC=$(SRC) $(SUN_MAKE) all)
install: all
- @(cd src; pwd; SRC=$(SRC) $(MAKE) install)
+ @(cd src; pwd; SRC=$(SRC) $(SUN_MAKE) install)
mkdir -p $(LIBDIR)
cp proto/i386/fileroot/usr/lib/iconv/UTF-8%646.so $(LIBDIR)
cp proto/i386/fileroot/usr/lib/iconv/UTF-8%UCS-2.so $(LIBDIR)
View
8 libm/Makefile
@@ -18,15 +18,19 @@
#
# CDDL HEADER END
#
-# Copyright (c) 2012, Joyent, Inc. All rights reserved.
+# Copyright (c) 2013, Joyent, Inc. All rights reserved.
#
BASE=$(PWD)
DESTDIR=$(BASE)/../proto
+include ../Makefile.defs
+
all:
(cd usr/src/harness; env - \
- make -f Makefile-os STRIP=/usr/bin/strip MCS=/usr/bin/mcs LD=/usr/bin/ld)
+ SUN_MAKE=$(SUN_MAKE) \
+ $(SUN_MAKE) -f Makefile-os \
+ STRIP=/usr/bin/strip MCS=/usr/bin/mcs LD=/usr/bin/ld)
install: all
BASE=$(DESTDIR) ksh93 ./install-extra
View
4 libm/usr/src/harness/Makefile-os
@@ -51,8 +51,8 @@ DMAKE_MAX_JOBS:sh = eval expr "`/usr/sbin/psrinfo | grep on-line | wc -l` \* 8"
STUDIOBIN = /opt/SUNWspro/bin
CC = $(STUDIOBIN)/cc
LINT = $(STUDIOBIN)/lint
-MAKE = $(STUDIOBIN)/dmake -m serial
-DMAKE = $(STUDIOBIN)/dmake -m parallel -j $(DMAKE_MAX_JOBS)
+MAKE = $(SUN_MAKE) -m serial
+DMAKE = $(SUN_MAKE) -m parallel -j $(DMAKE_MAX_JOBS)
WORKDIRS = \
$(STATDIR)/steps \
View
60 make/Makefile
@@ -0,0 +1,60 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright 2013, Joyent, Inc. All rights reserved.
+#
+
+VER=usr
+
+include ../Makefile.defs
+
+UNPACK_SENTINEL = src/OPENSOLARIS.LICENSE
+TARBALL = devpro-make-src-20061219.tar.bz2
+TARBALL_COMPRESS = -j
+
+ifneq ($(STRAP),strap)
+MAKE_PREFIX = /opt/local
+MAKE_DESTDIR = $(DESTDIR)
+BUILD_MAKE = $(SUN_MAKE)
+else
+MAKE_PREFIX = $(DESTDIR)/usr
+MAKE_DESTDIR = /
+BUILD_MAKE = $(SUN_MAKE_STRAP)
+endif
+
+
+PATCHES += install.patch \
+ prefix.patch \
+ dmake.patch
+
+#
+# Build errors often get lost so instead we check for a few files that we expect
+# in the proto area.
+#
+all: $(VER.32)/$(UNPACK_SENTINEL)
+ cd $(VER.32)/src; pwd; DESTDIR=$(MAKE_DESTDIR) \
+ PREFIX=$(MAKE_PREFIX) \
+ MAKE=$(BUILD_MAKE) \
+ ./build
+ [[ -f $(MAKE_DESTDIR)/$(MAKE_PREFIX)/bin/dmake ]]
+
+install: all
+
+include ../Makefile.targ
View
BIN  make/devpro-make-src-20061219.tar.bz2
Binary file not shown
View
348 make/dmake.patch
@@ -0,0 +1,348 @@
+From c088aa46067c54f3dfe824a1943638f9d8d473f8 Mon Sep 17 00:00:00 2001
+From: Robert Mustacchi <rm@joyent.com>
+Date: Mon, 25 Mar 2013 18:58:29 +0000
+Subject: [PATCH] add dmake support
+
+---
+ src/make_src/Make/bin/make/common/doname.cc | 3 +-
+ 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/lib/mksh/src/mksh.cc | 2 +-
+ src/make_src/rules/master.mk | 3 +-
+ 8 files changed, 54 insertions(+), 30 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..2b18983 100644
+--- a/src/make_src/Make/bin/make/common/doname.cc
++++ b/src/make_src/Make/bin/make/common/doname.cc
+@@ -39,7 +39,7 @@
+ */
+ #include <avo/avo_alloca.h> /* alloca() */
+ #if defined(TEAMWARE_MAKE_CMN)
+-#include <avo/util.h> /* avo_get_user(), avo_hostname() */
++/* #include <avo/util.h> */ /* avo_get_user(), avo_hostname() */
+ #endif
+
+ #if defined(DISTRIBUTED) || defined(MAKETOOL) /* tolik */
+@@ -3419,7 +3419,6 @@ reset_locals(register Name target, register Property old_locals, register Proper
+ return;
+ }
+ #endif
+-
+ /* Scan the list of conditional properties and restore the old value */
+ /* to each one Reverse the order relative to when we assigned macros */
+ this_conditional = get_prop(conditional->next, conditional_prop);
+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
+--- a/src/make_src/Make/bin/make/common/main.cc
++++ b/src/make_src/Make/bin/make/common/main.cc
+@@ -39,15 +39,17 @@
+ */
+ #if defined(TEAMWARE_MAKE_CMN)
+ # include <avo/intl.h>
+-# include <avo/libcli.h> /* libcli_init() */
+-# include <avo/cli_license.h> /* avo_cli_get_license() */
+-# include <avo/find_dir.h> /* avo_find_run_dir() */
++/*
++# include <avo/libcli.h>
++# include <avo/cli_license.h>
++# include <avo/find_dir.h>
+ # include <avo/version_string.h>
+-# include <avo/util.h> /* avo_init() */
++# include <avo/util.h>
++*/
+ #ifdef USE_DMS_CCR
+ # include <avo/usage_tracking.h>
+ #else
+-# include <avo/cleanup.h>
++/* # include <avo/cleanup.h> */
+ #endif
+ #endif
+
+@@ -173,7 +175,7 @@ static Boolean getname_stat = false;
+ #ifdef USE_DMS_CCR
+ static Avo_usage_tracking *usageTracking = NULL;
+ #else
+- static Avo_cleanup *cleanup = NULL;
++/* static Avo_cleanup *cleanup = NULL; */
+ #endif
+ #endif
+
+@@ -221,7 +223,7 @@ extern void expand_value(Name, register String , Boolean);
+ extern XDR xdrs_out;
+ #endif
+ #ifdef TEAMWARE_MAKE_CMN
+- extern char verstring[];
++ static char *verstring = "rm hacked up make 2013/03/23";
+ #endif
+
+ jmp_buf jmpbuffer;
+@@ -281,7 +283,7 @@ main(int argc, char *argv[])
+ #endif
+ hostid = gethostid();
+ #ifdef TEAMWARE_MAKE_CMN
+- avo_get_user(NULL, NULL); // Initialize user name
++/* avo_get_user(NULL, NULL); */// Initialize user name
+ #endif
+ bsd_signals();
+
+@@ -311,19 +313,19 @@ main(int argc, char *argv[])
+ */
+ #if defined(TEAMWARE_MAKE_CMN) || defined(MAKETOOL)
+ um = umask(0);
+- avo_init(argv[0]);
++/* avo_init(argv[0]); */
+ umask(um);
+
+ #ifdef USE_DMS_CCR
+ usageTracking = new Avo_usage_tracking(NOCATGETS("dmake"), argc, argv);
+ #else
+- cleanup = new Avo_cleanup(NOCATGETS("dmake"), argc, argv);
++/* cleanup = new Avo_cleanup(NOCATGETS("dmake"), argc, argv); */
+ #endif
+ #endif
+
+ #if defined(TEAMWARE_MAKE_CMN)
+ catd = catopen(AVO_DOMAIN_DMAKE, NL_CAT_LOCALE);
+- libcli_init();
++/* libcli_init(); */
+
+ #ifdef _CHECK_UPDATE_H
+ /* This is for dmake only (not for Solaris make).
+@@ -636,8 +638,10 @@ main(int argc, char *argv[])
+ }
+ #else
+ if(dmake_mode_type == distributed_mode) {
++ /*
+ (void) fprintf(stdout, NOCATGETS("dmake: Distributed mode not implemented.\n"));
+ (void) fprintf(stdout, NOCATGETS(" Defaulting to parallel mode.\n"));
++ */
+ dmake_mode_type = parallel_mode;
+ no_parallel = false;
+ }
+@@ -648,7 +652,9 @@ main(int argc, char *argv[])
+
+ #ifdef TEAMWARE_MAKE_CMN
+ parallel_flag = true;
++ putenv(NOCATGETS("DMAKE_CHILD=TRUE"));
+ /* XXX - This is a major hack for DMake/Licensing. */
++#ifdef TEAMWARE_MAKE_CMN_LICENSING_REALLY
+ if (getenv(NOCATGETS("DMAKE_CHILD")) == NULL) {
+ if (!avo_cli_search_license(argv[0], dmake_exit_callback, TRUE, dmake_message_callback)) {
+ /*
+@@ -671,6 +677,7 @@ main(int argc, char *argv[])
+ value.it_value.tv_usec = 0;
+ (void) setitimer(ITIMER_REAL, &value, NULL);
+ }
++#endif
+
+ //
+ // If dmake is running with -t option, set dmake_mode_type to serial.
+@@ -1020,8 +1027,8 @@ if(getname_stat) {
+ //usageTracking->setExitStatus(exit_status, NULL);
+ //delete usageTracking;
+ #else
+- cleanup->set_exit_status(exit_status);
+- delete cleanup;
++/* cleanup->set_exit_status(exit_status);
++ delete cleanup; */
+ #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
++++ b/src/make_src/Make/bin/make/common/parallel.cc
+@@ -46,7 +46,7 @@
+ #endif
+ #include <errno.h> /* errno */
+ #include <fcntl.h>
+-#include <avo/util.h> /* avo_get_user(), avo_hostname() */
++/* #include <avo/util.h>*/ /* avo_get_user(), avo_hostname() */
+ #include <mk/defs.h>
+ #include <mksh/dosys.h> /* redirect_io() */
+ #include <mksh/macro.h> /* expand_value() */
+@@ -57,6 +57,7 @@
+ #include <sys/utsname.h>
+ #include <sys/wait.h>
+ #include <unistd.h>
++#include <netdb.h> /* net name */
+
+ #ifdef SGE_SUPPORT
+ #include <dmthread/Avo_PathNames.h>
+@@ -153,11 +154,14 @@ execute_parallel(Property line, Boolean waitflg, Boolean local)
+
+ if ((pmake_max_jobs == 0) &&
+ (dmake_mode_type == parallel_mode)) {
++ /*
+ if (user_name[0] == '\0') {
+ avo_get_user(user_name, NULL);
+ }
++ */
+ if (local_host[0] == '\0') {
+- strcpy(local_host, avo_hostname());
++ /* strcpy(local_host, avo_hostname()); */
++ (void) gethostname(local_host, MAXNAMELEN);
+ }
+ MBSTOWCS(wcs_buffer, NOCATGETS("DMAKE_MAX_JOBS"));
+ dmake_name = GETNAME(wcs_buffer, FIND_LENGTH);
+@@ -184,9 +188,13 @@ execute_parallel(Property line, Boolean waitflg, Boolean local)
+ } else {
+ make_machines_name = NULL;
+ }
++ /*
+ if ((pmake_max_jobs = read_make_machines(make_machines_name)) <= 0) {
+ pmake_max_jobs = PMAKE_DEF_MAX_JOBS;
+ }
++ */
++ pmake_max_jobs = PMAKE_DEF_MAX_JOBS;
++
+ }
+ #ifdef DISTRIBUTED
+ if (send_mtool_msgs) {
+@@ -1784,6 +1792,7 @@ add_running(Name target, Name true_target, Property command, int recursion_level
+ rp->true_target = true_target;
+ rp->command = command;
+ Property spro_val = get_prop(sunpro_dependencies->prop, macro_prop);
++/*
+ if(spro_val) {
+ rp->sprodep_value = spro_val->body.macro.value;
+ spro_val->body.macro.value = NULL;
+@@ -1793,6 +1802,7 @@ add_running(Name target, Name true_target, Property command, int recursion_level
+ spro_val->body.env_mem.value = NULL;
+ }
+ }
++*/
+ rp->recursion_level = recursion_level;
+ rp->do_get = do_get;
+ rp->implicit = implicit;
+diff --git a/src/make_src/Make/bin/make/smake/src/Variant.mk b/src/make_src/Make/bin/make/smake/src/Variant.mk
+index b895e79..3c9169c 100644
+--- a/src/make_src/Make/bin/make/smake/src/Variant.mk
++++ b/src/make_src/Make/bin/make/smake/src/Variant.mk
+@@ -53,6 +53,7 @@ MORE_SRC = \
+ main.cc \
+ misc.cc \
+ nse_printdep.cc \
++ parallel.cc \
+ read.cc \
+ read2.cc \
+ rep.cc \
+@@ -63,7 +64,8 @@ CPPFLAGS += -I$(PKG_TOP)/include
+ LDLIB += \
+ -lnsl \
+ -lsocket \
+- -lw
++ -lw \
++ -lumem
+
+ HDRS_DIR = $(PKG_TOP)/include/mk
+ HDRS_LIST = $(HDRS_DIR)/copyright.h $(HDRS_DIR)/defs.h
+@@ -114,12 +116,16 @@ HDRSDIR = $(DESTDIR)/$(PREFIX)/share/lib/make
+ HDRFILE = make.rules
+ VHDRFILE = svr4.make.rules
+ SMAKEDIR = $(DESTDIR)/$(PREFIX)/ccs/bin
++DMAKEDIR = $(DESTDIR)/$(PREFIX)/bin
+
+ install-make-bin: make
+ $(INSTALL) -d $(SMAKEDIR)
+ $(INSTALL) make $(SMAKEDIR)
+ mcs -d $(SMAKEDIR)/make
+ mcs -a '@(#)$(VERSTRING)' $(SMAKEDIR)/make
++ $(INSTALL) -d $(DMAKEDIR)
++ rm -f $(DMAKEDIR)/dmake
++ ln $(SMAKEDIR)/make $(DMAKEDIR)/dmake
+
+ install-make-hdrs: $(HDR) $(VHDR)
+ $(INSTALL) -d $(HDRSDIR)
+diff --git a/src/make_src/Make/lib/mksdmsi18n/src/libmksdmsi18n_init.cc b/src/make_src/Make/lib/mksdmsi18n/src/libmksdmsi18n_init.cc
+index e234125..31faba6 100644
+--- a/src/make_src/Make/lib/mksdmsi18n/src/libmksdmsi18n_init.cc
++++ b/src/make_src/Make/lib/mksdmsi18n/src/libmksdmsi18n_init.cc
+@@ -43,8 +43,14 @@ libmksdmsi18n_init()
+ {
+ char name[20];
+
++ /*
++ * We don't have any messages anymore. That's just how it rolls. Because
++ * this happens on every job and has the word error inside of it,
++ * nightly ends up seeing these as fatal errors.
++ */
+ if (getenv(NOCATGETS("NLSPATH")) == NULL) {
+- fprintf(stderr, NOCATGETS("Internal error: Set NLSPATH before opening catalogue file\n"));
++/* fprintf(stderr, NOCATGETS("Internal error: Set NLSPATH before
++ * opening catalogue file\n")); */
+ return 1;
+ }
+ sprintf(name, NOCATGETS("libmksdmsi18n_%d"), I18N_VERSION);
+diff --git a/src/make_src/Make/lib/mksh/src/dosys.cc b/src/make_src/Make/lib/mksh/src/dosys.cc
+index fc4306b..1211caf 100644
+--- a/src/make_src/Make/lib/mksh/src/dosys.cc
++++ b/src/make_src/Make/lib/mksh/src/dosys.cc
+@@ -41,7 +41,9 @@
+ #include <avo/avo_alloca.h> /* alloca() */
+
+ #if defined(TEAMWARE_MAKE_CMN) || defined(MAKETOOL) /* tolik */
+-# include <avo/strings.h> /* AVO_STRDUP() */
++/* # include <avo/strings.h> */ /* AVO_STRDUP() */
++#include <strings.h>
++#define AVO_STRDUP strdup
+ #if defined(DISTRIBUTED)
+ # include <dm/Avo_CmdOutput.h>
+ # include <rw/xdrstrea.h>
+diff --git a/src/make_src/Make/lib/mksh/src/mksh.cc b/src/make_src/Make/lib/mksh/src/mksh.cc
+index 98c9601..8004ac2 100644
+--- a/src/make_src/Make/lib/mksh/src/mksh.cc
++++ b/src/make_src/Make/lib/mksh/src/mksh.cc
+@@ -38,7 +38,7 @@
+ * Included files
+ */
+ #if defined(TEAMWARE_MAKE_CMN) || defined(MAKETOOL) /* tolik */
+-# include <avo/util.h>
++/* # include <avo/util.h> */
+ #endif
+
+ #include <mksh/dosys.h> /* redirect_io() */
+diff --git a/src/make_src/rules/master.mk b/src/make_src/rules/master.mk
+index f113efe..3d3cb57 100644
+--- a/src/make_src/rules/master.mk
++++ b/src/make_src/rules/master.mk
+@@ -58,7 +58,8 @@ YACC = /usr/ccs/bin/yacc
+
+ CPPFLAGS += -DINTER \
+ -I$(TOP)/include \
+- -DPREFIX=$(PREFIX)
++ -DPREFIX=$(PREFIX) \
++ -DTEAMWARE_MAKE_CMN
+
+ LINTFLAGS += -buxz
+
+--
+1.7.7.2
+
View
25 make/install.patch
@@ -0,0 +1,25 @@
+From cbae8009101a7841c907df4e17d56ed332758a46 Mon Sep 17 00:00:00 2001
+From: Robert Mustacchi <rm@joyent.com>
+Date: Sun, 17 Mar 2013 20:38:54 +0000
+Subject: [PATCH] Use pkgsrc install(1)
+
+---
+ src/make_src/rules/solaris.mk | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/make_src/rules/solaris.mk b/src/make_src/rules/solaris.mk
+index d5ef1a4..c06bfb8 100644
+--- a/src/make_src/rules/solaris.mk
++++ b/src/make_src/rules/solaris.mk
+@@ -42,7 +42,7 @@ SWHOME =
+ # Programs
+ #
+ #CC = cc
+-INSTALL = /usr/ucb/install
++INSTALL = /opt/local/bin/install
+ RPCGEN = /usr/5bin/rpcgen
+
+ #
+--
+1.7.7.2
+
View
351 make/prefix.patch
@@ -0,0 +1,351 @@
+From cb159d83ea69804861fdb85ae9a49e5537cc1d9e 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
+
+---
+ src/build | 17 +++-
+ 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(-)
+
+diff --git a/src/build b/src/build
+index 967f5af..65e0603 100755
+--- a/src/build
++++ b/src/build
+@@ -40,6 +40,7 @@
+ # CC $CC -c x.c preferred C compiler
+ # CCC $CCC -c x.cc preferred C++ compiler
+ # MAKE $MAKE {target} preferred "make" executable
++# PREFIX /usr the target path in the fs
+ # DESTDIR $DESTDIR/usr/ccs root of installation tree
+
+ # Legal arguments are "clean", "all", and "install". The default
+@@ -87,6 +88,11 @@ endif
+ setenv CC64 $CC
+ setenv CCC64 $CCC
+
++if ( ! $?PREFIX ) then
++ setenv PREFIX /usr
++endif
++
++
+ if ( ! $?DESTDIR ) then
+ setenv DESTDIR ../../destdir/root_`uname -p`
+ endif
+@@ -113,15 +119,16 @@ echo Using variables:
+ echo
+ echo ' 'CC = $CC
+ echo ' 'CCC = $CCC
++echo ' 'PREFIX = $PREFIX
+ echo ' 'DESTDIR = $DESTDIR
+ echo ' 'MAKE = $MAKE
+ echo ' 'STUDIOBIN = $STUDIOBIN
+ echo
+-$MAKE CC=${CC} CCC=${CCC} DESTDIR=${DESTDIR} MAKE=${MAKE} $args
++$MAKE CC=${CC} CCC=${CCC} DESTDIR=${DESTDIR} MAKE=${MAKE} PREFIX=${PREFIX} $args
+ echo
+ echo === build complete ===
+ echo
+-echo Binaries installed at $DESTDIR':'
+-echo
+-cd $DESTDIR
+-find . -type f -print | sed 's/^/ /'
++echo Binaries installed at $DESTDIR'/'$PREFIX':'
++#echo
++#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
+--- 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();
+ /*
+ * Defined macros
+ */
+-#define LD_SUPPORT_ENV_VAR NOCATGETS("SGS_SUPPORT")
++#define LD_SUPPORT_ENV_VAR NOCATGETS("SGS_SUPPORT_32")
++#define LD_SUPPORT_ENV_VAR_32 NOCATGETS("SGS_SUPPORT_32")
++#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")
++
++#ifdef PREFIX
++#define MTOSTR(x) #x
++#define XMTOSTR(x) MTOSTR(x)
++#define MAKE_PREFIX XMTOSTR(PREFIX)
++#else
++#error "PREFIX environment variable should be defined"
++#endif
+
+ /*
+ * typedefs & structs
+@@ -2070,26 +2082,53 @@ 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.
++ *
++ * In the new world we always will set the 32-bit and 64-bit versions of this
++ * variable explicitly so that we can take into account the correct isa and our
++ * prefix. So say that the prefix was /opt/local. Then we would want to search
++ * /opt/local/lib/libmakestate.so.1:libmakestate.so.1. We still want to search
++ * the original location just as a safety measure.
+ */
+ static void
+ set_sgs_support()
+ {
+ int len;
+- char *newpath;
+- char *oldpath;
+- static char *prev_path;
++ char *newpath, *newpath64;
++ char *oldpath, *oldpath64;
++ static char *prev_path, *prev_path64;
+
+- oldpath = getenv(LD_SUPPORT_ENV_VAR);
++ oldpath = getenv(LD_SUPPORT_ENV_VAR_32);
+ 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",
++ 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);
+ } 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",
++ 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);
++ }
++
++ oldpath64 = getenv(LD_SUPPORT_ENV_VAR_64);
++ if (oldpath64 == NULL) {
++ len = snprintf(NULL, 0, "%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("%s%s%s/%s:%s",
++ newpath, MAKE_PREFIX, LD_SUPPORT_MAKE_LIB_DIR,
++ LD_SUPPORT_MAKE_LIB, LD_SUPPORT_MAKE_LIB) + 1;
+ } 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("%s%s%s/%s:%s",
++ newpath64, MAKE_PREFIX, 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;
++
+ }
+ #endif
+ putenv(newpath);
+@@ -2110,6 +2168,12 @@ set_sgs_support()
+ free(prev_path);
+ }
+ prev_path = newpath;
++
++ putenv(newpath64);
++ if (prev_path64) {
++ free(prev_path64);
++ }
++ prev_path64 = newpath64;
+ }
+
+ /*
+diff --git a/src/make_src/Make/bin/make/common/read.cc b/src/make_src/Make/bin/make/common/read.cc
+index 586d609..626d736 100644
+--- a/src/make_src/Make/bin/make/common/read.cc
++++ b/src/make_src/Make/bin/make/common/read.cc
+@@ -52,6 +52,14 @@
+ extern "C" Avo_err *avo_find_run_dir(char **dirp);
+ #endif
+
++#ifdef PREFIX
++#define MTOSTR(x) #x
++#define XMTOSTR(x) MTOSTR(x)
++#define MAKE_PREFIX XMTOSTR(PREFIX)
++#else
++#error "PREFIX environment variable should be defined"
++#endif
++
+ /*
+ * typedefs & structs
+ */
+@@ -127,6 +135,10 @@ read_simple_file(register Name makefile_name, register Boolean chase_path, regis
+ char *run_dir, makerules_dir[BUFSIZ];
+ #endif
+
++#if defined(SUN5_0)
++ char *prefix_dir;
++#endif
++
+ wchar_t * wcb = get_wstring(makefile_name->string_mb);
+
+ #ifdef NSE
+@@ -156,6 +168,14 @@ read_simple_file(register Name makefile_name, register Boolean chase_path, regis
+ &makefile_path,
+ -1);
+ #ifdef SUN5_0
++
++ (void) asprintf(&prefix_dir,
++ NOCATGETS("%s/share/lib/make"),
++ MAKE_PREFIX);
++ add_dir_to_path(prefix_dir,
++ &makefile_path,
++ -1);
++ free(prefix_dir);
+ add_dir_to_path(NOCATGETS("/usr/share/lib/make"),
+ &makefile_path,
+ -1);
+diff --git a/src/make_src/Make/bin/make/make.svr4/Makefile b/src/make_src/Make/bin/make/make.svr4/Makefile
+index 96000a3..2bdf786 100644
+--- a/src/make_src/Make/bin/make/make.svr4/Makefile
++++ b/src/make_src/Make/bin/make/make.svr4/Makefile
+@@ -30,9 +30,9 @@ include $(TOP)/rules/master.mk
+ all clean clobber l10n_install:
+
+ install:
+- $(INSTALL) -d $(DESTDIR)/usr/lib
+- $(INSTALL) -d $(DESTDIR)/usr/ccs/lib
+- rm -f $(DESTDIR)/usr/lib/svr4.make
+- rm -f $(DESTDIR)/usr/ccs/lib/svr4.make
+- ln $(DESTDIR)/usr/ccs/bin/make $(DESTDIR)/usr/lib/svr4.make
+- (cd $(DESTDIR)/usr/ccs/lib; ln -s ../../lib/svr4.make svr4.make)
++ $(INSTALL) -d $(DESTDIR)/$(PREFIX)/lib
++ $(INSTALL) -d $(DESTDIR)/$(PREFIX)/ccs/lib
++ rm -f $(DESTDIR)/$(PREFIX)/lib/svr4.make
++ rm -f $(DESTDIR)/$(PREFIX)/ccs/lib/svr4.make
++ ln $(DESTDIR)/$(PREFIX)/ccs/bin/make $(DESTDIR)/$(PREFIX)/lib/svr4.make
++ (cd $(DESTDIR)/$(PREFIX)/ccs/lib; ln -s ../../lib/svr4.make svr4.make)
+diff --git a/src/make_src/Make/bin/make/make.xpg4/Makefile b/src/make_src/Make/bin/make/make.xpg4/Makefile
+index 6688c9d..77f4b37 100644
+--- a/src/make_src/Make/bin/make/make.xpg4/Makefile
++++ b/src/make_src/Make/bin/make/make.xpg4/Makefile
+@@ -31,6 +31,6 @@ include $(TOP)/rules/master.mk
+ all clean clobber l10n_install:
+
+ install:
+- $(INSTALL) -d $(DESTDIR)/usr/xpg4/bin
+- rm -f $(DESTDIR)/usr/xpg4/bin/make
+- ln $(DESTDIR)/usr/ccs/bin/make $(DESTDIR)/usr/xpg4/bin/make
++ $(INSTALL) -d $(DESTDIR)/$(PREFIX)/xpg4/bin
++ rm -f $(DESTDIR)/$(PREFIX)/xpg4/bin/make
++ ln $(DESTDIR)/$(PREFIX)/ccs/bin/make $(DESTDIR)/$(PREFIX)/xpg4/bin/make
+diff --git a/src/make_src/Make/bin/make/smake/src/Variant.mk b/src/make_src/Make/bin/make/smake/src/Variant.mk
+index c2e5f64..b895e79 100644
+--- a/src/make_src/Make/bin/make/smake/src/Variant.mk
++++ b/src/make_src/Make/bin/make/smake/src/Variant.mk
+@@ -110,10 +110,10 @@ IHDR = make.rules.file
+ VIHDR = svr4.make.rules.file
+ HDR = ${PKG_TOP}/bin/make/common/make.rules.file
+ VHDR = ${PKG_TOP}/bin/make/common/svr4.make.rules.file
+-HDRSDIR = $(DESTDIR)/usr/share/lib/make
++HDRSDIR = $(DESTDIR)/$(PREFIX)/share/lib/make
+ HDRFILE = make.rules
+ VHDRFILE = svr4.make.rules
+-SMAKEDIR = $(DESTDIR)/usr/ccs/bin
++SMAKEDIR = $(DESTDIR)/$(PREFIX)/ccs/bin
+
+ install-make-bin: make
+ $(INSTALL) -d $(SMAKEDIR)
+@@ -137,7 +137,7 @@ MAKE_MSG = SUNW_SPRO_MAKE.msg
+ I18N_DIRS = ../../common
+ TEXTDOMAIN = SUNW_SPRO_MAKE
+ APPPATH = $(PKG_TOP)/bin/make/smake/$(VARIANT)
+-LIB_DESTDIR = $(DESTDIR)/usr/lib
++LIB_DESTDIR = $(DESTDIR)/$(PREFIX)/lib
+ CAT_DESTDIR = $(LIB_DESTDIR)/locale/C/LC_MESSAGES
+
+ $(CAT_DESTDIR):
+diff --git a/src/make_src/Make/lib/makestate/src/Variant.mk b/src/make_src/Make/lib/makestate/src/Variant.mk
+index 26971d5..a961615 100644
+--- a/src/make_src/Make/lib/makestate/src/Variant.mk
++++ b/src/make_src/Make/lib/makestate/src/Variant.mk
+@@ -68,6 +68,12 @@ $(DLIBNAME) : $(LIBNAME)
+ all: $(DLIBNAME)
+
+ install: all
+- ${INSTALL} -d ${DESTDIR}/usr/lib$(VAR_DIR)
+- ${RM} ${DESTDIR}/usr/lib$(VAR_DIR)/$(DLIBNAME)
+- ${INSTALL} $(DLIBNAME) ${DESTDIR}/usr/lib$(VAR_DIR)
++ ${INSTALL} -d ${DESTDIR}/${PREFIX}/lib/$(VAR_DIR)
++ ${RM} ${DESTDIR}/${PREFIX}/lib$(VAR_DIR)/$(DLIBNAME)
++ ${INSTALL} $(DLIBNAME) ${DESTDIR}/${PREFIX}/lib$(VAR_DIR)
++ if [[ -n "$(VAR_DIR)" && ! -h "${DESTDIR}/${PREFIX}/lib/64" ]]; then \
++ cd ${DESTDIR}/${PREFIX}/lib; \
++ ln -s $$(basename $(VAR_DIR)) 64; \
++ else \
++ /bin/true; \
++ fi
+diff --git a/src/make_src/rules/derived.mk b/src/make_src/rules/derived.mk
+index 89fd719..859d2e2 100644
+--- a/src/make_src/rules/derived.mk
++++ b/src/make_src/rules/derived.mk
+@@ -61,6 +61,6 @@ $(VARIANT) $(V9_VARIANT): FRC
+ if [ ! -d $@ ]; then \
+ mkdir $@ ; \
+ fi
+- cd $@; $(MAKE) $(MFLAGS) -f $(SRC)/Variant.mk RELEASE_VER="$(RELEASE_VER)" DESTDIR=$(DESTDIR) V9FLAGS="$(V9FLAGS)" VAR_DIR=$(VAR_DIR) CC=$(CC) CCC=$(CCC) $(TARG);
++ cd $@; $(MAKE) $(MFLAGS) -f $(SRC)/Variant.mk RELEASE_VER="$(RELEASE_VER)" DESTDIR=$(DESTDIR) PREFIX=$(PREFIX) V9FLAGS="$(V9FLAGS)" VAR_DIR=$(VAR_DIR) CC=$(CC) CCC=$(CCC) $(TARG);
+
+ FRC:
+diff --git a/src/make_src/rules/master.mk b/src/make_src/rules/master.mk
+index eae7f19..f113efe 100644
+--- a/src/make_src/rules/master.mk
++++ b/src/make_src/rules/master.mk
+@@ -57,7 +57,8 @@ YACC = /usr/ccs/bin/yacc
+ ##-----------------------------------------------------------------
+
+ CPPFLAGS += -DINTER \
+- -I$(TOP)/include
++ -I$(TOP)/include \
++ -DPREFIX=$(PREFIX)
+
+ LINTFLAGS += -buxz
+
+--
+1.7.7.2
+
Please sign in to comment.
Something went wrong with that request. Please try again.