"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 be complete\n"; } ?>