build-stub 737 B

1234567891011121314151617181920212223
  1. #!/usr/bin/env php
  2. <?php
  3. $license = file_get_contents(dirname(__DIR__) . '/LICENSE');
  4. $license = str_replace('The MIT License (MIT)', '', $license);
  5. $license = str_replace("\n", "\n * ", trim($license));
  6. $autoload = <<<'EOS'
  7. Phar::mapPhar('psysh.phar');
  8. require 'phar://psysh.phar/.box/check_requirements.php';
  9. require 'phar://psysh.phar/vendor/autoload.php';
  10. EOS;
  11. $content = file_get_contents(dirname(__DIR__) . '/bin/psysh');
  12. $content = preg_replace('{/\* <<<.*?>>> \*/}sm', $autoload, $content);
  13. $content = preg_replace('/\\(c\\) .*?with this source code./sm', $license, $content);
  14. $content .= '__HALT_COMPILER();';
  15. @mkdir(dirname(__DIR__) . '/build');
  16. file_put_contents(dirname(__DIR__) . '/build/stub', $content);