Top Level Namespace
Defined Under Namespace
Modules: PhpEmbed
Constant Summary collapse
- DEFAULT_PHP_VERSION =
"5.6.0"
Instance Method Summary collapse
- #compile_php(version, url, prefix) ⇒ Object
- #configure(prefix) ⇒ Object
- #decompression(archive) ⇒ Object
- #default_download_url(php_version) ⇒ Object
- #download_source(url, destfile) ⇒ Object
- #make_and_install ⇒ Object
- #prepare_compile_php(prefix) ⇒ Object
Instance Method Details
#compile_php(version, url, prefix) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'ext/php_embed/extconf.rb', line 68 def compile_php(version, url, prefix) Dir.mkdir 'src' unless Dir.exists? 'src' Dir.chdir('src') do filename = "php.tar.bz2" download_source(url, filename) unless File.exists? filename decompression(filename) end src_dir = "src/php-#{version}" if !Dir.exists? src_dir abort 'soruce directory not exists' end FileUtils.mkpath "#{prefix}/etc/conf.d" Dir.chdir(src_dir) do configure(prefix) make_and_install end FileUtils.copy 'php.ini', "#{prefix}/lib/" end |
#configure(prefix) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'ext/php_embed/extconf.rb', line 23 def configure(prefix) print "configure\n" opts = %w( --disable-cgi --without-pear --enable-sockets --enable-ftp --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-pcntl --enable-mbstring --disable-debug --disable-libxml --disable-dom --disable-simplexml --disable-xml --disable-xmlreader --disable-xmlwriter --disable-phar --enable-embed ).join(' ') opts += " --prefix=#{prefix}" opts += " --with-libdir=lib64" if `uname -p`.chomp == 'x86_64' `./configure #{opts}` abort 'configure failure' if $?.exitstatus != 0 end |
#decompression(archive) ⇒ Object
17 18 19 20 21 |
# File 'ext/php_embed/extconf.rb', line 17 def decompression(archive) print "decompression php source\n" `tar xf #{archive}` abort 'tar failure' if $?.exitstatus != 0 end |
#default_download_url(php_version) ⇒ Object
8 9 10 |
# File 'ext/php_embed/extconf.rb', line 8 def default_download_url(php_version) "http://php.net/distributions/php-#{php_version}.tar.bz2" end |
#download_source(url, destfile) ⇒ Object
12 13 14 15 |
# File 'ext/php_embed/extconf.rb', line 12 def download_source(url, destfile) print "download php source from: #{url}\n" FileUtils.copy_stream(open(url), destfile) end |
#make_and_install ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'ext/php_embed/extconf.rb', line 53 def make_and_install print "make\n" `make` abort 'make failure' if $?.exitstatus != 0 print "make install\n" `make install` abort 'make install failure' if $?.exitstatus != 0 end |
#prepare_compile_php(prefix) ⇒ Object
63 64 65 66 |
# File 'ext/php_embed/extconf.rb', line 63 def prepare_compile_php(prefix) abort 'need tar' unless find_executable 'tar' abort 'need make' unless find_executable 'make' end |