Print this page
make: ship the Joyent patch to enable parallel make (originally from rm)

*** 32,47 **** /* * Included files */ #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/version_string.h> - # include <avo/util.h> /* avo_init() */ - # include <avo/cleanup.h> #endif #include <bsd/bsd.h> /* bsd_signal() */ #ifdef DISTRIBUTED --- 32,41 ----
*** 88,99 **** /* * Defined macros */ ! #define LD_SUPPORT_ENV_VAR NOCATGETS("SGS_SUPPORT") #define LD_SUPPORT_MAKE_LIB NOCATGETS("libmakestate.so.1") /* * typedefs & structs */ --- 82,98 ---- /* * Defined macros */ ! #define MAKE_PREFIX NOCATGETS("/usr") ! #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("/64") /* * typedefs & structs */
*** 129,139 **** #if defined(TEAMWARE_MAKE_CMN) static time_t start_time; static int g_argc; static char **g_argv; - static Avo_cleanup *cleanup = NULL; #endif /* * File table of contents */ --- 128,137 ----
*** 172,182 **** extern FILE* dmake_ofp; extern int rxmPid; extern XDR xdrs_out; #endif #ifdef TEAMWARE_MAKE_CMN ! extern char verstring[]; #endif jmp_buf jmpbuffer; extern nl_catd catd; --- 170,180 ---- extern FILE* dmake_ofp; extern int rxmPid; extern XDR xdrs_out; #endif #ifdef TEAMWARE_MAKE_CMN ! static const char verstring[] = "illumos make"; #endif jmp_buf jmpbuffer; extern nl_catd catd;
*** 227,239 **** int statval; #endif struct stat out_stat, err_stat; hostid = gethostid(); - #ifdef TEAMWARE_MAKE_CMN - avo_get_user(NULL, NULL); // Initialize user name - #endif bsd_signals(); (void) setlocale(LC_ALL, ""); --- 225,234 ----
*** 241,266 **** if (getenv(NOCATGETS("DMAKE_STATISTICS"))) { getname_stat = true; } #endif - - /* - * avo_init() sets the umask to 0. Save it here and restore - * it after the avo_init() call. - */ - #if defined(TEAMWARE_MAKE_CMN) || defined(MAKETOOL) - um = umask(0); - avo_init(argv[0]); - umask(um); - - cleanup = new Avo_cleanup(NOCATGETS("dmake"), argc, argv); - #endif - #if defined(TEAMWARE_MAKE_CMN) catd = catopen(AVO_DOMAIN_DMAKE, NL_CAT_LOCALE); - libcli_init(); #endif // ---> fprintf(stderr, catgets(catd, 15, 666, "--- SUN make ---\n")); --- 236,247 ----
*** 530,574 **** no_parallel = false; } } #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; } #endif /* DISTRIBUTED */ } } #endif #ifdef TEAMWARE_MAKE_CMN parallel_flag = true; ! /* XXX - This is a major hack for DMake/Licensing. */ ! if (getenv(NOCATGETS("DMAKE_CHILD")) == NULL) { ! if (!avo_cli_search_license(argv[0], dmake_exit_callback, TRUE, dmake_message_callback)) { ! /* ! * If the user can not get a TeamWare license, ! * default to serial mode. ! */ ! dmake_mode_type = serial_mode; ! no_parallel = true; ! } else { ! putenv(NOCATGETS("DMAKE_CHILD=TRUE")); ! } ! start_time = time(NULL); ! /* ! * XXX - Hack to disable SIGALRM's from licensing library's ! * setitimer(). ! */ ! value.it_interval.tv_sec = 0; ! value.it_interval.tv_usec = 0; ! value.it_value.tv_sec = 0; ! value.it_value.tv_usec = 0; ! (void) setitimer(ITIMER_REAL, &value, NULL); ! } // // If dmake is running with -t option, set dmake_mode_type to serial. // This is done because doname() calls touch_command() that runs serially. // If we do not do that, maketool will have problems. --- 511,531 ---- no_parallel = false; } } #else if(dmake_mode_type == distributed_mode) { dmake_mode_type = parallel_mode; no_parallel = false; } #endif /* DISTRIBUTED */ } } #endif #ifdef TEAMWARE_MAKE_CMN parallel_flag = true; ! putenv(strdup(NOCATGETS("DMAKE_CHILD=TRUE"))); // // If dmake is running with -t option, set dmake_mode_type to serial. // This is done because doname() calls touch_command() that runs serially. // If we do not do that, maketool will have problems.
*** 872,888 **** make_state_lockfile = NULL; make_state_locked = false; } /* Write .make.state */ write_state_file(1, (Boolean) 1); - - #ifdef TEAMWARE_MAKE_CMN - // Deleting the usage tracking object sends the usage mail - cleanup->set_exit_status(exit_status); - delete cleanup; - #endif - /* #ifdef DISTRIBUTED } #endif */ --- 829,838 ----
*** 1867,1916 **** * * Add the libmakestate.so.1 lib to the env var SGS_SUPPORT * 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. */ static void set_sgs_support() { int len; ! char *newpath; ! char *oldpath; ! static char *prev_path; ! oldpath = getenv(LD_SUPPORT_ENV_VAR); if (oldpath == NULL) { ! len = strlen(LD_SUPPORT_ENV_VAR) + 1 + ! strlen(LD_SUPPORT_MAKE_LIB) + 1; newpath = (char *) malloc(len); ! sprintf(newpath, "%s=", LD_SUPPORT_ENV_VAR); ! } else { ! len = strlen(LD_SUPPORT_ENV_VAR) + 1 + strlen(oldpath) + 1 + ! strlen(LD_SUPPORT_MAKE_LIB) + 1; newpath = (char *) malloc(len); ! sprintf(newpath, "%s=%s", LD_SUPPORT_ENV_VAR, 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); - } else { - sprintf(newpath, "%s:%s", newpath, LD_SUPPORT_MAKE_LIB); - } - #endif putenv(newpath); if (prev_path) { free(prev_path); } prev_path = newpath; } /* * read_files_and_state(argc, argv) * --- 1817,1900 ---- * * Add the libmakestate.so.1 lib to the env var SGS_SUPPORT * 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, *newpath64; ! char *oldpath, *oldpath64; ! static char *prev_path, *prev_path64; ! oldpath = getenv(LD_SUPPORT_ENV_VAR_32); if (oldpath == NULL) { ! 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=%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 = 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:%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:%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) + 1; ! newpath64 = (char *) malloc(len); ! 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 { ! 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; ! 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); } putenv(newpath); if (prev_path) { free(prev_path); } prev_path = newpath; + + putenv(newpath64); + if (prev_path64) { + free(prev_path64); + } + prev_path64 = newpath64; } /* * read_files_and_state(argc, argv) *