From 2d4d0f6bb2d874771d2893e777a720383dd32464 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Mon, 9 Mar 2015 21:10:35 +0100 Subject: [PATCH] prepare 2.0 --- README.md | 245 +++++++++----------------------------- bin/pharext | Bin 41616 -> 41900 bytes src/pharext/Installer.php | 3 + 3 files changed, 61 insertions(+), 187 deletions(-) diff --git a/README.md b/README.md index c90551e..583f22b 100644 --- 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 - + pharext v2.0.0 (c) Michael Wallner + Usage: - - $ ./pecl_http-2.4.0dev.ext.phar [-hvqs] [-p|-n|-c ] - - -h|--help Display help - -v|--verbose More output - -q|--quiet Less output - -p|--prefix PHP installation prefix if phpize is not in $PATH, e.g. /opt/php7 - -n|--common-name PHP common program name, e.g. php5 or zts-php [php] - -c|--configure Additional extension configure flags, e.g. -c --with-flag - -s|--sudo [] Installation might need increased privileges [sudo -S %s] - --with-http-zlib-dir [] Where to find zlib [/usr] - --with-http-libcurl-dir [] Where to find libcurl [/usr] - --with-http-libevent-dir [] 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 ] + + -h|--help Display help + -v|--verbose More output + -q|--quiet Less output + -p|--prefix PHP installation prefix if phpize is not in $PATH, e.g. /opt/php7 + -n|--common-name PHP common program name, e.g. php5 or zts-php [php] + -c|--configure Additional extension configure flags, e.g. -c --with-flag + -s|--sudo [] Installation might need increased privileges [sudo -S %s] + -i|--ini Activate in this php.ini instead of loaded default php.ini + --enable-propro [] Whether to enable property proxy support [yes] + --enable-raphf [] Whether to enable raphf support [yes] + --with-http-zlib-dir [] Where to find zlib [/usr] + --with-http-libcurl-dir [] Where to find libcurl [/usr] + --with-http-libevent-dir [] 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 - - Usage: - - $ ./bin/pharext [-hvqgpzZ] -n -r -s [-d ] - - -h|--help Display this help - -v|--verbose More output - -q|--quiet Less output - -n|--name Extension name (REQUIRED) - -r|--release Extension release version (REQUIRED) - -s|--source 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 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 - - 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 - - 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 diff --git a/bin/pharext b/bin/pharext index 3ab0aad8cb015fabf0b1ef8017facf4748cc3ad5..25664e9add2dc1c7c2de75dac4904431e48bbcae 100755 GIT binary patch delta 447 zcmbPmlxfXzrVVXUO!1#4cSu=)s6$fP0?Kj>4Dp}-hJffI7Mse+f2FiQa+=b{ASzDU z97Ii*)&o(;A=GziLl93(Mi)dy%IJfrE*Y?rT@c=D8L$#LS&-mnKUr>BRedcjE=~n4 z1;^x)%(BFiRE5-vlGME7%=|os%shpHi~_yPyv)fHO(iyGS#f35OD$~P)D%?8u$Fsq zT~+9}4Xjy*qLg)J3fHf2QBwcC&+Xam`A>f5N7hczoU0g_Jy&qbrT6mhD{dY(keqt4 z0 zKZ67|W>05bb#w9J^h`aiyY2PNGnNE&XE`Q(z7pJdy3xLOfre}PA-Okx&tCqR+puGX z%H%+&4NS`)aBZG>@Q~Na{}Pw~ZTxa*y;#QNv_InaI+zcK=N*5_HJ|BjSXK+0jt1-c zqr231OV*bz(oK6 delta 167 zcmZ2;oN2;QrVVXUOpzxicSu=)s6$fP0^emB7$Q&p4FS>aB@5n6{wt*glGBtn22pX+ z<{)aiv>u2$4xzqF8-jRRGP)otQbr#{b;*F0?1J!K%Yc>0$$|to`^j?4PQE-zX!CR{ k&I}p%2faJre-xkc=w5U?yL$7@-{O^@nHYf9JNY^R0A52uI{*Lx diff --git a/src/pharext/Installer.php b/src/pharext/Installer.php index c88b0d6..4caebc0 100644 --- a/src/pharext/Installer.php +++ b/src/pharext/Installer.php @@ -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)]; -- 2.30.2