wez Tue Dec 23 10:33:14 2003 EDT
Added files:
/php-src/win32/build deplister.c
Modified files:
/php-src/win32/build Makefile mkdist.php
Log:
implement our own tiny little dependcy tracker and use
it to build distros.
Index: php-src/win32/build/Makefile
diff -u php-src/win32/build/Makefile:1.11 php-src/win32/build/Makefile:1.12
--- php-src/win32/build/Makefile:1.11 Tue Dec 23 00:43:19 2003
+++ php-src/win32/build/Makefile Tue Dec 23 10:33:13 2003
@@ -14,7 +14,7 @@
# | Author: Wez Furlong <[EMAIL PROTECTED]> |
# +----------------------------------------------------------------------+
#
-# $Id: Makefile,v 1.11 2003/12/23 05:43:19 fmk Exp $
+# $Id: Makefile,v 1.12 2003/12/23 15:33:13 wez Exp $
# This is the makefile template for the win32 build
CC="$(CL)"
@@ -85,7 +85,7 @@
for %T in ($(SAPI_TARGETS)) do $(MAKE) /nologo "%T"
for %T in ($(EXT_TARGETS)) do $(MAKE) /nologo "%T"
-build-dist:
+build-dist: $(BUILD_DIR)\deplister.exe
-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)"
@@ -96,10 +96,13 @@
dist: all build-dist
snap: build-snap build-dist
+$(BUILD_DIR)\deplister.exe: win32\build\deplister.c
+ $(CL) /Fo$(BUILD_DIR)\ /Fd$(BUILD_DIR)\ /Fp$(BUILD_DIR)\ /FR$(BUILD_DIR)
-o$(BUILD_DIR)\deplister.exe win32\build\deplister.c imagehlp.lib
+
msi-installer: dist
$(BUILD_DIR)\php.exe ..\php-installer\build-installer.php "$(BUILD_DIR)"
"$(PHPDLL)" "$(SAPI_TARGETS)" "$(EXT_TARGETS)"
install: all
- @copy $(BUILD_DIR)\*.exe $(PHP_PREFIX) /y >null
- @copy $(BUILD_DIR)\*.dll $(PHP_PREFIX) /y >null
-
\ No newline at end of file
+ @copy $(BUILD_DIR)\*.exe $(PHP_PREFIX) /y >nul
+ @copy $(BUILD_DIR)\*.dll $(PHP_PREFIX) /y >nul
+
Index: php-src/win32/build/mkdist.php
diff -u php-src/win32/build/mkdist.php:1.4 php-src/win32/build/mkdist.php:1.5
--- php-src/win32/build/mkdist.php:1.4 Mon Dec 22 17:48:29 2003
+++ php-src/win32/build/mkdist.php Tue Dec 23 10:33:13 2003
@@ -1,4 +1,4 @@
-<?php # $Id: mkdist.php,v 1.4 2003/12/22 22:48:29 wez Exp $
+<?php # $Id: mkdist.php,v 1.5 2003/12/23 15:33:13 wez Exp $
/* piece together a windows binary distro */
$build_dir = $argv[1];
@@ -25,11 +25,6 @@
function get_depends($module)
{
- // skip this for now; working on a more portable solution
- // since VC6 ships with an old version of depends.exe that
- // doesn't have the command line options
- return;
-
static $no_dist = array(
/* windows system dlls that should not be bundled */
'advapi32.dll', 'comdlg32.dll', 'gdi32.dll', 'kernel32.dll',
'ntdll.dll',
@@ -41,6 +36,12 @@
/* apache */
'apachecore.dll',
+ /* apache 2 */
+ 'libhttpd.dll', 'libapr.dll', 'libaprutil.dll',
+
+ /* pi3web */
+ 'piapi.dll', 'pi3api.dll',
+
/* nsapi */
'ns-httpd30.dll', 'ns-httpd35.dll', 'ns-httpd36.dll', 'ns-httpd40.dll',
@@ -60,24 +61,22 @@
$bd = strtolower(realpath($build_dir));
- $csvname = tempnam($GLOBALS['build_dir'], '_dep');
- system("depends.exe /c /f:1 /oc:\"$csvname\" \"$module\"", $retcode);
- $fp = fopen($csvname, "r");
- $headers = fgetcsv($fp);
+ $cmd = "$GLOBALS[build_dir]\\deplister.exe \"$module\"
\"$GLOBALS[build_dir]\"";
+ $proc = proc_open($cmd,
+ array(1 => array("pipe", "w")),
+ $pipes);
+
$n = 0;
- while (($line = fgetcsv($fp))) {
+ while (($line = fgetcsv($pipes[1]))) {
$n++;
- if ($line[0] == 'D')
- continue;
- $dep = strtolower($line[1]);
+ $dep = strtolower($line[0]);
$depbase = basename($dep);
/* ignore stuff in our build dir, but only if it is
- * on of our targets */
- if (0 == strncmp($dep, $bd, strlen($bd)) &&
- (in_array($depbase, $sapi_targets) ||
+ * one of our targets */
+ if (((in_array($depbase, $sapi_targets) ||
in_array($depbase, $ext_targets)) ||
- $depbase == $phpdll) {
+ $depbase == $phpdll) &&
file_exists($GLOBALS['build_dir'] . "/$depbase")) {
continue;
}
/* ignore some well-known system dlls */
@@ -91,8 +90,8 @@
$per_module_deps[basename($module)][] = $dep;
}
- fclose($fp);
- unlink($csvname);
+ fclose($pipes[1]);
+ proc_close($proc);
//echo "Module $module [$n lines]\n";
}
Index: php-src/win32/build/deplister.c
+++ php-src/win32/build/deplister.c
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [EMAIL PROTECTED] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Wez Furlong <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
/* $Id: deplister.c,v 1.1 2003/12/23 15:33:13 wez Exp $ */
/* This little application will list the DLL dependencies for a PE
* module to it's stdout for use by distro/installer building tools */
#include <windows.h>
#include <imagehlp.h>
BOOL CALLBACK StatusRoutine(IMAGEHLP_STATUS_REASON reason,
PSTR image_name, PSTR dll_name,
ULONG va, ULONG param)
{
switch (reason) {
case BindImportModuleFailed:
printf("%s,NOTFOUND\n", dll_name);
return TRUE;
case BindImportModule:
printf("%s,OK\n", dll_name);
return TRUE;
}
return TRUE;
}
/* usage:
* deplister.exe path\to\module.exe path\to\symbols\root
* */
int main(int argc, char *argv[])
{
return BindImageEx(BIND_NO_BOUND_IMPORTS | BIND_NO_UPDATE | BIND_ALL_IMAGES,
argv[1], NULL, argv[2], StatusRoutine);
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php