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 Glib < Formula
|
2011-12-01 05:40:31 +00:00
|
|
|
homepage 'http://developer.gnome.org/glib/'
|
2012-07-17 17:37:10 +00:00
|
|
|
url 'ftp://ftp.gnome.org/pub/gnome/sources/glib/2.32/glib-2.32.4.tar.xz'
|
|
|
|
sha256 'a5d742a4fda22fb6975a8c0cfcd2499dd1c809b8afd4ef709bda4d11b167fae2'
|
2009-06-06 22:54:52 +00:00
|
|
|
|
2012-08-10 05:00:06 +00:00
|
|
|
option :universal
|
|
|
|
option 'test', 'Build a debug build and run tests. NOTE: Not all tests succeed yet'
|
|
|
|
|
2012-07-17 17:37:10 +00:00
|
|
|
depends_on 'pkg-config' => :build
|
2012-03-12 20:07:15 +00:00
|
|
|
depends_on 'xz' => :build
|
2009-09-18 18:16:39 +00:00
|
|
|
depends_on 'gettext'
|
2011-12-01 05:40:31 +00:00
|
|
|
depends_on 'libffi'
|
2009-08-11 00:31:47 +00:00
|
|
|
|
2012-03-18 20:33:24 +00:00
|
|
|
fails_with :llvm do
|
|
|
|
build 2334
|
|
|
|
cause "Undefined symbol errors while linking"
|
|
|
|
end
|
2011-08-05 12:38:32 +00:00
|
|
|
|
2010-07-24 03:19:08 +00:00
|
|
|
def patches
|
2012-05-18 02:49:01 +00:00
|
|
|
# https://bugzilla.gnome.org/show_bug.cgi?id=673047 Still open at 2.32.3
|
|
|
|
# https://bugzilla.gnome.org/show_bug.cgi?id=644473 Still open at 2.32.3
|
2012-05-06 22:25:25 +00:00
|
|
|
# https://bugzilla.gnome.org/show_bug.cgi?id=673135 Resolved as wontfix.
|
2012-04-21 10:58:50 +00:00
|
|
|
p = { :p1 => %W[
|
|
|
|
https://raw.github.com/gist/2235195/19cdaebdff7dcc94ccd9b3747d43a09318f0b846/glib-gunicollate.diff
|
|
|
|
https://raw.github.com/gist/2235202/26f885e079e4d61da26d239970301b818ddbb4ab/glib-gtimezone.diff
|
|
|
|
https://raw.github.com/gist/2246469/591586214960f7647b1454e7d547c3935988a0a7/glib-configurable-paths.diff
|
2012-03-12 20:07:15 +00:00
|
|
|
]}
|
2012-04-21 10:58:50 +00:00
|
|
|
p[:p0] = %W[
|
2012-07-17 17:37:10 +00:00
|
|
|
https://trac.macports.org/export/95596/trunk/dports/devel/glib2/files/patch-configure.diff
|
2012-08-10 05:00:06 +00:00
|
|
|
] if build.universal?
|
2012-04-21 10:58:50 +00:00
|
|
|
p
|
2010-07-24 03:19:08 +00:00
|
|
|
end
|
|
|
|
|
2009-06-06 22:54:52 +00:00
|
|
|
def install
|
2012-08-10 05:00:06 +00:00
|
|
|
ENV.universal_binary if build.universal?
|
2011-06-05 00:11:45 +00:00
|
|
|
|
2012-04-21 10:58:50 +00:00
|
|
|
# -w is said to causes gcc to emit spurious errors for this package
|
|
|
|
ENV.enable_warnings if ENV.compiler == :gcc
|
2009-06-06 22:54:52 +00:00
|
|
|
|
2012-05-01 00:29:16 +00:00
|
|
|
# Disable dtrace; see https://trac.macports.org/ticket/30413
|
2012-04-21 10:58:50 +00:00
|
|
|
args = %W[
|
|
|
|
--disable-maintainer-mode
|
|
|
|
--disable-dependency-tracking
|
2012-05-01 00:29:16 +00:00
|
|
|
--disable-dtrace
|
2012-04-21 10:58:50 +00:00
|
|
|
--prefix=#{prefix}
|
2012-05-06 22:25:25 +00:00
|
|
|
--localstatedir=#{var}
|
2012-04-21 10:58:50 +00:00
|
|
|
]
|
2010-07-24 03:19:08 +00:00
|
|
|
|
|
|
|
system "./configure", *args
|
|
|
|
|
2012-08-10 05:00:06 +00:00
|
|
|
if build.universal?
|
2012-07-17 17:37:10 +00:00
|
|
|
system "curl 'https://trac.macports.org/export/95596/trunk/dports/devel/glib2/files/config.h.ed' | ed - config.h"
|
2012-04-21 10:58:50 +00:00
|
|
|
end
|
2010-07-24 03:19:08 +00:00
|
|
|
|
2009-06-06 22:54:52 +00:00
|
|
|
system "make"
|
2012-04-21 10:58:50 +00:00
|
|
|
# the spawn-multithreaded tests require more open files
|
2012-08-10 05:00:06 +00:00
|
|
|
system "ulimit -n 1024; make check" if build.include? 'test'
|
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
|
2012-03-12 22:51:27 +00:00
|
|
|
|
|
|
|
def test
|
2012-03-13 04:28:23 +00:00
|
|
|
unless Formula.factory("pkg-config").installed?
|
|
|
|
puts "pkg-config is required to run this test, but is not installed"
|
|
|
|
exit 1
|
|
|
|
end
|
|
|
|
|
2012-03-12 22:51:27 +00:00
|
|
|
mktemp do
|
|
|
|
(Pathname.pwd/'test.c').write <<-EOS.undent
|
|
|
|
#include <string.h>
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
gchar *result_1, *result_2;
|
|
|
|
char *str = "string";
|
|
|
|
|
|
|
|
result_1 = g_convert(str, strlen(str), "ASCII", "UTF-8", NULL, NULL, NULL);
|
|
|
|
result_2 = g_convert(result_1, strlen(result_1), "UTF-8", "ASCII", NULL, NULL, NULL);
|
|
|
|
|
|
|
|
return (strcmp(str, result_2) == 0) ? 0 : 1;
|
|
|
|
}
|
|
|
|
EOS
|
2012-07-13 09:39:25 +00:00
|
|
|
flags = *`pkg-config --cflags --libs glib-2.0`.split
|
|
|
|
flags += ENV.cflags.split
|
|
|
|
system ENV.cc, "-o", "test", "test.c", *flags
|
2012-03-12 22:51:27 +00:00
|
|
|
system "./test"
|
|
|
|
end
|
|
|
|
end
|
2009-06-06 22:54:52 +00:00
|
|
|
end
|