This commit is contained in:
Super User
2026-11-14 01:13:01 +08:00
commit 747fb1c9ae
16 changed files with 2080 additions and 0 deletions
Executable
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
set -eu
cd "$(dirname "$0")/.."
php tests/run.php
php -d phar.readonly=0 build/phar.php
php dist/wm.phar --version
+30
View File
@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
$root = dirname(__DIR__);
$target = $root . '/dist/wm.phar';
if (ini_get('phar.readonly')) {
fwrite(STDERR, "PHAR creation is disabled; run php -d phar.readonly=0 build/phar.php\n");
exit(1);
}
if (file_exists($target)) {
unlink($target);
}
$phar = new Phar($target, 0, 'wm.phar');
$phar->startBuffering();
foreach (['bin/wm', 'src/autoload.php', 'src/App.php', 'src/Runtime.php', 'src/Registry.php', 'src/Project.php', 'src/Systemd.php', 'src/Process.php', 'src/UI.php'] as $path) {
$phar->addFile($root . '/' . $path, $path);
}
$stub = <<<'STUB'
#!/usr/bin/env php
<?php
Phar::mapPhar('wm.phar');
require 'phar://wm.phar/bin/wm';
__HALT_COMPILER();
STUB;
$phar->setStub($stub . "\n");
$phar->setSignatureAlgorithm(Phar::SHA256);
$phar->stopBuffering();
chmod($target, 0755);
echo "Built {$target} (" . number_format(filesize($target)) . " bytes)\n";