2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-06-06 22:54:52 +00:00
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Libiconv < Formula
|
2011-03-25 20:03:54 +00:00
|
|
|
homepage 'http://www.gnu.org/software/libiconv/'
|
2010-04-20 21:40:29 +00:00
|
|
|
url 'http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz'
|
|
|
|
md5 '7ab33ebd26687c744a37264a330bbe9a'
|
2009-09-17 19:10:15 +00:00
|
|
|
end
|
|
|
|
|
2010-07-24 03:19:08 +00:00
|
|
|
def build_tests?; ARGV.include? '--test'; end
|
2009-09-17 19:10:15 +00:00
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Glib < Formula
|
2011-04-14 20:15:14 +00:00
|
|
|
homepage 'http://developer.gnome.org/glib/2.28/'
|
2011-05-22 18:54:50 +00:00
|
|
|
url 'ftp://ftp.gnome.org/pub/gnome/sources/glib/2.28/glib-2.28.7.tar.bz2'
|
|
|
|
sha256 '0e1b3816a8934371d4ea2313dfbe25d10d16c950f8d02e0a7879ae10d91b1631'
|
2009-06-06 22:54:52 +00:00
|
|
|
|
2010-09-19 17:21:57 +00:00
|
|
|
depends_on 'pkg-config' => :build
|
2009-09-18 18:16:39 +00:00
|
|
|
depends_on 'gettext'
|
2009-08-11 00:31:47 +00:00
|
|
|
|
2011-04-03 18:53:05 +00:00
|
|
|
fails_with_llvm "Undefined symbol errors while linking"
|
|
|
|
|
2010-07-24 03:19:08 +00:00
|
|
|
def patches
|
2011-06-05 00:11:45 +00:00
|
|
|
mp = "https://svn.macports.org/repository/macports/trunk/dports/devel/glib2/files/"
|
2010-07-24 03:19:08 +00:00
|
|
|
{
|
|
|
|
:p0 => [
|
2011-03-25 20:03:54 +00:00
|
|
|
mp+"patch-configure.ac.diff",
|
|
|
|
mp+"patch-glib-2.0.pc.in.diff",
|
|
|
|
mp+"patch-glib_gunicollate.c.diff",
|
|
|
|
mp+"patch-gi18n.h.diff",
|
|
|
|
mp+"patch-gio_xdgmime_xdgmime.c.diff",
|
|
|
|
mp+"patch-gio_gdbusprivate.c.diff"
|
2010-07-24 03:19:08 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def options
|
2011-06-05 00:11:45 +00:00
|
|
|
[
|
|
|
|
['--universal', 'Build universal binaries.'],
|
|
|
|
['--test', 'Build a debug build and run tests. NOTE: Tests may hang on "unix-streams".']
|
|
|
|
]
|
2010-07-24 03:19:08 +00:00
|
|
|
end
|
|
|
|
|
2009-06-06 22:54:52 +00:00
|
|
|
def install
|
2011-06-05 00:11:45 +00:00
|
|
|
ENV.universal_binary if ARGV.build_universal?
|
|
|
|
|
2009-09-17 19:10:15 +00:00
|
|
|
# Snow Leopard libiconv doesn't have a 64bit version of the libiconv_open
|
|
|
|
# function, which breaks things for us, so we build our own
|
|
|
|
# http://www.mail-archive.com/gtk-list@gnome.org/msg28747.html
|
2010-04-07 05:58:35 +00:00
|
|
|
|
2009-09-17 19:10:15 +00:00
|
|
|
iconvd = Pathname.getwd+'iconv'
|
|
|
|
iconvd.mkpath
|
|
|
|
|
|
|
|
Libiconv.new.brew do
|
2011-06-05 00:11:45 +00:00
|
|
|
# Help out universal builds
|
|
|
|
# TODO - do these lines need to be here?
|
|
|
|
# ENV["ac_cv_func_malloc_0_nonnull"]='yes'
|
|
|
|
# ENV["gl_cv_func_malloc_0_nonnull"]='1'
|
|
|
|
|
2010-07-24 03:19:08 +00:00
|
|
|
system "./configure", "--disable-debug", "--disable-dependency-tracking",
|
|
|
|
"--prefix=#{iconvd}",
|
2009-09-17 19:10:15 +00:00
|
|
|
"--enable-static", "--disable-shared"
|
|
|
|
system "make install"
|
|
|
|
end
|
|
|
|
|
2009-08-07 14:41:43 +00:00
|
|
|
# indeed, amazingly, -w causes gcc to emit spurious errors for this package!
|
|
|
|
ENV.enable_warnings
|
2009-06-06 22:54:52 +00:00
|
|
|
|
2010-07-24 03:19:08 +00:00
|
|
|
# Statically link to libiconv so glib doesn't use the bugged version in 10.6
|
2009-09-17 19:10:15 +00:00
|
|
|
ENV['LDFLAGS'] += " #{iconvd}/lib/libiconv.a"
|
|
|
|
|
2010-07-24 03:19:08 +00:00
|
|
|
args = ["--disable-dependency-tracking", "--disable-rebuilds",
|
|
|
|
"--prefix=#{prefix}",
|
|
|
|
"--with-libiconv=gnu"]
|
|
|
|
|
|
|
|
args << "--disable-debug" unless build_tests?
|
|
|
|
|
2011-06-05 00:11:45 +00:00
|
|
|
if ARGV.build_universal?
|
|
|
|
# autoconf 2.61 is fine don't worry about it
|
|
|
|
inreplace ["aclocal.m4", "configure.ac"] do |s|
|
|
|
|
s.gsub! "AC_PREREQ([2.62])", "AC_PREREQ([2.61])"
|
|
|
|
end
|
|
|
|
|
|
|
|
# Run autoconf so universal builds will work
|
|
|
|
system "autoconf"
|
|
|
|
end
|
|
|
|
|
2010-07-24 03:19:08 +00:00
|
|
|
system "./configure", *args
|
|
|
|
|
|
|
|
# Fix for 64-bit support, from MacPorts
|
2011-06-05 00:11:45 +00:00
|
|
|
curl "https://svn.macports.org/repository/macports/trunk/dports/devel/glib2/files/config.h.ed", "-O"
|
2010-07-24 03:19:08 +00:00
|
|
|
system "ed - config.h < config.h.ed"
|
|
|
|
|
2009-06-06 22:54:52 +00:00
|
|
|
system "make"
|
2010-07-24 03:19:08 +00:00
|
|
|
# Supress a folder already exists warning during install
|
|
|
|
# Also needed for running tests
|
|
|
|
ENV.j1
|
|
|
|
system "make test" if build_tests?
|
2009-06-06 22:54:52 +00:00
|
|
|
system "make install"
|
2009-09-24 22:35:10 +00:00
|
|
|
|
2010-02-19 19:19:01 +00:00
|
|
|
# This sucks; gettext is Keg only to prevent conflicts with the wider
|
|
|
|
# system, but pkg-config or glib is not smart enough to have determined
|
|
|
|
# that libintl.dylib isn't in the DYLIB_PATH so we have to add it
|
|
|
|
# manually.
|
|
|
|
gettext = Formula.factory('gettext')
|
|
|
|
inreplace lib+'pkgconfig/glib-2.0.pc' do |s|
|
|
|
|
s.gsub! 'Libs: -L${libdir} -lglib-2.0 -lintl',
|
2009-09-24 22:35:10 +00:00
|
|
|
"Libs: -L${libdir} -lglib-2.0 -L#{gettext.lib} -lintl"
|
2010-04-07 05:58:35 +00:00
|
|
|
|
2010-02-19 19:19:01 +00:00
|
|
|
s.gsub! 'Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include',
|
2010-02-19 17:37:19 +00:00
|
|
|
"Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include -I#{gettext.include}"
|
2010-02-19 19:19:01 +00:00
|
|
|
end
|
2009-09-24 22:35:10 +00:00
|
|
|
|
2010-08-08 17:20:15 +00:00
|
|
|
(share+'gtk-doc').rmtree
|
2009-06-06 22:54:52 +00:00
|
|
|
end
|
|
|
|
end
|