Browse Source

cmdline parameter parsing improved

uses license classes to write LICENSE file
config.m4 and *.dsp file are only written if their platform is supported
migration/unlabaled-1.3.2
Hartmut Holzgraefe 24 years ago
parent
commit
67df62c0b1
  1. 40
      scripts/ext_skel_ng/ext_skel_ng.php

40
scripts/ext_skel_ng/ext_skel_ng.php

@ -2,26 +2,52 @@
require_once "extension_parser.php";
require_once "System.php";
$filename = isset($_SERVER["argv"][1]) ? $_SERVER["argv"][1] : "extension.xml";
// parse command line arguments
if (isset($_SERVER['argv'][1])) {
$filename = $_SERVER["argv"][1];
echo "using '$filename' as specification file\n";
} else {
$filename = "extension.xml";
echo "using default file '$filename' as specification file\n";
}
$ext = &new extension_parser(fopen($filename, "r"));
// open specification file
$fp = fopen($filename, "r");
if (!is_resource($fp)) {
error_log("can't read specification file '$filename'");
exit;
}
// parse specification file
$ext = new extension_parser($fp);
fclose($fp);
// purge and create extension directory
System::rm("-rf {$ext->name}");
mkdir($ext->name);
// write LICENSE file
$ext->license->write_license_file("{$ext->name}/LICENSE");
// generate code
$ext->write_header_file();
$ext->write_code_file();
if(isset($ext->logo)) {
if (isset($ext->logo)) {
$fp = fopen("{$ext->name}/{$ext->name}_logo.h", "w");
fwrite($fp, $ext->logo->h_code());
fclose($fp);
$ext->logo->h_code();
}
// generate project files for configure and ms dev studio
$ext->write_config_m4();
$ext->write_ms_devstudio_dsp();
// generate project files for configure (unices and similar platforms like cygwin)
if ($ext->platform === "all" || in_array("unix", $ext->platform)) {
$ext->write_config_m4();
}
// generate project files for Windows platform (VisualStudio/C++ V6)
if ($ext->platform === "all" || in_array("win32", $ext->platform)) {
$ext->write_ms_devstudio_dsp();
}
// generate DocBook XML documantation for PHP manual
$ext->generate_documentation();
?>
Loading…
Cancel
Save