/** * Compiles and installs the extension * * @param CommandInterface $command * @param boolean $development * * @throws Exception */ public function install(CommandInterface $command, $development = false) { /** * Get global namespace */ $namespace = str_replace('\\', '_', $this->checkDirectory()); @unlink("compile.log"); @unlink("compile-errors.log"); @unlink("ext/modules/" . $namespace . ".so"); $this->compile($command, $development); if (Utils::isWindows()) { $this->logger->output("Installation is not implemented for windows yet! Aborting!"); exit; } $this->logger->output('Installing...'); $gccFlags = $this->getGccFlags($development); $currentDir = getcwd(); exec('(cd ext && export CC="gcc" && export CFLAGS="' . $gccFlags . '" && sudo make install 2>>' . $currentDir . '/compile-errors.log 1>>' . $currentDir . '/compile.log)', $output, $exit); if (!file_exists("ext/modules/" . $namespace . ".so")) { throw new CompilerException("Internal extension compilation failed. Check compile-errors.log for more information"); } $this->logger->output('Extension installed!'); if (!extension_loaded($namespace)) { $this->logger->output('Add extension=' . $namespace . '.so to your php.ini'); } $this->logger->output('Don\'t forget to restart your web server'); }
/** * Run tests * * @param CommandInterface $command */ public function test(CommandInterface $command) { /** * Get global namespace */ $namespace = $this->checkDirectory(); $this->logger->output('Running tests...'); if (!Utils::isWindows()) { system('export CC="gcc" && export CFLAGS="-O0 -g" && export NO_INTERACTION=1 && cd ext && make test', $exit); } }