3 * ethna_make_package.php
5 * package.xml generator for Ethna
7 * @license http://www.opensource.org/licenses/bsd-license.php The BSD License
11 require_once 'PEAR.php';
12 require_once 'Console/Getopt.php';
13 require_once 'PEAR/PackageFileManager2.php';
14 require_once 'PEAR/PackageFileManager/File.php'; // avoid bugs
17 $arg_list = Console_Getopt::readPHPArgv();
19 $is_old_package = false;
22 $r = Console_Getopt::getopt($arg_list, "abov", array("alpha", "beta", "old-package", "version"));
23 foreach ($r[0] as $opt) {
24 if ($opt[0] == "a" || $opt[0] == "--alpha") {
27 if ($opt[0] == "b" || $opt[0] == "--beta") {
30 if ($opt[0] == "o" || $opt[0] == "--old-package") {
31 $is_old_package = true;
33 if ($opt[0] == "v" || $opt[0] == "--version") {
38 $description = 'Ethna Web Application Framework';
43 $major_version = "2.5";
46 if ($state == 'alpha' || $state == 'beta') {
47 $version = $major_version . strftime('.%Y%m%d%H');
49 $version = $major_version . "." . $minor_version;
58 'baseinstalldir' => 'Ethna',
59 'packagedirectory' => dirname(dirname(__FILE__)),
60 'filelistgenerator' => 'file',
61 'ignore' => array('CVS/', '.svn/', 'package.xml', 'ethna_make_package.php', 'ethna_make_package.sh', '*optional_package*', ),
62 'changelogoldtonew' => false,
63 'exceptions' => array('README' => 'doc', 'LICENSE' => 'doc', 'CHANGES' => 'doc',),
64 'description' => $description,
65 'exceptions' => array('bin/ethna.sh' => 'script', 'bin/ethna.bat' => 'script'),
66 'installexceptions' => array('bin/ethna.sh' => '/', 'bin/ethna.bat' => '/'),
67 'installas' => array('bin/ethna.sh' => 'ethna', 'bin/ethna.bat' => 'ethna.bat'),
70 $ethna_channel = 'pear.ethna.jp';
71 $packagexml = new PEAR_PackageFileManager2();
72 $packagexml->setOptions($config);
73 $packagexml->setPackage($package);
74 $packagexml->setSummary('Ethna PHP Framework Package');
75 $packagexml->setDescription($description);
76 $packagexml->setChannel($ethna_channel);
77 $packagexml->setAPIVersion($version);
78 $packagexml->setReleaseVersion($version);
79 $packagexml->setReleaseStability($state);
80 $packagexml->setAPIStability($state);
81 $packagexml->setNotes('Ethna PHP Web Application Framework');
82 $packagexml->setPackageType('php');
84 $packagexml->addRole('*', 'php');
86 $packagexml->setPhpDep('4.1.0');
87 $packagexml->setPearinstallerDep('1.3.5');
88 $packagexml->addPackageDepWithChannel('optional', 'DB', 'pear.php.net');
89 $packagexml->addPackageDepWithChannel('optional', 'Smarty', $ethna_channel);
90 $packagexml->addPackageDepWithChannel('optional', 'simpletest', $ethna_channel);
92 $packagexml->addMaintainer('lead', 'fujimoto' , 'Masaki Fujimoto', 'fujimoto@php.net');
93 $packagexml->addMaintainer('lead', 'halt' , 'halt feits', 'halt.feits@gmail.com');
94 $packagexml->addMaintainer('lead', 'cocoitiban', 'Keita Arai', 'cocoiti@comio.info');
95 $packagexml->addMaintainer('lead', 'ichii386', 'ICHII Takashi', 'ichii386@schweetheart.jp');
97 $packagexml->setLicense('The BSD License', 'http://www.opensource.org/licenses/bsd-license.php');
99 $packagexml->addReplacement('bin/ethna.bat', 'pear-config', '@PEAR-DIR@', 'php_dir');
100 $packagexml->addReplacement('bin/ethna.bat', 'pear-config', '@PHP-BIN@', 'bin_dir');
101 $packagexml->addReplacement('bin/ethna.sh', 'pear-config', '@PHP-BINARY@', 'php_bin');
102 $packagexml->addReplacement('bin/ethna.sh', 'pear-config', '@PEAR-DIR@', 'php_dir');
103 $packagexml->addReplacement('bin/ethna.sh', 'pear-config', '@PHP-BIN@', 'bin_dir');
105 $packagexml->addRelease();
106 $packagexml->setOSInstallCondition('windows');
107 $packagexml->addInstallAs('bin/ethna.bat', 'ethna.bat');
108 $packagexml->addIgnoreToRelease('bin/ethna.sh');
109 $packagexml->addRelease();
110 $packagexml->addInstallAs('bin/ethna.sh', 'ethna');
111 $packagexml->addIgnoreToRelease('bin/ethna.bat');
113 $packagexml->generateContents();
115 if ($is_old_package) {
116 $pkg =& $packagexml->exportCompatiblePackageFile1();
117 $pkg->writePackageFile();
119 $packagexml->writePackageFile();