Hi,
I don't see an obvious way to build the phar.phar on windows.
Can someone with knowledge of how configure.js works (i.e. a Pierre)
give me a tip on how to tell it to make phar.phar after building
Release_TS/php.exe or Debug_TS/php.exe?
Otherwise, it would also be easy to provide a simple script that builds
the phar.phar, and have the snapshot builder run the script.
Which way would be better?
Thanks,
Greg
Hi,
I don't see an obvious way to build the phar.phar on windows.
Can someone with knowledge of how configure.js works (i.e. a Pierre)
give me a tip on how to tell it to make phar.phar after building
Release_TS/php.exe or Debug_TS/php.exe?Otherwise, it would also be easy to provide a simple script that builds
the phar.phar, and have the snapshot builder run the script.Which way would be better?
Can you create it from PHP/using a php script?
If yes, we can add it to mkdist.php easily.
Cheers,
Pierre
Pierre Joye wrote:
Hi,
I don't see an obvious way to build the phar.phar on windows.
Can someone with knowledge of how configure.js works (i.e. a Pierre)
give me a tip on how to tell it to make phar.phar after building
Release_TS/php.exe or Debug_TS/php.exe?Otherwise, it would also be easy to provide a simple script that builds
the phar.phar, and have the snapshot builder run the script.Which way would be better?
Can you create it from PHP/using a php script?
If yes, we can add it to mkdist.php easily.
Fantastic, in that case, all that needs to be added to mkdist.php is this:
echo "Generating phar.phar\r\n";
$phar = new Phar($path_to_php . '/phar.phar', 0, 'pharcommand');
foreach (new DirectoryIterator($path_to_phar . '/phar') as $file) {
if ($file->isDir() || $file == 'phar.php') continue;
echo 'adding ', $file, "\r\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\r\n";
file_put_contents($path_to_php . '/phar.phar.bat', 'php phar.phar %1 %2
%3 %4 %5 %6 %7 %8 %9\r\n");
That should do it. The only problem is that the user will need to
adjust the path of phar.phar at install-time, but I don't see any
obvious way around this outside of the win32 installer.
Note that $path_to_php should be the equivalent of C:\php5 and
$path_to_phar should be C:\php5\ext\phar
Greg
Pierre Joye wrote:
Hi,
I don't see an obvious way to build the phar.phar on windows.
Can someone with knowledge of how configure.js works (i.e. a Pierre)
give me a tip on how to tell it to make phar.phar after building
Release_TS/php.exe or Debug_TS/php.exe?Otherwise, it would also be easy to provide a simple script that builds
the phar.phar, and have the snapshot builder run the script.Which way would be better?
Can you create it from PHP/using a php script?
If yes, we can add it to mkdist.php easily.
Fantastic, in that case, all that needs to be added to mkdist.php is this:echo "Generating phar.phar\r\n";
$phar = new Phar($path_to_php . '/phar.phar', 0, 'pharcommand');
foreach (new DirectoryIterator($path_to_phar . '/phar') as $file) {
if ($file->isDir() || $file == 'phar.php') continue;
echo 'adding ', $file, "\r\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\r\n";
file_put_contents($path_to_php . '/phar.phar.bat', 'php phar.phar %1 %2
%3 %4 %5 %6 %7 %8 %9\r\n");That should do it. The only problem is that the user will need to
adjust the path of phar.phar at install-time, but I don't see any
obvious way around this outside of the win32 installer.Note that $path_to_php should be the equivalent of C:\php5 and
$path_to_phar should be C:\php5\ext\phar
We don't know these paths when on unzip the releases in some random
directories. Maybe that should be something to add in the installer
instead?
But reading this little script, why don't you detect magically where
phar.bat is in phar.bat and then call phar.phar from there? It is
possible to do that in batch files (see
http://cvs.php.net/viewvc.cgi/php-internals-win/script/ there are some
dirty examples there).
Cheers,
Pierre
Hi,
I have a working patch against mkdist.php, is it all right to commit?
Greg
I suppose it would help to see the patch, no?
Greg Beaver wrote:
I suppose it would help to see the patch, no?
If I'm reading that correctly it replaces the .zip files?
--
Lester Caine - G8HFL
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
Lester Caine wrote:
Greg Beaver wrote:
I suppose it would help to see the patch, no?
If I'm reading that correctly it replaces the .zip files?
OK - white space problem with the line wrap, I can see what it is adding
now. I had the -del at the start of the line so it appeared to be
deleting those lines.
--
Lester Caine - G8HFL
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
hi Greg,
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
Hi Greg
2009/6/10 Greg Beaver greg@chiaraquartet.net:
Fantastic, in that case, all that needs to be added to mkdist.php is this:
echo "Generating phar.phar\r\n";
$phar = new Phar($path_to_php . '/phar.phar', 0, 'pharcommand');
foreach (new DirectoryIterator($path_to_phar . '/phar') as $file) {
if ($file->isDir() || $file == 'phar.php') continue;
echo 'adding ', $file, "\r\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\r\n";
file_put_contents($path_to_php . '/phar.phar.bat', 'php phar.phar %1 %2
%3 %4 %5 %6 %7 %8 %9\r\n");
To use unlimited parameters, then use %* and it will catch all the parameters.
That should do it. The only problem is that the user will need to
adjust the path of phar.phar at install-time, but I don't see any
obvious way around this outside of the win32 installer.Note that $path_to_php should be the equivalent of C:\php5 and
$path_to_phar should be C:\php5\ext\pharGreg
--
--
regrads,
Kalle Sommer Nielsen
kalle@php.net
Can someone with knowledge of how configure.js works (i.e. a Pierre)
give me a tip on how to tell it to make phar.phar after building
Release_TS/php.exe or Debug_TS/php.exe?
My guess would be changing the "all" target in win32/build/Makefile
adding a new "phar.phar" target as dependency. I think this file s
copied 1:1 over to he target Makefile ...
Not sure that's better than Pierre's answer to this thread :-)
johannes
2009/6/10 Johannes Schlüter johannes@php.net:
Can someone with knowledge of how configure.js works (i.e. a Pierre)
give me a tip on how to tell it to make phar.phar after building
Release_TS/php.exe or Debug_TS/php.exe?My guess would be changing the "all" target in win32/build/Makefile
adding a new "phar.phar" target as dependency. I think this file s
copied 1:1 over to he target Makefile ...Not sure that's better than Pierre's answer to this thread :-)
Note: I have no idea what phar.phar is and how it is generated. I only
mentioned a possible way to do it :)
--
Pierre