]> granicus.if.org Git - php/commitdiff
cmdline parameter parsing improved
authorHartmut Holzgraefe <hholzgra@php.net>
Sat, 26 Apr 2003 15:54:50 +0000 (15:54 +0000)
committerHartmut Holzgraefe <hholzgra@php.net>
Sat, 26 Apr 2003 15:54:50 +0000 (15:54 +0000)
uses license classes to write LICENSE file
config.m4 and *.dsp file are only written if their platform is supported

scripts/ext_skel_ng/ext_skel_ng.php

index 714eef280d8c3f48a9f23ebb36f9c2d118872e75..8a1a3b78775c342923297237e0cbd2746d567c12 100644 (file)
@@ -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();
 ?>
\ No newline at end of file