From: Wez Furlong Date: Sat, 6 Dec 2003 16:14:03 +0000 (+0000) Subject: Add dist target to makefile that will generate the file layout for X-Git-Tag: php-5.0.0b3RC1~253 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3be2b8d7e478c5ece231124944d2743c0aab5294;p=php Add dist target to makefile that will generate the file layout for a win32 binary distro under build_dir/_dist_. This isn't finalized yet, and you need Edin's distro template. --- diff --git a/win32/build/Makefile b/win32/build/Makefile index 1968267b10..ca7159df13 100644 --- a/win32/build/Makefile +++ b/win32/build/Makefile @@ -71,7 +71,10 @@ clean: clean-sapi test: < "license.txt", + "NEWS" => "news.txt", + "php.ini-dist" => "php.ini-dist", + "php.ini-recommended" => "php.ini-recommended", +); + +foreach ($text_files as $src => $dest) { + copy_text_file($src, $dist_dir . '/' . $dest); +} + +/* general other files */ +$general_files = array( + "win32/install.txt" => "install.txt", + "php.gif" => "php.gif", +); + +foreach ($general_files as $src => $dest) { + copy($src, $dist_dir . '/' . $dest); +} + +/* include a snapshot identifier */ +$branch = "HEAD"; // TODO - determine this from CVS/Entries +$fp = fopen("$dist_dir/snapshot.txt", "w"); +$now = date("r"); +$version = phpversion(); +fwrite($fp, << $deps) { + fprintf($fp, "Module: %s\r\n", $modulename); + fwrite($fp, "===========================\r\n"); + foreach ($deps as $dll) { + fprintf($fp, "\t%s\r\n", basename($dll)); + } + fwrite($fp, "\r\n"); +} +fclose($fp); + +/* Now add those dependencies */ +foreach ($extra_dll_deps as $dll) { + if (!file_exists($dll)) { + /* try template dir */ + $tdll = $snapshot_template . "/dlls/" . basename($dll); + if (!file_exists($tdll)) { + echo "WARNING: distro depends on $dll, but could not find it on your system\n"; + continue; + } + $dll = $tdll; + } + copy($dll, "$dist_dir/dlls/" . basename($dll)); +} + +function copy_dir($source, $dest) +{ + if (!is_dir($dest)) { + if (!mkdir($dest)) { + return false; + } + } + + $d = opendir($source); + while (($f = readdir($d)) !== false) { + if ($f == '.' || $f == '..' || $f == 'CVS') { + continue; + } + $fs = $source . '/' . $f; + $fd = $dest . '/' . $f; + if (is_dir($fs)) { + copy_dir($fs, $fd); + } else { + copy($fs, $fd); + } + } + closedir($d); +} + +/* add extras from the template dir */ +if (file_exists($snapshot_template)) { + $items = glob("$snapshot_template/*"); + print_r($items); + + foreach ($items as $item) { + $bi = basename($item); + if (is_dir($item)) { + if ($bi == 'dlls' || $bi == 'symbols') { + continue; + } else if ($bi == 'PEAR') { + /* copy to top level */ + copy_dir($item, "$dist_dir/$bi"); + } else { + /* copy that dir into extras */ + copy_dir($item, "$dist_dir/extras/$bi"); + } + } else { + if ($bi == 'go-pear.bat') { + /* copy to top level */ + copy($item, "$dist_dir/$bi"); + } else { + /* copy to extras */ + copy($item, "$dist_dir/extras/$bi"); + } + } + } +} else { + echo "WARNING: you don't have a snapshot template\n"; + echo " your dist will not complete\n"; +} + +?>