Created
April 4, 2011 08:22
-
-
Save tobiastom/901289 to your computer and use it in GitHub Desktop.
PHP Homebrew Formular
This file contains hidden or 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' | |
class Libpng < Formula | |
url 'http://downloads.sourceforge.net/project/libpng/libpng15/1.5.11/libpng-1.5.11.tar.gz' | |
homepage 'http://www.libpng.org/pub/png/libpng.html' | |
md5 '7373f65ca1407ce9910d634e527e8959' | |
keg_only :provided_by_osx, | |
"TODO: Which software depends on this newer version of libpng?" | |
def install | |
system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}" | |
system "make install" | |
end | |
end |
This file contains hidden or 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' | |
class Php <Formula | |
url 'http://us.php.net/get/php-5.4.0.tar.bz2/from/www.php.net/mirror' | |
version '5.4.0' | |
homepage 'http://php.net' | |
md5 '04bb6f9d71ea86ba05685439d50db074' | |
@@has_apache = false | |
# DEPENDENCIES | |
if(ARGV.include? '--with-gettext') | |
puts "Requiring gettext" | |
depends_on 'gettext' | |
end | |
if(ARGV.include? '--with-pspell') | |
puts "Requiring aspell" | |
depends_on 'aspell' | |
end | |
if ARGV.include? '--default-osx' | |
@@has_apache = true | |
depends_on 'jpeg' | |
depends_on 'libpng' | |
depends_on 'libxml2' | |
depends_on 'sqlite' | |
depends_on 'pcre' | |
else | |
if (ARGV.include? '--with-mysql') && (!ARGV.include? '--with-native-mysql') | |
puts "Requiring MySQL" | |
depends_on 'mysql' | |
end | |
if ARGV.include? '--with-sqlite' | |
depends_on 'sqlite' | |
end | |
end | |
if ARGV.include? '--with-fpm' | |
depends_on 'libevent' | |
end | |
if ARGV.include? '--with-apache' | |
@@has_apache = true | |
end | |
if ARGV.include? '--without-apache' | |
@@has_apache = false | |
end | |
def patches | |
# Typical Mac OSX+PHP libiconv patch | |
# Added the Mac OSX mysqli non-native bug fix | |
DATA | |
end | |
def options | |
[ | |
['--default-osx', "Build like the default OS X PHP install (minus ODBC, Phar)"], | |
['--with-mysql', "Build with MySQL (PDO) support from homebrew"], | |
['--with-native-mysql', "Build with native MySQL drivers [supplied by --default-osx]"], | |
['--with-sqlite', "Build with SQLite3 (PDO) support from homebrew"], | |
['--with-osx-sqlite', "Build with SQLite3 (PDO) from OS X [supplied by --default-osx]"], | |
['--with-fpm', "Build with PHP-FPM"], | |
['--with-apache', "Build with the Apache SAPI [supplied by --default-osx]"], | |
['--without-apache', "Ignore building the Apache SAPI [only useful with --default-osx]"], | |
['--with-gettext', "Add gettext support"], | |
['--with-postgres', "Add PostgreSQL support (PDO and module)"], | |
['--with-pspell', "Add ASpell support"] | |
] | |
end | |
def caveats | |
<<-END_CAVEATS | |
This formula has installed libxml2 and libiconv to bypass some errors included | |
within the default OS X libraries. | |
If you would like to customize your php.ini please edit: | |
#{HOMEBREW_PREFIX}/etc/php.ini | |
NOTE: You will want to set date.timezone setting to your timezone. | |
http://www.php.net/manual/en/timezones.php | |
If you used --with-fpm you need to edit: | |
#{HOMEBREW_PREFIX}/etc/php-fpm.conf | |
Switches: | |
Pass --default-osx to build like the default OS X install of PHP (including binding to default Apache install) | |
Pass --with-mysql to build with MySQL (PDO) support | |
Pass --with-native-mysql to build with native MySQL drivers [supplied by --default-osx] | |
Pass --with-sqlite to build with SQLite3 (PDO) support from homebrew | |
Pass --with-osx-sqlite to build with SQLite3 (PDO) from OS X [supplied by --default-osx] | |
Pass --with-fpm to build with PHP-FPM | |
Pass --with-apache to build the Apache SAPI [supplied by --default-osx] | |
Pass --without-apache to ignore building the Apache SAPI [only useful with --default-osx] | |
Pass --with-gettext to build with gettext support | |
Pass --with-postgres to build with PostGreSQL support | |
Pass --with-pspell to build ASpell support | |
END_CAVEATS | |
end | |
def skip_clean? path | |
path == bin+'php' | |
end | |
def install | |
configure_args = [ | |
"--prefix=#{prefix}", | |
"--disable-debug", | |
"--disable-dependency-tracking", | |
"--with-config-file-path=#{HOMEBREW_PREFIX}/etc", | |
"--sysconfdir=#{prefix}/etc", | |
"--with-pear=#{prefix}/share/pear/", | |
"--enable-cgi", | |
"--mandir=#{man}", | |
"--with-iconv-dir=/usr" | |
] | |
if @@has_apache | |
puts "Building with Apache SAPI" | |
configure_args.push("--with-apxs2=/usr/sbin/apxs", "--libexecdir=#{prefix}/libexec") | |
end | |
if (ARGV.include? '--default-osx') || (ARGV.include? '--with-mysql') | |
# Now for the DB stuff | |
if (ARGV.include? '--with-mysql') && (!ARGV.include? '--with-native-mysql') | |
puts "Using MySQL (PDO) drivers [homebrew drivers]" | |
configure_args.push("--with-mysql=#{HOMEBREW_PREFIX}/lib/mysql", | |
"--with-mysqli=#{HOMEBREW_PREFIX}/bin/mysql_config", | |
"--with-pdo-mysql=#{HOMEBREW_PREFIX}/bin/mysql_config") | |
else | |
puts "Using MySQL (PDO) drivers [native drivers]" | |
configure_args.push("--with-mysql=mysqlnd", | |
"--with-mysqli=mysqlnd", | |
"--with-pdo-mysql=mysqlnd", | |
"--with-mysql-sock=/tmp/mysql.sock") | |
end | |
end | |
if (ARGV.include? '--default-osx') || (ARGV.include? '--with-osx-sqlite') | |
if (!ARGV.include? '--with-sqlite') | |
puts "Building with SQLite3 (PDO) support [OS X libraries]" | |
configure_args.push("--with-pdo-sqlite=/usr") | |
end | |
end | |
if (ARGV.include? '--with-sqlite') | |
puts "Building with SQLite3 (PDO) support [homebrew libraries])" | |
configure_args.push("--with-pdo-sqlite=#{HOMEBREW_PREFIX}") | |
end | |
if(ARGV.include? '--with-postgres') | |
puts "Building with PostGreSQL support" | |
pg = Formula.factory('postgresql') | |
configure_args.push( | |
"--with-pgsql=#{pg.bin + '/pg_config'}", | |
"--with-pdo-pgsql=#{pg.bin + '/pg_config'}" | |
) | |
end | |
if(ARGV.include? '--with-pspell') | |
puts "Building with ASpell support" | |
aspell = Formula.factory('aspell') | |
configure_args.push("--with-pspell") | |
end | |
if (ARGV.include? '--with-gettext') | |
puts "Building with gettext support" | |
configure_args.push("--with-gettext") | |
end | |
if ARGV.include? '--default-osx' | |
# Now for the GD stuff | |
configure_args.push("--with-gd", | |
"--with-jpeg-dir=#{HOMEBREW_PREFIX}", | |
"--with-png-dir=#{HOMEBREW_PREFIX}/Cellar/libpng/#{versions_of("libpng").first}", | |
"--with-freetype-dir=/usr/X11", | |
"--enable-gd-native-ttf") | |
# Misc default stuff | |
configure_args.push("--with-libxml-dir=#{HOMEBREW_PREFIX}", | |
"--with-openssl=/usr", | |
"--with-kerberos=/usr", | |
"--with-ldap=/usr", | |
"--with-ldap-sasl=/usr", | |
"--with-pcre-regex", | |
"--with-zlib=/usr", | |
"--enable-bcmath", | |
"--with-bz2", | |
"--enable-calendar", | |
"--with-curl=/usr", | |
"--enable-exif", | |
"--enable-ftp", | |
"--enable-mbstring", | |
"--enable-shmop", | |
"--enable-soap", | |
"--enable-sockets", | |
"--enable-sysvmsg", | |
"--enable-sysvsem", | |
"--enable-sysvshm", | |
"--with-xmlrpc", | |
"--with-xsl", | |
"--enable-zip", | |
"--with-iodbc=/usr") | |
end | |
if ARGV.include? '--with-fpm' | |
puts "Building PHP-FPM" | |
configure_args.push("--with-libevent-dir=#{HOMEBREW_PREFIX}", | |
"--enable-fpm") | |
end | |
system "./configure", *configure_args | |
# Taken from http://github.com/ampt/homebrew/blob/php/Library/Formula/php.rb | |
if @@has_apache | |
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 | |
system "make" | |
system "make install" | |
system "mkdir -p #{prefix}/etc" | |
system "cp ./php.ini-production #{prefix}/etc/php.ini" | |
if ARGV.include? '--with-fpm' | |
system "cp ./sapi/fpm/php-fpm.conf #{prefix}/etc/php-fpm.conf" | |
system "mkdir -p #{prefix}/var/log" | |
system "touch #{prefix}/var/log/php-fpm.log" | |
end | |
if @@has_apache | |
puts "To enable PHP in Apache add the following to httpd.conf and restart Apache:" | |
puts " LoadModule php5_module #{prefix}/libexec/apache2/libphp5.so" | |
end | |
end | |
end | |
__END__ | |
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c | |
index 246e1d5..bc90239 100644 | |
--- a/ext/iconv/iconv.c | |
+++ b/ext/iconv/iconv.c | |
@@ -183,7 +183,7 @@ static PHP_GINIT_FUNCTION(iconv) | |
/* }}} */ | |
#if defined(HAVE_LIBICONV) && defined(ICONV_ALIASED_LIBICONV) | |
-#define iconv libiconv | |
+#define iconv iconv | |
#endif | |
/* {{{ typedef enum php_iconv_enc_scheme_t */ | |
diff --git a/ext/mysqli/php_mysqli_structs.h b/ext/mysqli/php_mysqli_structs.h | |
index 4a7b40c..80b3ed8 100644 | |
--- a/ext/mysqli/php_mysqli_structs.h | |
+++ b/ext/mysqli/php_mysqli_structs.h | |
@@ -54,6 +54,7 @@ | |
#define WE_HAD_MBSTATE_T | |
#endif | |
+#define HAVE_ULONG 1 | |
#include <my_global.h> | |
#if !defined(HAVE_MBRLEN) && defined(WE_HAD_MBRLEN) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment