root/tags/rel_0-15-0/makepkg.php

Revision 305, 6.6 KB (checked in by john, 4 years ago)

updating package make

  • Property svn:executable set to *
  • Property svn:keywords set to Id
Line 
1#!@PHP-BIN@
2<?php
3/**
4 *  Make a Pear installable package of the PHPonTrax distribution
5 *
6 *  (PHP 5)
7 *
8 *  To make a package, connect to the top directory and type
9 *  <b>php makepkg.php</b> (or on Unix-type systems, <b>./makepkg.php</b>).
10 *  Information about how to build the package and what to put in it
11 *  comes from two sources: this script, and the information
12 *  maintained by {@link http://subversion.tigris.org Subversion} in
13 *  the various .svn directories that identifies which files are part
14 *  of the distribution.
15 * 
16 *  Requires Pear package
17 *  {@link http://pear.php.net/package/PEAR_PackageFileManager PEAR_PackageFileManager} .
18 *  The Subversion plugin uses
19 *  {@link http://pear.php.net/package/XML_Tree XML_Tree} .
20 *  Unfortunately XML_Tree has a couple of methods named
21 *  {@link http://www.php.net/manual/en/language.oop5.cloning.php clone}
22 *  which is a reserved word in PHP 5.  The fix is
23 *  easy, just edit XML_Tree to change every use of 'clone' to 'clone4'.
24 *
25 *  PackageFileManager has several undocumented limitations that
26 *  seriously affect what you can do with it:
27 *  <ul>
28 *    <li>PackageFileManager will not add an empty directory to a
29 *      package.  Therefore you need to put at least one file in any
30 *      directory that is to go into a package.</li>
31 *    <li>The Pear Installer will not install an empty file. Therefore
32 *      you need to put at least one character into any file to be
33 *      installed as part of a package.</li>
34 *    <li>The PackageFileManager options 'include' and 'ignore' use a
35 *      regular expression match to identify the files and directories
36 *      that they affect.  For each file and directory managed by
37 *      Subversion, PackageFileManager first attempts to apply the
38 *      RE pattern as coded.  Then it appends leading and trailing '/'
39 *      to the pattern and tries again.  The results are hard to
40 *      predict.</li>
41 *  </ul>
42 *
43 *  @package PHPonTrax
44 *  @version $Id$
45 */
46
47
48chdir("./trax/");
49
50require_once('PEAR/PackageFileManager2.php');
51require_once('PEAR/Packager.php');
52require_once('./vendor/trax/inflector.php');
53require_once('./vendor/trax/trax.php');
54
55$trax_version = Trax::version();
56$packagexml = new PEAR_PackageFileManager2;
57
58// Set package options
59$e = $packagexml->setOptions(array(
60    'baseinstalldir' => 'PHPonTrax',
61    'packagedirectory' => '.',
62    'filelistgenerator' => 'svn', // generate from svn or file
63    'simpleoutput' => true,
64    'dir_roles' => array(
65        'doc' => 'doc',
66        'test' => 'test',
67        'data' => 'data'
68    ),
69    'exceptions' => array(
70        'pear-trax' => 'script',
71        'pear-trax.bat' => 'script',
72        'vendor/trax/templates/error.phtml' => 'php',
73        'vendor/trax/templates/view.phtml' => 'php',
74        'vendor/trax/templates/mailer_view.phtml' => 'php',
75        'vendor/trax/templates/scaffolds/add.phtml' => 'php',
76        'vendor/trax/templates/scaffolds/edit.phtml' => 'php',
77        'vendor/trax/templates/scaffolds/index.phtml' => 'php',
78        'vendor/trax/templates/scaffolds/layout.phtml' => 'php',
79        'vendor/trax/templates/scaffolds/show.phtml' => 'php',
80        'vendor/trax/templates/scaffolds/scaffold.css' => 'php',
81        'vendor/trax/templates/scaffolds/generator_templates/form_scaffolding.phtml' => 'php',
82        'vendor/trax/templates/scaffolds/generator_templates/layout.phtml' => 'php',
83        'vendor/trax/templates/scaffolds/generator_templates/view_add.phtml' => 'php',
84        'vendor/trax/templates/scaffolds/generator_templates/view_edit.phtml' => 'php',
85        'vendor/trax/templates/scaffolds/generator_templates/view_index.phtml' => 'php',
86        'vendor/trax/templates/scaffolds/generator_templates/view_show.phtml' => 'php',
87        'vendor/trax/templates/scaffolds/generator_templates/style.css' => 'php'
88    ),
89    'installexceptions' => array(
90        'pear-trax' => '/',
91        'dispatch.php' => 'public'
92    )
93));
94$packagexml->setPackage('PHPonTrax');
95$packagexml->setSummary('Rapid Application Development Made Easy');
96$packagexml->setDescription('PHP port of Ruby on Rails');
97$packagexml->setNotes('We\'ve implemented many new and exciting features');
98$packagexml->setChannel('pear.phpontrax.com');
99$packagexml->setReleaseVersion($trax_version);
100$packagexml->setAPIVersion($trax_version);
101$packagexml->setReleaseStability('stable');
102$packagexml->setAPIStability('stable');
103$packagexml->setLicense('MIT License', 'http://www.opensource.org/licenses/mit-license.php');
104$packagexml->setPackageType('php'); // this is a PEAR-style php script package
105
106// Depends on PHP 5
107$packagexml->setPhpDep('5.0.3');
108
109// Depends on Pear 1.4.0 or greater
110$packagexml->setPearinstallerDep('1.4.0');
111
112// Depends on these PEAR packages
113$packagexml->addPackageDepWithChannel('required', 'MDB2', 'pear.php.net', '2.0');
114$packagexml->addPackageDepWithChannel('required', 'Mail', 'pear.php.net', '1.0');
115$packagexml->addPackageDepWithChannel('required', 'Mail_Mime', 'pear.php.net', '1.0');
116
117// Who maintains this package
118$packagexml->addMaintainer('lead', 'john', 'John Peterson', 'john@mytechsupport.com');
119$packagexml->addMaintainer('developer', 'haas', 'Walt Haas', 'haas@xmission.com');
120
121// Substitute local configuration values for these symbols
122$packagexml->addGlobalReplacement('pear-config', '@BIN-DIR@', 'bin_dir');
123$packagexml->addGlobalReplacement('pear-config', '@DOC-DIR@', 'doc_dir');
124$packagexml->addGlobalReplacement('pear-config', '@PHP-DIR@', 'php_dir');
125$packagexml->addGlobalReplacement('pear-config', '@DATA-DIR@', 'data_dir');
126$packagexml->addGlobalReplacement('pear-config', '@PHP-BIN@', 'php_bin');
127$packagexml->addGlobalReplacement('pear-config', '@TEST-DIR@', 'test_dir');
128
129// Platform-dependent command lines
130$packagexml->addRelease(); // set up a release section
131$packagexml->setOSInstallCondition('windows');
132$packagexml->addInstallAs('pear-trax.bat', 'trax');
133$packagexml->addIgnoreToRelease('pear-trax');
134$packagexml->addRelease(); // add another release section for all other OSes
135$packagexml->addInstallAs('pear-trax', 'trax');
136$packagexml->addIgnoreToRelease('pear-trax.bat');
137
138// create the <contents> tag
139$packagexml->generateContents();
140
141// Study the Subversion .svn directories to see what goes in the
142// package, then write package.xml
143$e = $packagexml->writePackageFile();
144if(PEAR::isError($e)) {
145    die($e->getMessage());
146}
147
148// Make a tarball of the files listed in package.xml
149$packager = new PEAR_Packager;
150$e = $packager->package();
151if(PEAR::isError($e)) {
152    die($e->getMessage());
153}
154
155// Move files into a build folder and clean up files
156chdir("..");
157if(!is_dir("build")) {
158    mkdir("build");
159}
160rename("./trax/PHPonTrax-".$trax_version.".tgz", "build/PHPonTrax-".$trax_version.".tgz");
161unlink("./trax/package.xml");
162
163// -- set Emacs parameters --
164// Local variables:
165// tab-width: 4
166// c-basic-offset: 4
167// c-hanging-comment-ender-p: nil
168// indent-tabs-mode: nil
169// End:
170
171?>
Note: See TracBrowser for help on using the browser.