Created
August 23, 2011 20:30
-
-
Save everzet/1166427 to your computer and use it in GitHub Desktop.
brew formula for php 5.3.8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
def mysql_installed? | |
`which mysql_config`.length > 0 | |
end | |
class Php < Formula | |
url 'http://www.php.net/get/php-5.3.8.tar.gz/from/this/mirror' | |
homepage 'http://php.net/' | |
md5 'f4ce40d5d156ca66a996dbb8a0e7666a' | |
version '5.3.8' | |
# So PHP extensions don't report missing symbols | |
skip_clean ['bin', 'sbin'] | |
depends_on 'gettext' | |
depends_on 'readline' unless ARGV.include? '--without-readline' | |
depends_on 'libxml2' | |
depends_on 'jpeg' | |
depends_on 'mcrypt' | |
if ARGV.include? '--with-mysql' | |
depends_on 'mysql' => :recommended unless mysql_installed? | |
end | |
if ARGV.include? '--with-fpm' | |
depends_on 'libevent' | |
end | |
if ARGV.include? '--with-pgsql' | |
depends_on 'postgresql' | |
end | |
if ARGV.include? '--with-mssql' | |
depends_on 'freetds' | |
end | |
if ARGV.include? '--with-intl' | |
depends_on 'icu4c' | |
end | |
def options | |
[ | |
['--with-mysql', 'Include MySQL support'], | |
['--with-pgsql', 'Include PostgreSQL support'], | |
['--with-mssql', 'Include MSSQL-DB support'], | |
['--with-fpm', 'Enable building of the fpm SAPI executable (implies --without-apache)'], | |
['--without-apache', 'Build without shared Apache 2.0 Handler module'], | |
['--with-intl', 'Include internationalization support'], | |
['--without-readline', 'Build without readline support'] | |
] | |
end | |
def patches; DATA; end | |
def install | |
ENV.O3 # Speed things up | |
args = [ | |
"--prefix=#{prefix}", | |
"--disable-debug", | |
"--with-config-file-path=#{etc}", | |
"--with-iconv-dir=/usr", | |
"--enable-exif", | |
"--enable-soap", | |
"--enable-sqlite-utf8", | |
"--enable-wddx", | |
"--enable-ftp", | |
"--enable-sockets", | |
"--enable-zip", | |
"--enable-pcntl", | |
"--enable-shmop", | |
"--enable-sysvsem", | |
"--enable-sysvshm", | |
"--enable-sysvmsg", | |
"--enable-mbstring", | |
"--enable-bcmath", | |
"--enable-calendar", | |
"--with-openssl=/usr", | |
"--with-zlib=/usr", | |
"--with-bz2=/usr", | |
"--with-ldap", | |
"--with-ldap-sasl=/usr", | |
"--with-xmlrpc", | |
"--with-iodbc", | |
"--with-kerberos=/usr", | |
"--with-libxml-dir=#{Formula.factory('libxml2').prefix}", | |
"--with-xsl=/usr", | |
"--with-curl=/usr", | |
"--with-gd", | |
"--enable-gd-native-ttf", | |
"--with-mcrypt=#{Formula.factory('mcrypt').prefix}", | |
"--with-jpeg-dir=#{Formula.factory('jpeg').prefix}", | |
"--with-png-dir=/usr/X11", | |
"--with-gettext=#{Formula.factory('gettext').prefix}", | |
"--with-tidy", | |
"--mandir=#{man}" | |
] | |
# Enable PHP FPM | |
if ARGV.include? '--with-fpm' | |
args.push "--enable-fpm" | |
end | |
# Build Apache module by default | |
unless ARGV.include? '--with-fpm' or ARGV.include? '--without-apache' | |
args.push "--with-apxs2=/usr/sbin/apxs" | |
args.push "--libexecdir=#{prefix}/libexec" | |
end | |
if ARGV.include? '--with-mysql' | |
args.push "--with-mysql-sock=/tmp/mysql.sock" | |
args.push "--with-mysqli=mysqlnd" | |
args.push "--with-mysql=mysqlnd" | |
args.push "--with-pdo-mysql=mysqlnd" | |
end | |
if ARGV.include? '--with-pgsql' | |
args.push "--with-pgsql=#{Formula.factory('postgresql').prefix}" | |
args.push "--with-pdo-pgsql=#{Formula.factory('postgresql').prefix}" | |
end | |
if ARGV.include? '--with-mssql' | |
args.push "--with-mssql=#{Formula.factory('freetds').prefix}" | |
end | |
if ARGV.include? '--with-intl' | |
args.push "--enable-intl" | |
args.push "--with-icu-dir=#{Formula.factory('icu4c').prefix}" | |
end | |
args.push "--with-readline=#{Formula.factory('readline').prefix}" unless ARGV.include? '--without-readline' | |
system "./configure", *args | |
unless ARGV.include? '--without-apache' | |
# Use Homebrew prefix for the Apache libexec folder | |
inreplace "Makefile", | |
"INSTALL_IT = $(mkinstalldirs) '$(INSTALL_ROOT)/usr/libexec/apache2' && $(mkinstalldirs) '$(INSTALL_ROOT)/private/etc/apache2' && /usr/sbin/apxs -S LIBEXECDIR='$(INSTALL_ROOT)/usr/libexec/apache2' -S SYSCONFDIR='$(INSTALL_ROOT)/private/etc/apache2' -i -a -n php5 libs/libphp5.so", | |
"INSTALL_IT = $(mkinstalldirs) '#{prefix}/libexec/apache2' && $(mkinstalldirs) '$(INSTALL_ROOT)/private/etc/apache2' && /usr/sbin/apxs -S LIBEXECDIR='#{prefix}/libexec/apache2' -S SYSCONFDIR='$(INSTALL_ROOT)/private/etc/apache2' -i -a -n php5 libs/libphp5.so" | |
end | |
if ARGV.include? '--with-intl' | |
inreplace 'Makefile' do |s| | |
s.change_make_var! "EXTRA_LIBS", "\\1 -lstdc++" | |
end | |
end | |
system "make" | |
system "make install" | |
etc.install "./php.ini-production" => "php.ini" unless File.exists? etc+"php.ini" | |
end | |
def caveats; <<-EOS | |
For 10.5 and Apache: | |
Apache needs to run in 32-bit mode. You can either force Apache to start | |
in 32-bit mode or you can thin the Apache executable. | |
To enable PHP in Apache add the following to httpd.conf and restart Apache: | |
LoadModule php5_module #{prefix}/libexec/apache2/libphp5.so | |
The php.ini file can be found in: | |
#{etc}/php.ini | |
'Fix' the default PEAR permissions and config: | |
chmod -R ug+w #{prefix}/lib/php | |
pear config-set php_ini #{etc}/php.ini | |
EOS | |
end | |
end | |
__END__ | |
diff -Naur php-5.3.2/ext/tidy/tidy.c php/ext/tidy/tidy.c | |
--- php-5.3.2/ext/tidy/tidy.c 2010-02-12 04:36:40.000000000 +1100 | |
+++ php/ext/tidy/tidy.c 2010-05-23 19:49:47.000000000 +1000 | |
@@ -22,6 +22,8 @@ | |
#include "config.h" | |
#endif | |
+#include "tidy.h" | |
+ | |
#include "php.h" | |
#include "php_tidy.h" | |
@@ -31,7 +33,6 @@ | |
#include "ext/standard/info.h" | |
#include "safe_mode.h" | |
-#include "tidy.h" | |
#include "buffio.h" | |
/* compatibility with older versions of libtidy */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment