major refactoring under the hood
[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, [
15 "header" => sprintf("pharext v%s (c) Michael Wallner <mike@php.net>", pharext\VERSION),
16 "version" => pharext\VERSION,
17 "name" => "pharext",
18 "date" => date("Y-m-d"),
19 "stub" => "pharext_packager.php",
20 "license" => file_get_contents(__DIR__."/../LICENSE")
21 ], false))->run();
22
23 if (getenv("SIGN")) {
24 $pass = (new pharext\Task\Askpass)->run();
25 $sign = new pharext\Task\PharSign($file, __DIR__."/pharext.key", $pass);
26 $pkey = $sign->run();
27 $pkey->exportPublicKey(__DIR__."/../bin/pharext.pubkey");
28 }
29
30 /* we do not need the extra logic of Task\PharRename */
31 rename($file, __DIR__."/../bin/pharext");