prepare 2.0
authorMichael Wallner <mike@php.net>
Mon, 9 Mar 2015 20:10:35 +0000 (21:10 +0100)
committerMichael Wallner <mike@php.net>
Mon, 9 Mar 2015 20:10:35 +0000 (21:10 +0100)
README.md
bin/pharext
src/pharext/Installer.php

index c90551e14fbde638d317ef959f22774db8f10470..583f22b1b0ac04ddc60fe67a744acc77d0a85ff5 100644 (file)
--- a/README.md
+++ b/README.md
@@ -4,8 +4,6 @@ Distribute your PHP extension as self-installable phar executable
 
 ## About
 
-### Disclaimer
-
 You don't need this package to install any `*.ext.phar` extension packages,
 just run them with php:
 
@@ -21,35 +19,56 @@ Command help:
 
 Yields:
 
-       pharext v1.1.0 (c) Michael Wallner <mike@php.net>
-       
+       pharext v2.0.0 (c) Michael Wallner <mike@php.net>
+
        Usage:
-       
-         $ ./pecl_http-2.4.0dev.ext.phar [-hvqs] [-p|-n|-c <arg>]
-       
-           -h|--help                                  Display help
-           -v|--verbose                               More output
-           -q|--quiet                                 Less output
-           -p|--prefix <arg>                          PHP installation prefix if phpize is not in $PATH, e.g. /opt/php7
-           -n|--common-name <arg>                     PHP common program name, e.g. php5 or zts-php [php]
-           -c|--configure <arg>                       Additional extension configure flags, e.g. -c --with-flag
-           -s|--sudo [<arg>]                          Installation might need increased privileges [sudo -S %s]
-           --with-http-zlib-dir [<arg>]               Where to find zlib [/usr]
-           --with-http-libcurl-dir [<arg>]            Where to find libcurl [/usr]
-           --with-http-libevent-dir [<arg>]           Where to find libevent [/usr]
-
-
-If your installation destination needs escalated permissions, have a look at the `--sudo` option:
-
-       $ ./pecl_http-2.4.0dev.ext.phar --sudo
+
+         $ ./pecl_http-2.4.0dev.ext.phar [-hvqs] [-p|-n|-c|-i <arg>]
+
+               -h|--help                                  Display help
+               -v|--verbose                               More output
+               -q|--quiet                                 Less output
+               -p|--prefix <arg>                          PHP installation prefix if phpize is not in $PATH, e.g. /opt/php7
+               -n|--common-name <arg>                     PHP common program name, e.g. php5 or zts-php [php]
+               -c|--configure <arg>                       Additional extension configure flags, e.g. -c --with-flag
+               -s|--sudo [<arg>]                          Installation might need increased privileges [sudo -S %s]
+               -i|--ini <arg>                             Activate in this php.ini instead of loaded default php.ini
+               --enable-propro [<arg>]                    Whether to enable property proxy support [yes]
+               --enable-raphf [<arg>]                     Whether to enable raphf support [yes]
+               --with-http-zlib-dir [<arg>]               Where to find zlib [/usr]
+               --with-http-libcurl-dir [<arg>]            Where to find libcurl [/usr]
+               --with-http-libevent-dir [<arg>]           Where to find libevent [/usr]
+
+If your installation destination needs escalated permissions, have a look at [the `--sudo` option](https://github.com/m6w6/pharext/wiki/Usage-of-*.ext.phar-packages#privileges):
+
+       $ ./pecl_http-2.4.0dev.ext.phar --ini /etc/php/conf.d/pecl.ini --sudo
+       Installing propro-1.0.1.ext.phar ... 
+       Running phpize ... OK
+       Running configure ... OK
+       Running make ... OK
+       Running install ... OK
+       Running INI owner transfer ... OK
+       Running INI permission transfer ... OK
+       Running INI activation ... OK
+       Cleaning up /tmp/propro-1.0.1.ext.phar.54fdbc828e3ef ...
+       Installing raphf-1.0.5.ext.phar ... 
+       Running phpize ... OK
+       Running configure ... OK
+       Running make ... OK
+       Running install ... OK
+       Running INI owner transfer ... OK
+       Running INI permission transfer ... OK
+       Running INI activation ... OK
+       Cleaning up /tmp/raphf-1.0.5.ext.phar.54fdbc828e5e0 ...
        Installing pecl_http-2.4.0dev.ext.phar ... 
        Running phpize ... OK
        Running configure ... OK
        Running make ... OK
-       Running install ... 
-       Password:OK
-       Cleaning up /tmp/pecl_http-2.4.0dev.ext.phar.54fa02e3316f7 ...
-       Don't forget to activiate the extension in your php.ini!
+       Running install ... OK
+       Running INI owner transfer ... OK
+       Running INI permission transfer ... OK
+       Running INI activation ... OK
+       Cleaning up /tmp/pecl_http-2.4.0dev.ext.phar.54fdbc828e1fb ...
 
 
 ### Prerequisites
@@ -60,171 +79,23 @@ The usual tools you need to build a PHP extension:
 
 A network connection is not needed.
 
-## Download for extension maintainers
+## Extension maintainers
 
 Download the pharext binary of the [latest release](https://github.com/m6w6/pharext/releases/latest).
 
-## Installation for extension maintainers
-
-       $ composer require --dev m6w6/pharext
-
-### Prerequisites:
-
-* make
-* php + phar
-
-## Usage
+Be aware that you need the public key to run official `pharext` releases.
 
+       -----BEGIN PUBLIC KEY-----
+       MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5x9bwisjDBDV/bwDiju2
+       Ebx4kPir32WwT3+hxV0/qAPclA1WsrpcUJ7BChk+Rlz8ujOcyENTidgI1vj3oUpo
+       /P9XlLQOSrJHYz+AOg7qwhTe89xIJspS4gHHiXUAmxz0TyCNMbOyrLcjP5CmZdll
+       n+e3HP8Kfipr4XyWBhsKbdYUZ8Ga6IeFMYzNqCzWazcOasdCpsablmyrfCaZoJ0l
+       bFald0nF3/YoeYgo3fWb4Md9Xf/grpz8Ocqyq4OY49Vb0/p8FMwzBV6vbVh/eAV/
+       jrP7L40Jw97nSBrP/5nK8Ylc5BayVRq/HhT3kLMC//zvPjb8xz3ZgVTQrwWTF3Zy
+       +wIDAQAB
+       -----END PUBLIC KEY-----
 
-Command help:
-
-       $ ./vendor/bin/pharext --help
-
-Yields:
+Place it as `pharext.pubkey` in the same directory where the `pharext` binary is located. IF you cloned the repository or installed `pharext` through composer, it is already at the right location.
 
-       pharext v1.1.0 (c) Michael Wallner <mike@php.net>
-       
-       Usage:
-       
-         $ ./bin/pharext [-hvqgpzZ] -n <arg> -r <arg> -s <arg> [-d <arg>]
-       
-           -h|--help                    Display this help
-           -v|--verbose                 More output
-           -q|--quiet                   Less output
-           -n|--name <arg>              Extension name (REQUIRED)
-           -r|--release <arg>           Extension release version (REQUIRED)
-           -s|--source <arg>            Extension source directory (REQUIRED)
-           -g|--git                     Use `git ls-files` instead of the standard ignore filter
-           -p|--pecl                    Use PECL package.xml instead of the standard ignore filter
-           -d|--dest <arg>              Destination directory [.]
-           -z|--gzip                    Create additional PHAR compressed with gzip
-           -Z|--bzip                    Create additional PHAR compressed with bzip
-
-### PECL source dirs
-
-PECL source dirs can infer package name, release version and file list
-from the package.xml.
-
-       $ ./vendor/bin/pharext --pecl --source ../pecl_http.git
-
-Yields:
-
-       Creating phar /tmp/54fa028adce40.phar ... OK
-       Finalizing ./pecl_http-2.4.0dev.ext.phar ... OK
-
-### GIT source dirs
-
-Another example using --git (`git ls-files`):
-
-       $ ./vendor/bin/pharext -v -g -s ../raphf.git --name raphf --release 1.0.5
-
-Yields:
+Please have a look at the [wiki](https://github.com/m6w6/pharext/wiki), to learn [how to use](https://github.com/m6w6/pharext/wiki/Usage-of-the-pharext-packager) the pharext installer to package self-installing PHP extensions.
 
-       Creating phar /tmp/54fa0455a9aee.phar ...
-       Packaging .gitignore
-       Packaging CREDITS
-       Packaging Doxyfile
-       Packaging LICENSE
-       Packaging TODO
-       Packaging config.m4
-       Packaging config.w32
-       Packaging package.xml
-       Packaging php_raphf.c
-       Packaging php_raphf.h
-       Packaging raphf.png
-       Packaging tests/http001.phpt
-       Packaging tests/http002.phpt
-       Packaging tests/http003.phpt
-       Packaging tests/http004.phpt
-       Created executable phar /tmp/54fa0455a9aee.phar
-       Finalizing ./raphf-1.0.5.ext.phar ... OK
-
-### Packager and installer hooks
-
-#### Packager hook
-If neither --pecl nor --git are explicitely given, pharext looks for a
-`pharext_install.php` in --source. This script will be exectuted by the
-Packager. It must return a callable with the following signature:
-
-       function(Packager $pkg, $path) : function(Packager $pkg, $path);
-
-So, the callback should return another callable.
-The primary callback is meant to set things like --name and --release,
-so you don't have to on the command line; build automation FTW.
-The secondary callback is meant to create the file iterator of the
-source dir, but if you're in a git clone, you might easily just return a
-new pharext\GitSourceDir and be done.
-
-##### Example for pecl_http
-
-pharext_package.php
-
-       <?php
-
-       namespace pharext;
-
-       return function(Packager $packager, $path) {
-               $args = $packager->getArgs();
-               $args->name = "pecl_http";
-               $args->release = current(preg_filter("/^.*PHP_PECL_HTTP_VERSION\s+\"(.*)\".*$/s", "\$1", file("../http.git/php_http.h")));
-               return function (Packager $packager, $path) {
-                       return new GitSourceDir($packager, $path);
-               };
-       };
-
-#### Installer hook
-The packager will look for a `pharext_install.php` file within the root of
-the source dir. This script will be executed by the Installer; it must
-return a callable with the following signature:
-
-       function(Installer $installer) : function(Installer $installer);
-
-So, again, the callback should return another callable.
-The primary callback is meant to add your own command line arguments to
-the CliArgs parser, and the secnodary callback is meant to proccess
-those args.
-
-##### Example for pecl_http
-
-pharext_install.php
-
-       <?php
-
-       namespace pharext;
-
-       return function(Installer $installer) {
-               $installer->getArgs()->compile([
-                       [null, "with-http-zlib-dir", "Where to find zlib",
-                               CliArgs::OPTARG],
-                       [null, "with-http-libcurl-dir", "Where to find libcurl",
-                               CliArgs::OPTARG],
-                       [null, "with-http-libevent-dir", "Where to find libev{,ent{,2}}",
-                               CliArgs::OPTARG],
-                       [null, "with-http-libidn-dir", "Where to find libidn",
-                               CliArgs::OPTARG],
-               ]);
-
-               return function(Installer $installer) {
-                       $opts = [
-                               "with-http-zlib-dir",
-                               "with-http-libcurl-dir",
-                               "with-http-libevent-dir",
-                               "with-http-libidn-dir",
-                       ];
-                       $args = $installer->getArgs();
-                       foreach ($opts as $opt) {
-                               if (isset($args[$opt])) {
-                                       $args->configure = "--$opt=".$args[$opt];
-                               }
-                       }
-               };
-       };
-
-#### PECL source dirs
-For --pecl source dirs a pharext_install.php script is automatically
-generated from the package.xml which adds defined configure options
-and automatically generates a file list.
-
-## Rebuilding
-
-       $ make -C vendor/m6w6/pharext
index 3ab0aad8cb015fabf0b1ef8017facf4748cc3ad5..25664e9add2dc1c7c2de75dac4904431e48bbcae 100755 (executable)
Binary files a/bin/pharext and b/bin/pharext differ
index c88b0d69f8d7b49a72ea4b0214d9bb79ab4f3140..4caebc0de6f4b251004b9d5e931102f957a138b2 100644 (file)
@@ -268,6 +268,9 @@ class Installer implements Command
                return $cmd;
        }
 
+       /**
+        * Activate extension in php.ini
+        */
        private function activate() {
                if ($this->args->ini) {
                        $files = [realpath($this->args->ini)];