Skip to content

Commit cbb532a

Browse files
committed
- Add package.php
1 parent f26abe7 commit cbb532a

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

ext/phar/package.php

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
3+
$notes = '
4+
* implement ability connect a phar file \'phar://whatever\' to a directory. That way all
5+
access to that phar archive are directed to the extracted directory. This
6+
allows to have the installed files and the archieve keep the same includes.
7+
[Marcus]
8+
* implement SHA-2 (256, 512) support [Marcus]
9+
* implement setSignatureAlgorithm() and Phar::MD5 Phar::SHA1 Phar::SHA256 Phar::SHA512 Phar::PGP to
10+
choose the kind of signature to use (PGP falls back to SHA1) [Greg]
11+
';
12+
13+
if (!class_exists("Phar") && !extension_loaded("Phar")) {
14+
die("Extension phar not present");
15+
}
16+
17+
require_once 'PEAR/PackageFileManager2.php';
18+
19+
PEAR::setErrorHandling(PEAR_ERROR_DIE);
20+
21+
$options = array(
22+
'filelistgenerator' => 'CVS',
23+
'changelogoldtonew' => false,
24+
'simpleoutput' => true,
25+
'baseinstalldir' => '/',
26+
'packagedirectory' => dirname(__FILE__),
27+
'packagefile' => 'package.xml',
28+
'clearcontents' => true,
29+
'ignore' => array('package*.php', 'package*.xml'),
30+
'dir_roles' => array(
31+
'docs' => 'doc',
32+
'examples' => 'doc',
33+
'tests' => 'test',
34+
),
35+
'exceptions' => array(
36+
'CREDITS' => 'doc',
37+
'EXPERIMENTAL' => 'doc',
38+
'LICENSE' => 'doc',
39+
'Makefile.frag' => 'src',
40+
'phar_path_check.re' => 'src',
41+
'TODO' => 'doc',
42+
),
43+
);
44+
45+
$package = PEAR_PackageFileManager2::importOptions(dirname(__FILE__) . '/package.xml', $options);
46+
47+
$package->clearDeps();
48+
$package->setPhpDep('5.2.0');
49+
$package->setPearInstallerDep('1.4.3');
50+
$package->addPackageDepWithChannel('optional', 'bz2', 'pecl.php.net', false, false, false, false, 'bz2');
51+
// all this false business sets the <providesextension> tag that allows us to have hash built
52+
// in statically
53+
$package->addPackageDepWithChannel('optional', 'hash', 'pecl.php.net', false, false, false, false, 'hash');
54+
$package->addExtensionDep('optional', 'spl');
55+
$package->addExtensionDep('optional', 'zlib');
56+
$package->setPackageType('extsrc');
57+
$package->addRelease();
58+
$package->setReleaseVersion(phpversion('phar'));
59+
$package->setAPIVersion(Phar::apiVersion());
60+
$package->setReleaseStability('beta');
61+
$package->setAPIStability('beta');
62+
$package->setNotes("\n$notes\n");
63+
//$package->addGlobalReplacement('package-info', '@package_version@', 'version');
64+
$package->generateContents();
65+
66+
if (isset($_GET['make']) || (isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')) {
67+
$package->writePackageFile();
68+
} else {
69+
$package->debugPackageFile();
70+
}
71+
72+
?>

0 commit comments

Comments
 (0)