From: Michael Wallner Date: Wed, 4 Mar 2015 19:06:57 +0000 (+0100) Subject: fix issue #1 X-Git-Tag: v1.0.3~2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=2aa7504c19c62245a3cfaebb12beffde40d1cf57;p=pharext%2Fpharext fix issue #1 --- diff --git a/bin/pharext b/bin/pharext index 9439186..4076d33 100755 Binary files a/bin/pharext and b/bin/pharext differ diff --git a/src/pharext/Installer.php b/src/pharext/Installer.php index d8c7feb..0e7cce4 100644 --- a/src/pharext/Installer.php +++ b/src/pharext/Installer.php @@ -26,13 +26,12 @@ class Installer implements Command CliArgs::OPTIONAL|CliArgs::SINGLE|CliArgs::NOARG], ["q", "quiet", "Less output", CliArgs::OPTIONAL|CliArgs::SINGLE|CliArgs::NOARG], - ["p", "prefix", "PHP installation directory", - CliArgs::OPTIONAL|CliArgs::SINGLE|CliArgs::REQARG, - "/usr"], - ["n", "common-name", "PHP common program name, e.g. php5", + ["p", "prefix", "PHP installation prefix if phpize is not in \$PATH, e.g. /opt/php7", + CliArgs::OPTIONAL|CliArgs::SINGLE|CliArgs::REQARG], + ["n", "common-name", "PHP common program name, e.g. php5 or zts-php", CliArgs::OPTIONAL|CliArgs::SINGLE|CliArgs::REQARG, "php"], - ["c", "configure", "Additional extension configure flags", + ["c", "configure", "Additional extension configure flags, e.g. -c --with-flag", CliArgs::OPTIONAL|CliArgs::MULTI|CliArgs::REQARG], ["s", "sudo", "Installation might need increased privileges", CliArgs::OPTIONAL|CliArgs::SINGLE|CliArgs::OPTARG, @@ -141,13 +140,27 @@ class Installer implements Command $this->info("OK\n"); } + /** + * Construct a command from prefix common-name and suffix + * @param type $suffix + * @return string + */ + private function php($suffix) { + $cmd = $this->args["common-name"] . $suffix; + if (isset($this->args->prefix)) { + $cmd = $this->args->prefix . "/bin/" . $cmd; + } + return $cmd; + } + /** * Prepares, configures, builds and installs the extension */ private function installPackage() { $this->extract(); - $this->exec("phpize", "{$this->args->prefix}/bin/{$this->args->{'common-name'}}ize"); - $this->exec("configure", "./configure --with-php-config={$this->args->prefix}/bin/{$this->args->{'common-name'}}-config ". implode(" ", (array) $this->args->configure)); + $this->exec("phpize", $this->php("ize")); + $this->exec("configure", "./configure --with-php-config=". $this->php("-config") . " ". + implode(" ", (array) $this->args->configure)); $this->exec("make", "make -sj3"); $this->exec("install", "make -s install", true); }