PageRenderTime 47ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/deprec/recipes/php.rb

https://github.com/bschwartz/deprec
Ruby | 99 lines | 76 code | 12 blank | 11 comment | 2 complexity | dee0e61df8655fde7a2556cf2482f9f1 MD5 | raw file
Possible License(s): GPL-2.0
  1. # Copyright 2006-2008 by Mike Bailey. All rights reserved.
  2. Capistrano::Configuration.instance(:must_exist).load do
  3. namespace :deprec do
  4. namespace :php do
  5. desc "Install PHP from source"
  6. task :install do
  7. version = 'php-5.2.4'
  8. set :src_package, {
  9. :file => version + '.tar.gz',
  10. :md5sum => '0826e231c3148b29fd039d7a8c893ad3 php-5.2.4.tar.gz',
  11. :dir => version,
  12. :url => "http://www.php.net/distributions/#{version}.tar.gz",
  13. :unpack => "tar zxf #{version}.tar.gz;",
  14. :configure => %w(
  15. ./configure
  16. --prefix=/usr/local/php
  17. --with-apxs2=/usr/local/apache2/bin/apxs
  18. --disable-ipv6
  19. --enable-sockets
  20. --enable-soap
  21. --with-pcre-regex
  22. --with-mysql
  23. --with-zlib
  24. --with-gettext
  25. --with-sqlite
  26. --enable-sqlite-utf8
  27. --with-openssl
  28. --with-mcrypt
  29. --with-ncurses
  30. --with-jpeg-dir=/usr
  31. --with-gd
  32. --with-ctype
  33. --enable-mbstring
  34. --with-curl==/usr/lib
  35. ;
  36. ).reject{|arg| arg.match '#'}.join(' '),
  37. :make => 'make;',
  38. :install => 'make install;',
  39. :post_install => ""
  40. }
  41. install_deps
  42. run "export CFLAGS=-O2;"
  43. deprec2.download_src(src_package, src_dir)
  44. deprec2.install_from_src(src_package, src_dir)
  45. deprec2.append_to_file_if_missing('/usr/local/apache2/conf/httpd.conf', 'AddType application/x-httpd-php .php')
  46. end
  47. # install dependencies for php
  48. task :install_deps do
  49. puts "This function should be overridden by your OS plugin!"
  50. apt.install( {:base => %w(zlib1g-dev zlib1g openssl libssl-dev
  51. flex libcurl3 libcurl3-dev libmcrypt-dev libmysqlclient15-dev libncurses5-dev
  52. libxml2-dev libjpeg62-dev libpng12-dev)}, :stable )
  53. end
  54. desc "generate config file for php"
  55. task :config_gen do
  56. # not yet implemented
  57. end
  58. desc "deploy config file for php"
  59. task :config, :roles => :web do
  60. # not yet implemented
  61. end
  62. task :start, :roles => :web do
  63. # not applicable
  64. end
  65. task :stop, :roles => :web do
  66. # not applicable
  67. end
  68. task :restart, :roles => :web do
  69. # not applicable
  70. end
  71. desc "enable php in webserver"
  72. task :activate, :roles => :web do
  73. # not yet implemented
  74. end
  75. desc "disable php in webserver"
  76. task :deactivate, :roles => :web do
  77. # not yet implemented
  78. end
  79. task :backup, :roles => :web do
  80. # not applicable
  81. end
  82. task :restore, :roles => :web do
  83. # not applicable
  84. end
  85. end
  86. end
  87. end