409bf8e3a3a5a3c38db6c6c47169b0185c85eae7
[pharext/pharext] / build / create-phar.php
1 <?php
2
3 /**
4 * Creates bin/pharext, invoked through the Makefile
5 */
6
7 set_include_path(dirname(__DIR__)."/src");
8 spl_autoload_register(function($c) {
9 return include strtr($c, "\\_", "//") . ".php";
10 });
11
12 require_once __DIR__."/../src/pharext/Version.php";
13
14 $file = (new pharext\Task\PharBuild(null, pharext\Metadata::all() + [
15 "name" => "pharext",
16 "stub" => "pharext_packager.php",
17 "license" => file_get_contents(__DIR__."/../LICENSE")
18 ], false))->run();
19
20 if (getenv("SIGN")) {
21 $pass = (new pharext\Task\Askpass)->run();
22 $sign = new pharext\Task\PharSign($file, __DIR__."/pharext.key", $pass);
23 $pkey = $sign->run();
24 $pkey->exportPublicKey(__DIR__."/../bin/pharext.pubkey");
25 }
26
27 /* we do not need the extra logic of Task\PharRename */
28 rename($file, __DIR__."/../bin/pharext");