CC="$(CL)"
LD="$(LINK)"
-all: $(BUILD_DIR) generated_files $(EXT_TARGETS) $(SAPI_TARGETS)
+all: $(BUILD_DIR) $(BUILD_DIRS_SUB) generated_files $(EXT_TARGETS) $(SAPI_TARGETS)
generated_files: Zend\zend_ini_parser.c \
Zend\zend_language_parser.c Zend\zend_ini_scanner.c \
Zend\zend_language_scanner.c \
+ ext\standard\parsedate.c \
$(PHPDEF)
-win32\phpts.def: $(PHP_DLL_DEF_SOURCES)
- type $(PHP_DLL_DEF_SOURCES) > win32\phpts.def
+$(BUILD_DIR)\$(PHPDLL).def: $(PHP_DLL_DEF_SOURCES)
+ type $(PHP_DLL_DEF_SOURCES) > $(BUILD_DIR)\$(PHPDLL).def
Zend\zend_ini_parser.c Zend\zend_ini_parser.h: Zend\zend_ini_parser.y
- bison --output=Zend/zend_ini_parser.c -v -d -p ini_ Zend/zend_ini_parser.y
+ $(BISON) --output=Zend/zend_ini_parser.c -v -d -p ini_ Zend/zend_ini_parser.y
Zend\zend_language_parser.c Zend\zend_language_parser.h: Zend\zend_language_parser.y
- bison --output=Zend/zend_language_parser.c -v -d -p zend Zend/zend_language_parser.y
+ $(BISON) --output=Zend/zend_language_parser.c -v -d -p zend Zend/zend_language_parser.y
Zend\zend_ini_scanner.c: Zend\flex.skl Zend\zend_ini_scanner.l
- flex -B -i -SZend/flex.skl -Pini_ -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l
+ $(FLEX) -B -i -SZend/flex.skl -Pini_ -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l
Zend\zend_language_scanner.c: Zend\flex.skl Zend\zend_language_scanner.l
- flex -i -SZend/flex.skl -Pzend -oZend/zend_language_scanner.c Zend/zend_language_scanner.l
+ $(FLEX) -i -SZend/flex.skl -Pzend -oZend/zend_language_scanner.c Zend/zend_language_scanner.l
ext\standard\parsedate.c ext\standard\parsedate.h: ext\standard\parsedate.y
- bison --output=ext/standard/parsedate.c -v -d ext/standard/parsedate.y
+ $(BISON) --output=ext/standard/parsedate.c -v -d ext/standard/parsedate.y
PHPDLL_RES=$(BUILD_DIR)\$(PHPDLL).res
$(BUILD_DIR)\$(PHPLIB): $(BUILD_DIR)\$(PHPDLL)
-$(BUILD_DIR):
- mkdir $(BUILD_DIR)
- for %D in ($(BUILD_DIRS_SUB)) do mkdir %D
+$(BUILD_DIR) $(BUILD_DIRS_SUB):
+ @echo Recreating build dirs
+ @if not exist $(BUILD_DIR) mkdir $(BUILD_DIR)
+ @for %D in ($(BUILD_DIRS_SUB)) do @if not exist %D @mkdir %D > NUL
clean-sapi:
- for %D in ($(EXT_TARGETS) $(SAPI_TARGETS)) do del /F /Q $(BUILD_DIR)\%D
- del /F /Q $(BUILD_DIR)\$(PHPDLL)
+ @echo Cleaning SAPI
+ @for %D in ($(EXT_TARGETS) $(SAPI_TARGETS)) do @del /F /Q $(BUILD_DIR)\%D > NUL
+ @del /F /Q $(BUILD_DIR)\$(PHPDLL)
clean: clean-sapi
- for %D in ($(BUILD_DIRS_SUB)) do del /F /Q %D\*.*
- del /F /Q $(BUILD_DIR)\*.res $(BUILD_DIR)\*.lib $(BUILD_DIR)\*.ilk $(BUILD_DIR)\*.pdb $(BUILD_DIR)\*.exp
+ @echo Cleaning
+ @for %D in ($(BUILD_DIRS_SUB)) do @del /F /Q %D\*.* > NUL
+ @del /F /Q $(BUILD_DIR)\*.res $(BUILD_DIR)\*.lib $(BUILD_DIR)\*.ilk $(BUILD_DIR)\*.pdb $(BUILD_DIR)\*.exp $(PHPDEF) $(BUILD_DIR)\php-$(PHP_VERSION_STRING).zip > NUL
+ -rmdir /s /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING)
test:
<<test_suite_uses_lame_env_vars.bat
<<NOKEEP
dist: all
+ -rmdir /s /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING)
+ -del /f /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING).zip
$(BUILD_DIR)\php.exe win32/build/mkdist.php "$(BUILD_DIR)" "$(PHPDLL)" "$(SAPI_TARGETS)" "$(EXT_TARGETS)" "$(SNAPSHOT_TEMPLATE)"
+ cd $(BUILD_DIR)\php-$(PHP_VERSION_STRING)
+ -$(ZIP) -9 -r ..\php-$(PHP_VERSION_STRING).zip .
+ cd ..\..
+
+msi-installer: dist
+ $(BUILD_DIR)\php.exe ..\php-installer\build-installer.php "$(BUILD_DIR)" "$(PHPDLL)" "$(SAPI_TARGETS)" "$(EXT_TARGETS)"
// "Master" config file; think of it as a configure.in
// equivalent.
+ARG_WITH('cygwin', 'Path to cygwin utilities on your system', '\\cygwin');
+
PATH_PROG('cl');
PATH_PROG('link');
PATH_PROG('nmake');
-PATH_PROG('make');
+PATH_PROG('bison');
+PATH_PROG('flex');
+PATH_PROG('re2c');
+PATH_PROG('zip');
+PATH_PROG('lemon');
// one-shot build optimizes build by asking compiler to build
// several objects at once, reducing overhead of starting new
/D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS");
// General link flags
-DEFINE("LDFLAGS", "/nologo /libpath:$(PHP_BUILD)\\lib");
+DEFINE("LDFLAGS", "/nologo /libpath:$(PHP_BUILD)\\lib /version:" +
+ PHP_VERSION + "." + PHP_MINOR_VERSION + "." + PHP_RELEASE_VERSION);
// General DLL link flags
-DEFINE("DLL_LDFLAGS", "/dll /version:" + PHP_VERSION);
+DEFINE("DLL_LDFLAGS", "/dll ");
// PHP DLL link flags
DEFINE("PHP_LDFLAGS", "$(DLL_LDFLAGS)");
// General libs
-DEFINE("LIBS", "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib \
-advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib \
-ws2_32.lib urlmon.lib resolv.lib");
+// urlmon.lib ole32.lib oleaut32.lib uuid.lib gdi32.lib winspool.lib comdlg32.lib
+DEFINE("LIBS", "kernel32.lib ole32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib resolv.lib");
// Set some debug/release specific options
if (PHP_DEBUG == "yes") {
p = p.replace(new RegExp("include$"), "lib");
ADD_FLAG("LDFLAGS", '/libpath:"' + p + '" ');
php_usual_lib_suspects += ";" + p;
+ } else if (!p) {
+ ERROR("We really need that arpa\\nameser.h file - it is part of the win32build package");
}
}
{
var path, i, f;
- path = PHP_EXTRA_INCLUDES.split(';');
- for (i = 0; i < path.length; i++) {
- f = FSO.GetAbsolutePathName(path[i]);
- if (FSO.FolderExists(f)) {
- ADD_FLAG("CFLAGS", '/I "' + f + '" ');
+ if (PHP_EXTRA_INCLUDES.length) {
+ path = PHP_EXTRA_INCLUDES.split(';');
+ for (i = 0; i < path.length; i++) {
+ f = FSO.GetAbsolutePathName(path[i]);
+ if (FSO.FolderExists(f)) {
+ ADD_FLAG("CFLAGS", '/I "' + f + '" ');
+ }
}
- }
- path = PHP_EXTRA_LIBS.split(';');
- for (i = 0; i < path.length; i++) {
- f = FSO.GetAbsolutePathName(path[i]);
- if (FSO.FolderExists(f)) {
- ADD_FLAG("LDFLAGS", '/libpath:"' + f + '" ');
+ }
+ if (PHP_EXTRA_LIBS.length) {
+ path = PHP_EXTRA_LIBS.split(';');
+ for (i = 0; i < path.length; i++) {
+ f = FSO.GetAbsolutePathName(path[i]);
+ if (FSO.FolderExists(f)) {
+ ADD_FLAG("LDFLAGS", '/libpath:"' + f + '" ');
+ }
}
- }
+ }
}
+----------------------------------------------------------------------+
*/
-// $Id: confutils.js,v 1.19 2003-12-07 02:58:56 wez Exp $
+// $Id: confutils.js,v 1.20 2003-12-19 12:50:11 wez Exp $
var STDOUT = WScript.StdOut;
var STDERR = WScript.StdErr;
WScript.Quit(10);
}
-// TODO: pick this up from configure.in
+/* defaults; we pick up the precise versions from configure.in */
var PHP_VERSION = 5;
+var PHP_MINOR_VERSION = 0;
+var PHP_RELEASE_VERSION = 0;
+var PHP_EXTRA_VERSION = "";
+var PHP_VERSION_STRING = "5.0.0";
+
+function get_version_numbers()
+{
+ var cin = file_get_contents("configure.in");
+
+ if (cin.match(new RegExp("MAJOR_VERSION=(\\d+)"))) {
+ PHP_VERSION = RegExp.$1;
+ }
+ if (cin.match(new RegExp("MINOR_VERSION=(\\d+)"))) {
+ PHP_MINOR_VERSION = RegExp.$1;
+ }
+ if (cin.match(new RegExp("RELEASE_VERSION=(\\d+)"))) {
+ PHP_RELEASE_VERSION = RegExp.$1;
+ }
+ PHP_VERSION_STRING = PHP_VERSION + "." + PHP_MINOR_VERSION + "." + PHP_RELEASE_VERSION;
+
+ if (cin.match(new RegExp("EXTRA_VERSION=\"([^\"]+)\""))) {
+ PHP_EXTRA_VERSION = RegExp.$1;
+ if (PHP_EXTRA_VERSION.length) {
+ PHP_VERSION_STRING += PHP_EXTRA_VERSION;
+ }
+ }
+ DEFINE('PHP_VERSION_STRING', PHP_VERSION_STRING);
+}
configure_args = new Array();
configure_subst = WScript.CreateObject("Scripting.Dictionary");
extension_include_code = "";
extension_module_ptrs = "";
+get_version_numbers();
+
function condense_path(path)
{
var cd = WshShell.CurrentDirectory;
(path.charCodeAt(cd.length) == 92 || path.charCodeAt(cd.length) == 47)) {
return path.substr(cd.length + 1);
}
+
+ var a = cd.split("\\");
+ var b = path.split("\\");
+ var i, j;
+
+ for (i = 0; i < b.length; i++) {
+ if (a[i].toLowerCase() == b[i].toLowerCase())
+ continue;
+ if (i > 0) {
+ /* first difference found */
+ path = "";
+ for (j = 0; j < a.length - i; j++) {
+ path += "..\\";
+ }
+ for (j = i; j < b.length; j++) {
+ path += b[j];
+ if (j < b.length - 1)
+ path += "\\";
+ }
+ return path;
+ }
+ /* on a different drive */
+ break;
+ }
+
return path;
}
return place;
}
-function PATH_PROG(progname, def, additional_paths)
+function PATH_PROG(progname, additional_paths)
{
var exe;
var place;
+ var cyg_path = PHP_CYGWIN + "\\bin;" + PHP_CYGWIN + "\\usr\\local\\bin";
exe = progname + ".exe";
+ if (additional_paths == null) {
+ additional_paths = cyg_path;
+ } else {
+ additional_paths += ";" + cyg_path;
+ }
+
place = search_paths(exe, additional_paths, "PATH");
if (place == true) {
place = exe;
+ } else if (place != false) {
+ place = place + "\\" + exe;
}
if (place) {
}
-function CHECK_HEADER_ADD_INCLUDE(header_name, flag_name, path_to_check, use_env)
+function CHECK_HEADER_ADD_INCLUDE(header_name, flag_name, path_to_check, use_env, add_dir_part)
{
+ var dir_part_to_add = "";
+
if (use_env == null) {
use_env = true;
}
+ // if true, add the dir part of the header_name to the include path
+ if (add_dir_part == null) {
+ add_dir_part = false;
+ } else if (add_dir_part) {
+ var basename = FSO.GetFileName(header_name);
+ dir_part_to_add = "\\" + header_name.substr(0, header_name.length - basename.length - 1);
+ }
+
if (path_to_check == null) {
path_to_check = php_usual_include_suspects;
} else {
var sym;
if (typeof(p) == "string") {
- ADD_FLAG(flag_name, '/I "' + p + '" ');
+ ADD_FLAG(flag_name, '/I "' + p + dir_part_to_add + '" ');
} else if (p == false) {
/* not found in the defaults or the explicit paths,
* so check the general extra includes; if we find
* it here, no need to add another /I for it as we
- * already have it covered */
+ * already have it covered, unless we are adding
+ * the dir part.... */
p = search_paths(header_name, PHP_EXTRA_INCLUDES, null);
+ if (typeof(p) == "string" && add_dir_part) {
+ ADD_FLAG(flag_name, '/I "' + p + dir_part_to_add + '" ');
+ }
}
have = p ? 1 : 0
var res_desc = "PHP " + makefiletarget;
var res_prod_name = res_desc;
var credits;
- var thanks = "";
+ var thanks = null;
var logo = "";
if (FSO.FileExists(creditspath + '/CREDITS')) {
credits = FSO.OpenTextFile(creditspath + '/CREDITS', 1);
res_desc = credits.ReadLine();
- thanks = credits.ReadLine();
+ try {
+ thanks = credits.ReadLine();
+ } catch (e) {
+ thanks = null;
+ }
if (thanks == null) {
thanks = "";
} else {
resname = generate_version_info_resource(makefiletarget, configure_module_dirname);
MFO.WriteLine(makefiletarget + ": $(BUILD_DIR)\\" + makefiletarget);
- MFO.WriteLine("\t@echo SAPI " + configure_module_dirname + "/" + sapiname + " build complete");
+ MFO.WriteLine("\t@echo SAPI " + configure_module_dirname + " build complete");
MFO.WriteLine("$(BUILD_DIR)\\" + makefiletarget + ": $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(BUILD_DIR)\\" + resname);
if (makefiletarget.match(new RegExp("\\.dll$"))) {
ADD_FLAG("STATIC_EXT_LDFLAGS", "$(LDFLAGS_" + EXT + ")");
ADD_FLAG("STATIC_EXT_CFLAGS", "$(CFLAGS_" + EXT + ")");
- /* find the header that declars the module pointer,
+ /* find the header that declares the module pointer,
* so we can include it in internal_functions.c */
var ext_dir = FSO.GetFolder(configure_module_dirname);
var fc = new Enumerator(ext_dir.Files);
var re = new RegExp("\.[a-z0-9A-Z]+$");
dir = dir.replace(new RegExp("/", "g"), "\\");
-
- var mangle_dir = dir.replace(new RegExp("[\\\\/.]", "g"), "_");
-
var objs_line = "";
var srcs_line = "";
var sub_build = "$(BUILD_DIR)\\";
- sub_build += dir + "\\";
+ /* if module dir is not a child of the main source dir,
+ * we need to tweak it; we should have detected such a
+ * case in condense_path and rewritten the path to
+ * be relative.
+ * This probably breaks for non-sibling dirs, but that
+ * is not a problem as buildconf only checks for pecl
+ * as either a child or a sibling */
+ var build_dir = dir.replace(new RegExp("^..\\\\"), "");
- var dirs = dir.split("\\");
+ var mangle_dir = build_dir.replace(new RegExp("[\\\\/.]", "g"), "_");
+ var bd_flags_name = "CFLAGS_BD_" + mangle_dir.toUpperCase();
+
+ var dirs = build_dir.split("\\");
var i, d = "";
for (i = 0; i < dirs.length; i++) {
d += dirs[i];
build_dirs[build_dirs.length] = d;
d += "\\";
}
+ sub_build += d;
- var bd_flags_name = "CFLAGS_BD_" + mangle_dir.toUpperCase();
DEFINE(bd_flags_name, "/Fo" + sub_build + " /Fd" + sub_build + " /Fp" + sub_build + " /FR" + sub_build + " ");
if (configure_subst.Exists(name)) {
var curr_flags = configure_subst.Item(name);
- if (curr_flags.match(flags)) {
+ if (curr_flags.indexOf(flags) >= 0) {
return;
}
function ADD_DEF_FILE(name)
{
if (!configure_subst.Exists("PHPDEF")) {
- DEFINE("PHPDEF", "win32\\phpts.def");
+ DEFINE("PHPDEF", "$(BUILD_DIR)\\$(PHPDLL).def");
ADD_FLAG("PHP_LDFLAGS", "/def:$(PHPDEF)");
}
ADD_FLAG("PHP_DLL_DEF_SOURCES", name);
STDERR.WriteBlankLines(1);
}
+function copy_and_subst(srcname, destname, subst_array)
+{
+ if (!FSO.FileExists(srcname)) {
+ STDOUT.WriteLine("copy_and_subst under " + configure_module_dirname);
+ srcname = configure_module_dirname + "\\" + srcname;
+ destname = configure_module_dirname + "\\" + destname;
+ }
+
+ var content = file_get_contents(srcname);
+ var i;
+
+ for (i = 0; i < subst_array.length; i+=2) {
+ var re = subst_array[i];
+ var rep = subst_array[i+1];
+
+ content = content.replace(re, rep);
+ }
+
+ var f = FSO.CreateTextFile(destname, true);
+ f.Write(content);
+ f.Close();
+}
+