diff options
Diffstat (limited to 'win32/build/confutils.js')
-rw-r--r-- | win32/build/confutils.js | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/win32/build/confutils.js b/win32/build/confutils.js index ef457ba42b..354b105e35 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -49,7 +49,7 @@ var PHP_TEST_INI_EXT_EXCLUDE = ""; var PHP_MAKEFILE_FRAGMENTS = PHP_SRC_DIR + "\\Makefile.fragments.w32"; -/* Care also about NTDDI_VERSION and _WIN32_WINNT in config.w32.h.in +/* Care also about NTDDI_VERSION and _WIN32_WINNT in config.w32.h.in and manifest. */ var WINVER = "0x0601"; /* 7/2008r2 */ @@ -126,7 +126,7 @@ var PHP_VERSION_STRING = "7.3.0"; function get_version_numbers() { var cin = file_get_contents("configure.ac"); - + if (cin.match(new RegExp("PHP_MAJOR_VERSION=(\\d+)"))) { PHP_VERSION = RegExp.$1; } @@ -228,7 +228,7 @@ function condense_path(path) /* on a different drive */ break; } - + return path; } @@ -243,7 +243,7 @@ function ConfigureArg(type, optname, helptext, defval) this.arg = "--" + type + "-" + optname; this.imparg = "--" + opptype + "-" + optname; } - + this.optname = optname; this.helptext = helptext; this.defval = defval; @@ -290,7 +290,7 @@ function word_wrap_and_indent(indent, text, line_suffix, indent_char) if (text == null) { return ""; } - + var words = text.split(new RegExp("\\s+", "g")); var i = 0; var ret_text = ""; @@ -310,7 +310,7 @@ function word_wrap_and_indent(indent, text, line_suffix, indent_char) for (i = 0; i < indent; i++) { space += indent_char; } - + for (i = 0; i < words.length; i++) { if (this_line.length) { t = this_line + " " + words[i]; @@ -349,7 +349,7 @@ function conf_process_args() var analyzed = false; var nice = "cscript /nologo configure.js "; var disable_all = false; - + args = WScript.Arguments; for (i = 0; i < args.length; i++) { arg = args(i); @@ -478,7 +478,7 @@ can be built that way. \ analyzed = analyze_arg(arg.defval); shared = analyzed[0]; argval = analyzed[1]; - + // Don't trust a default "yes" answer for a non-core module // in a snapshot build if (PHP_SNAPSHOT_BUILD != "no" && argval == "yes" && !shared) { @@ -507,7 +507,7 @@ can be built that way. \ } } } - + if (PHP_SNAPSHOT_BUILD != "no" && argval == "no") { force = true; for (j = 0; j < snapshot_build_exclusions.length; j++) { @@ -810,7 +810,7 @@ function CHECK_LIB(libnames, target, path_to_check, common_name) var i, j, k, libname; var location = false; var path = path_to_check.split(';'); - + for (i = 0; i < libnames.length; i++) { libname = libnames[i]; @@ -883,7 +883,7 @@ function OLD_CHECK_LIB(libnames, target, path_to_check) } else { target = "_" + target.toUpperCase(); } - + if (path_to_check == null) { path_to_check = php_usual_lib_suspects; } else { @@ -962,7 +962,7 @@ function CHECK_FUNC_IN_HEADER(header_name, func_name, path_to_check, add_to_flag return c; } STDOUT.WriteLine("No"); - return false; + return false; } function GREP_HEADER(header_name, regex, path_to_check) @@ -984,7 +984,7 @@ function GREP_HEADER(header_name, regex, path_to_check) if (typeof(p) == "string") { c = file_get_contents(p); } - } + } if (!c) { return false; } @@ -1004,7 +1004,7 @@ function GREP_HEADER(header_name, regex, path_to_check) function CHECK_HEADER_ADD_INCLUDE(header_name, flag_name, path_to_check, use_env, add_dir_part, add_to_flag_only) { var dir_part_to_add = ""; - + if (use_env == null) { use_env = true; } @@ -1022,7 +1022,7 @@ function CHECK_HEADER_ADD_INCLUDE(header_name, flag_name, path_to_check, use_env } else { path_to_check += ";" + php_usual_include_suspects; } - + var p = search_paths(header_name, path_to_check, use_env ? "INCLUDE" : null); var have = 0; var sym; @@ -1039,7 +1039,7 @@ function CHECK_HEADER_ADD_INCLUDE(header_name, flag_name, path_to_check, use_env if (typeof(p) == "string" && add_dir_part) { ADD_FLAG(flag_name, '/I "' + p + dir_part_to_add + '" '); } - } + } have = p ? 1 : 0 sym = header_name.toUpperCase(); @@ -1159,15 +1159,15 @@ function generate_version_info_resource(makefiletarget, basename, creditspath, s MFO.WriteLine("$(BUILD_DIR)\\" + resname + ": $(PHP_DIR)\\build\\template.rc"); MFO.WriteLine("\t" + CMD_MOD1 + "$(RC) /nologo $(BASE_INCLUDES) /I $(PHP_DIR)/include /n /fo $(BUILD_DIR)\\" + resname + logo + debug + ' /d FILE_DESCRIPTION="\\"' + res_desc + '\\"" /d FILE_NAME="\\"' - + makefiletarget + '\\"" /d URL="\\"' + project_url + - '\\"" /d INTERNAL_NAME="\\"' + internal_name + versioning + + + makefiletarget + '\\"" /d URL="\\"' + project_url + + '\\"" /d INTERNAL_NAME="\\"' + internal_name + versioning + '\\"" /d THANKS_GUYS="\\"' + thanks + '\\"" $(PHP_DIR)\\build\\template.rc'); } else { MFO.WriteLine("$(BUILD_DIR)\\" + resname + ": win32\\build\\template.rc"); MFO.WriteLine("\t" + CMD_MOD1 + "$(RC) /nologo $(BASE_INCLUDES) /n /fo $(BUILD_DIR)\\" + resname + logo + debug + ' /d FILE_DESCRIPTION="\\"' + res_desc + '\\"" /d FILE_NAME="\\"' - + makefiletarget + '\\"" /d URL="\\"' + project_url + - '\\"" /d INTERNAL_NAME="\\"' + internal_name + versioning + + + makefiletarget + '\\"" /d URL="\\"' + project_url + + '\\"" /d INTERNAL_NAME="\\"' + internal_name + versioning + '\\"" /d THANKS_GUYS="\\"' + thanks + '\\"" win32\\build\\template.rc'); } MFO.WriteBlankLines(1); @@ -1227,7 +1227,7 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir) resname = generate_version_info_resource(makefiletarget, sapiname, configure_module_dirname, true); manifest_name = generate_version_info_manifest(makefiletarget); - + MFO.WriteLine(makefiletarget + ": $(BUILD_DIR)\\" + makefiletarget); MFO.WriteLine("\t" + CMD_MOD2 + "echo SAPI " + sapiname_for_printing + " build complete"); if (MODE_PHPIZE) { @@ -1247,7 +1247,7 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir) ldflags = "$(LDFLAGS)"; manifest = "-" + CMD_MOD2 + "$(_VC_MANIFEST_EMBED_EXE)"; } - + if (PHP_SANITIZER == "yes") { if (CLANG_TOOLSET) { add_asan_opts("CFLAGS_" + SAPI, "LIBS_" + SAPI, (is_lib ? "ARFLAGS_" : "LDFLAGS_") + SAPI); @@ -1293,7 +1293,7 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir) if (manifest) { MFO.WriteLine("\t" + manifest); } - + DEFINE('CFLAGS_' + SAPI + '_OBJ', '$(CFLAGS_' + SAPI + ')'); if (configure_module_dirname.match("pecl")) { @@ -1313,7 +1313,7 @@ function ADD_DIST_FILE(filename) } else { ADD_FLAG("PHP_EXTRA_DIST_FILES", filename); } -} +} function file_get_contents(filename) { @@ -1423,7 +1423,7 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir) if (force_all_shared()) { shared = true; eval("PHP_" + EXT + "_SHARED = true;"); - } else { + } else { eval("shared = PHP_" + EXT + "_SHARED;"); } } else { @@ -1453,7 +1453,7 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir) MFO.WriteBlankLines(1); ADD_SOURCES(configure_module_dirname, file_list, extname, obj_dir); - + MFO.WriteBlankLines(1); if (shared) { @@ -1507,7 +1507,7 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir) MFO.WriteLine(dllname + ": $(BUILD_DIR)\\" + dllname); MFO.WriteLine("\t" + CMD_MOD2 + "echo EXT " + extname + " build complete"); MFO.WriteBlankLines(1); - + DEFINE('CFLAGS_' + EXT + '_OBJ', '$(CFLAGS_' + EXT + ')'); } else { ADD_FLAG("STATIC_EXT_OBJS", "$(" + EXT + "_GLOBAL_OBJS)"); @@ -1544,9 +1544,9 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir) } } } - + extension_module_ptrs += '\tphpext_' + extname + '_ptr,\r\n'; - + DEFINE('CFLAGS_' + EXT + '_OBJ', '$(CFLAGS_PHP) $(CFLAGS_' + EXT + ')'); } if (MODE_PHPIZE) { @@ -1612,7 +1612,7 @@ function ADD_SOURCES(dir, file_list, target, obj_dir) var _tmp = src.split("\\"); var filename = _tmp.pop(); - + // build the obj out dir and use it as a key var dirname = _tmp.join("\\"); @@ -1638,7 +1638,7 @@ function ADD_SOURCES(dir, file_list, target, obj_dir) var build_dir = (dirname ? obj_dir + "\\" + dirname : obj_dir).replace(new RegExp("^..\\\\"), ""); } - obj = sub_build + build_dir + "\\" + filename.replace(re, ".obj"); + obj = sub_build + build_dir + "\\" + filename.replace(re, ".obj"); if (i > 0) { srcs_line += " " + dir + "\\" + src; @@ -1653,7 +1653,7 @@ function ADD_SOURCES(dir, file_list, target, obj_dir) if (!srcs_by_dir.hasOwnProperty(build_dir)) { srcs_by_dir[build_dir] = []; - } + } /* storing the index from the file_list */ srcs_by_dir[build_dir].push(i); @@ -1683,7 +1683,7 @@ function ADD_SOURCES(dir, file_list, target, obj_dir) if (PHP_ANALYZER == "clang") { var analyzer_base_args = X64 ? "-m64" : "-m32"; var analyzer_base_flags = ""; - + analyzer_base_args += " --analyze"; var vc_ver; @@ -1703,7 +1703,7 @@ function ADD_SOURCES(dir, file_list, target, obj_dir) } else { analyzer_base_flags += " -D _MSC_VER=" + probe_binary(PATH_PROG('cl', null)); } - + if (X64) { analyzer_base_flags += " -D _M_X64 -D _WIN64"; } else { @@ -1727,7 +1727,7 @@ function ADD_SOURCES(dir, file_list, target, obj_dir) "--library=win32\\build\\cppcheck.cfg " + "--library=" + cppcheck_lib + " " + /* "--rule-file=win32\build\cppcheck_rules.xml " + */ - " --std=c89 --std=c++11 " + + " --std=c89 --std=c++11 " + "--quiet --inconclusive --template=vs -j 4 " + "--suppress=unmatchedSuppression " + "--suppressions-list=win32\\build\\cppcheck_suppress.txt "; @@ -1749,9 +1749,9 @@ function ADD_SOURCES(dir, file_list, target, obj_dir) MFO.WriteLine("\t" + CMD_MOD1 + "$(CC) $(" + flags + ") $(CFLAGS) $(" + bd_flags_name + ") /c " + dir + "\\" + src + " /Fo" + sub_build + d + obj); if ("clang" == PHP_ANALYZER) { - MFO.WriteLine("\t" + CMD_MOD1 + "\"$(CLANG_CL)\" " + analyzer_base_args + " $(" + flags + "_ANALYZER) $(CFLAGS_ANALYZER) $(" + bd_flags_name + "_ANALYZER) " + dir + "\\" + src); + MFO.WriteLine("\t" + CMD_MOD1 + "\"$(CLANG_CL)\" " + analyzer_base_args + " $(" + flags + "_ANALYZER) $(CFLAGS_ANALYZER) $(" + bd_flags_name + "_ANALYZER) " + dir + "\\" + src); } else if ("cppcheck" == PHP_ANALYZER) { - MFO.WriteLine("\t\"" + CMD_MOD1 + "$(CPPCHECK)\" " + analyzer_base_args + " $(" + flags + "_ANALYZER) $(CFLAGS_ANALYZER) $(" + bd_flags_name + "_ANALYZER) " + analyzer_base_flags + " " + dir + "\\" + src); + MFO.WriteLine("\t\"" + CMD_MOD1 + "$(CPPCHECK)\" " + analyzer_base_args + " $(" + flags + "_ANALYZER) $(CFLAGS_ANALYZER) $(" + bd_flags_name + "_ANALYZER) " + analyzer_base_flags + " " + dir + "\\" + src); }else if (PHP_ANALYZER == "pvs") { MFO.WriteLine("\t" + CMD_MOD1 + "\"$(PVS_STUDIO)\" --cl-params $(" + flags + ") $(CFLAGS) $(" + bd_flags_name + ") /c " + dir + "\\" + src + " --source-file " + dir + "\\" + src + " --cfg PVS-Studio.conf --errors-off \"V122 V117 V111\" "); @@ -1776,8 +1776,8 @@ function ADD_SOURCES(dir, file_list, target, obj_dir) DEFINE(sym, tv); - /* Generate the object response file and define it to the Makefile. This can be - useful when getting the "command line too long" linker errors. + /* Generate the object response file and define it to the Makefile. This can be + useful when getting the "command line too long" linker errors. TODO pack this into a function when response files are used for other kinds of info. */ var obj_lst_fh = null; if (!FSO.FileExists(obj_lst_fn)) { @@ -1821,11 +1821,11 @@ function generate_internal_functions() var indata; STDOUT.WriteLine("Generating main/internal_functions.c"); - + infile = FSO.OpenTextFile("main/internal_functions.c.in", 1); indata = infile.ReadAll(); infile.Close(); - + indata = indata.replace("@EXT_INCLUDE_CODE@", extension_include_code); indata = indata.replace("@EXT_MODULE_PTRS@", extension_module_ptrs); @@ -2034,7 +2034,7 @@ function generate_tmp_php_ini() if ("shared" != extensions_enabled[i][1]) { continue; } - + var directive = (extensions_enabled[i][2] ? 'zend_extension' : 'extension'); var ext_name = extensions_enabled[i][0]; @@ -2261,11 +2261,11 @@ function generate_config_h() prefix = PHP_PREFIX.replace(new RegExp("\\\\", "g"), "\\\\"); STDOUT.WriteLine("Generating main/config.w32.h"); - + infile = FSO.OpenTextFile("win32/build/config.w32.h.in", 1); indata = infile.ReadAll(); infile.Close(); - + outfile = FSO.CreateTextFile("main/config.w32.h", true); indata = indata.replace(new RegExp("@PREFIX@", "g"), prefix); @@ -2307,7 +2307,7 @@ function generate_config_h() pieces += '" "'; } } - + outfile.WriteLine("#define " + keys[i] + " " + pieces); } @@ -2323,7 +2323,7 @@ function generate_config_h() } } - + outfile.Close(); } @@ -2339,7 +2339,7 @@ function generate_phpize() var MF = FSO.CreateTextFile(dest + "/phpize.js", true); var DEPS = FSO.CreateTextFile(dest + "/ext_deps.js", true); - + prefix = get_define("PHP_PREFIX"); prefix = prefix.replace(new RegExp("/", "g"), "\\"); prefix = prefix.replace(new RegExp("\\\\", "g"), "\\\\"); @@ -2461,7 +2461,7 @@ function handle_analyzer_makefile_flags(fd, key, val) } val = new_val; - if ("clang" == PHP_ANALYZER) { + if ("clang" == PHP_ANALYZER) { val = val.replace(/\/FD /, "") .replace(/\/Fp.+? /, "") .replace(/\/Fo.+? /, "") @@ -2526,7 +2526,7 @@ function generate_makefile() /* \s+\/ eliminates extra whitespace caused when using \ for string continuation, whereby \/ is the start of the next compiler switch */ var val = trim(configure_subst.Item(keys[i])).replace(/\s+\//gm, " /"); - + MF.WriteLine(keys[i] + "=" + val + " "); MF.WriteBlankLines(1); @@ -2554,7 +2554,7 @@ function generate_makefile() MF.WriteLine(" " + CMD_MOD2 + "for %D in ($(INSTALL_HEADERS_DIR)) do " + CMD_MOD2 + "if not exist $(BUILD_DIR_DEV)\\include\\%D mkdir $(BUILD_DIR_DEV)\\include\\%D >nul"); for (i in headers_install) { if (headers_install[i][2] != "") { - MF.WriteLine(" " + CMD_MOD2 + "if not exist $(BUILD_DIR_DEV)\\include\\" + headers_install[i][2] + " mkdir $(BUILD_DIR_DEV)\\include\\" + + MF.WriteLine(" " + CMD_MOD2 + "if not exist $(BUILD_DIR_DEV)\\include\\" + headers_install[i][2] + " mkdir $(BUILD_DIR_DEV)\\include\\" + headers_install[i][2] + ">nul"); MF.WriteLine(" " + CMD_MOD2 + "copy " + headers_install[i][0] + " " + "$(BUILD_DIR_DEV)\\include\\" + headers_install[i][2] + " /y >nul"); } @@ -2632,7 +2632,7 @@ function generate_makefile() FSO.DeleteFile(PHP_MAKEFILE_FRAGMENTS, true); } - MF.Close(); + MF.Close(); } function ADD_FLAG(name, flags, target) @@ -2647,7 +2647,7 @@ function ADD_FLAG(name, flags, target) /* Prefix with a space, thus making sure the current flag is not a substring of some other. It's still not a complete check if - some flags with spaces got added. + some flags with spaces got added. TODO rework to use an array, so direct match can be done. This will also @@ -2656,7 +2656,7 @@ function ADD_FLAG(name, flags, target) if (curr_flags.indexOf(" " + flags) >= 0 || curr_flags.indexOf(flags + " ") >= 0) { return; } - + flags = curr_flags + " " + flags; configure_subst.Remove(name); } @@ -2733,7 +2733,7 @@ function copy_and_subst(srcname, destname, subst_array) content = content.replace(re, rep); } - + var f = FSO.CreateTextFile(destname, true); f.Write(content); f.Close(); @@ -2754,14 +2754,14 @@ function glob(path_pattern) if (FSO.FileExists(path_pattern)) { return new Array(path_pattern); } - + // first, build as much as possible that doesn't have a pattern for (p = 0; p < path_parts.length; p++) { if (path_parts[p].match(is_pat_re)) break; if (p) base += "\\"; - base += path_parts[p]; + base += path_parts[p]; } return _inner_glob(base, p, path_parts); @@ -3125,7 +3125,7 @@ function toolset_is_64() return null != full.match(/x86_64/);*/ /* Even executed within an environment setup with vcvars32.bat, - clang-cl doesn't recognize the arch toolset. But as it needs + clang-cl doesn't recognize the arch toolset. But as it needs the VS environment, checking the arch of cl.exe is correct. */ return probe_binary(PATH_PROG('cl', null), 64); } else if (ICC_TOOLSET) { |