Re: [PATCH] Re: [PHP-DEV] doing phar.phar on windows
| From: | Pierre Joye | Date: | Thu, 11 Jun 2009 11:40:44 +0000 |
| Subject: | Re: [PATCH] Re: [PHP-DEV] doing phar.phar on windows | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-44242@lists.php.net to get a copy of this message | ||
hi Greg,
On Thu, Jun 11, 2009 at 6:42 AM, Greg Beaver<greg@chiaraquartet.net> wrote:
> I suppose it would help to see the patch, no?
>
> Index: win32/build/Makefile
> ===================================================================
> RCS file: /repository/php-src/win32/build/Makefile,v
> retrieving revision 1.35.2.1.2.6.2.12
> diff -u -r1.35.2.1.2.6.2.12 Makefile
> --- win32/build/Makefile 27 May 2009 01:46:48 -0000 1.35.2.1.2.6.2.12
> +++ win32/build/Makefile 11 Jun 2009 04:17:08 -0000
> @@ -128,7 +128,7 @@
> -del /f /q
> $(BUILD_DIR)\php-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip
> -del /f /q
> $(BUILD_DIR)\php-debug-pack-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip
> -del /f /q
> $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip
> - $(BUILD_DIR)\php.exe -d date.timezone=UTC -n win32/build/mkdist.php
> "$(BUILD_DIR)" "$(PHPDLL)" "$(SAPI_TARGETS)" "$(EXT_TARGETS)
> $(PHP_EXTRA_DIST_FILES)" "$(PECL_TARGETS) $(PECL_EXTRA_DIST_FILES)"
> "$(SNAPSHOT_TEMPLATE)"
> + $(BUILD_DIR)\php.exe -d date.timezone=UTC -n -dphar.readonly=0
> win32/build/mkdist.php "$(BUILD_DIR)" "$(PHPDLL)" "$(SAPI_TARGETS)"
> "$(EXT_TARGETS) $(PHP_EXTRA_DIST_FILES)" "$(PECL_TARGETS)
> $(PECL_EXTRA_DIST_FILES)" "$(SNAPSHOT_TEMPLATE)"
> cd $(BUILD_DIR)\php-$(PHP_VERSION_STRING)
> -$(ZIP) -9 -q -r
> ..\php-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip
> .
> cd ..\..
> Index: win32/build/mkdist.php
> ===================================================================
> RCS file: /repository/php-src/win32/build/mkdist.php,v
> retrieving revision 1.13.4.1.2.11
> diff -u -r1.13.4.1.2.11 mkdist.php
> --- win32/build/mkdist.php 3 Jun 2009 01:14:58 -0000 1.13.4.1.2.11
> +++ win32/build/mkdist.php 11 Jun 2009 04:31:54 -0000
> @@ -393,6 +393,27 @@
> closedir($directory_list);
> }
>
> +function make_phar_dot_phar($dist_dir)
> +{
> + if (!extension_loaded('phar')) return;
> + $path_to_php = $dist_dir;
> + $path_to_phar = realpath(__DIR__ . '/../../ext/phar');
> + echo "Generating pharcommand.phar\n";
> + $phar = new Phar($path_to_php . '/pharcommand.phar', 0, 'pharcommand');
> + foreach (new DirectoryIterator($path_to_phar . '/phar') as $file) {
> + if ($file->isDir() || $file == 'phar.php') continue;
> + echo 'adding ', $file, "\n";
> + $phar[(string) $file] = file_get_contents($path_to_phar. '/phar/' . $file);
> + }
> + $phar->setSignatureAlgorithm(Phar::SHA1);
> + $stub = file($path_to_phar . '/phar/phar.php');
> + unset($stub[0]); // remove hashbang
> + $phar->setStub(implode('', $stub));
> +
> + echo "Creating phar.phar.bat\n";
> + file_put_contents($path_to_php . '/phar.phar.bat', "%~dp0php.exe
> %~dp0pharcommand.phar %1 %2 %3 %4 %5 %6 %7 %8 %9\r\n");
> +}
> +
> if (!is_dir($test_dir)) {
> mkdir($test_dir);
> }
> @@ -489,4 +510,5 @@
> echo "WARNING: you don't have a snapshot template, your dist will not be
> complete\n";
> }
>
> +make_phar_dot_phar($dist_dir);
> ?>
Please commit, it looks good. I will test once it is committed as well.
Cheers,
--
Pierre
http://blog.thepimp.net | http://www.libgd.org