Top Level Namespace
Defined Under Namespace
Modules: PhpEmbed
Constant Summary collapse
- PHP_VERSION =
'5.4.10'
- PHP_SRC_URL =
"http://php.net/distributions/php-#{PHP_VERSION}.tar.bz2"
Instance Method Summary collapse
- #compile_php(prefix) ⇒ Object
- #configure(prefix) ⇒ Object
- #decompression(archive) ⇒ Object
- #download_src(destfile) ⇒ Object
- #make_and_install ⇒ Object
- #prepare_compile_php(prefix) ⇒ Object
Instance Method Details
#compile_php(prefix) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'ext/php_embed/extconf.rb', line 67 def compile_php(prefix) Dir.mkdir 'src' unless Dir.exists? 'src' Dir.chdir('src') do src_filename = "php-#{PHP_VERSION}.tar.bz2" download_src(src_filename) unless File.exists? src_filename decompression(src_filename) end src_dir = "src/php-#{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
22 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 |
# File 'ext/php_embed/extconf.rb', line 22 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
16 17 18 19 20 |
# File 'ext/php_embed/extconf.rb', line 16 def decompression(archive) print "decompression php source\n" `tar xf #{archive}` abort 'tar failure' if $?.exitstatus != 0 end |
#download_src(destfile) ⇒ Object
11 12 13 14 |
# File 'ext/php_embed/extconf.rb', line 11 def download_src(destfile) print "download php source\n" FileUtils.copy_stream(open(PHP_SRC_URL), destfile) end |
#make_and_install ⇒ Object
52 53 54 55 56 57 58 59 60 |
# File 'ext/php_embed/extconf.rb', line 52 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
62 63 64 65 |
# File 'ext/php_embed/extconf.rb', line 62 def prepare_compile_php(prefix) abort 'need tar' unless find_executable 'tar' abort 'need make' unless find_executable 'make' end |