2011-03-10 05:11:03 +00:00
|
|
|
class Glib < Formula
|
2015-03-07 08:12:02 +00:00
|
|
|
homepage "https://developer.gnome.org/glib/"
|
2015-05-13 07:25:21 +00:00
|
|
|
url "https://download.gnome.org/sources/glib/2.44/glib-2.44.1.tar.xz"
|
|
|
|
sha256 "8811deacaf8a503d0a9b701777ea079ca6a4277be10e3d730d2112735d5eca07"
|
2009-06-06 22:54:52 +00:00
|
|
|
|
2014-02-22 12:30:30 +00:00
|
|
|
bottle do
|
2015-05-13 09:53:46 +00:00
|
|
|
sha256 "b6017260ce6e82abca388e12ab536a7e0675caf17f4a5f3ae7d7876ec1f7b5d9" => :yosemite
|
|
|
|
sha256 "ec584074182b988e2b83fcc23d6143fe463a9bb6ddca6d7f75d40d96a9282a7b" => :mavericks
|
|
|
|
sha256 "fcac604c02b1f562c4a6823b8361f35067a2cc1cdcf2ea0dc772698b5f2a156a" => :mountain_lion
|
2014-02-22 12:30:30 +00:00
|
|
|
end
|
|
|
|
|
2012-08-10 05:00:06 +00:00
|
|
|
option :universal
|
2015-03-07 08:12:02 +00:00
|
|
|
option "with-test", "Build a debug build and run tests. NOTE: Not all tests succeed yet"
|
|
|
|
option "with-static", "Build glib with a static archive."
|
|
|
|
|
|
|
|
deprecated_option "test" => "with-test"
|
2012-08-10 05:00:06 +00:00
|
|
|
|
2015-03-07 08:12:02 +00:00
|
|
|
depends_on "pkg-config" => :build
|
|
|
|
depends_on "gettext"
|
|
|
|
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
|
|
|
|
2015-03-07 08:12:02 +00:00
|
|
|
resource "config.h.ed" do
|
|
|
|
url "https://trac.macports.org/export/111532/trunk/dports/devel/glib2/files/config.h.ed"
|
|
|
|
version "111532"
|
|
|
|
sha256 "9f1e23a084bc879880e589893c17f01a2f561e20835d6a6f08fcc1dad62388f1"
|
2014-08-25 01:20:49 +00:00
|
|
|
end
|
2013-10-01 21:53:08 +00:00
|
|
|
|
2014-03-08 23:02:38 +00:00
|
|
|
# https://bugzilla.gnome.org/show_bug.cgi?id=673135 Resolved as wontfix,
|
|
|
|
# but needed to fix an assumption about the location of the d-bus machine
|
|
|
|
# id file.
|
|
|
|
patch do
|
2014-09-23 01:24:22 +00:00
|
|
|
url "https://gist.githubusercontent.com/jacknagel/af332f42fae80c570a77/raw/7b5fd0d2e6554e9b770729fddacaa2d648327644/glib-hardcoded-paths.diff"
|
2015-03-07 08:12:02 +00:00
|
|
|
sha256 "a4cb96b5861672ec0750cb30ecebe1d417d38052cac12fbb8a77dbf04a886fcb"
|
2010-07-24 03:19:08 +00:00
|
|
|
end
|
|
|
|
|
2014-03-08 23:02:38 +00:00
|
|
|
# Fixes compilation with FSF GCC. Doesn't fix it on every platform, due
|
|
|
|
# to unrelated issues in GCC, but improves the situation.
|
|
|
|
# Patch submitted upstream: https://bugzilla.gnome.org/show_bug.cgi?id=672777
|
|
|
|
patch do
|
2015-03-09 00:32:12 +00:00
|
|
|
url "https://gist.githubusercontent.com/jacknagel/9835034/raw/282d36efc126272f3e73206c9865013f52d67cd8/gio.patch"
|
|
|
|
sha256 "d285c70cfd3434394a1c77c92a8d2bad540c954aad21e8bb83777482c26aab9a"
|
2014-03-08 23:02:38 +00:00
|
|
|
end
|
|
|
|
|
2014-03-23 17:04:21 +00:00
|
|
|
patch do
|
2015-03-09 00:32:12 +00:00
|
|
|
url "https://gist.githubusercontent.com/jacknagel/9726139/raw/a351ea240dea33b15e616d384be0550f5051e959/universal.patch"
|
|
|
|
sha256 "7e1ad7667c7d89fcd08950c9c32cd66eb9c8e2ee843f023d1fadf09a9ba39fee"
|
2014-03-08 23:02:38 +00:00
|
|
|
end if build.universal?
|
|
|
|
|
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
|
|
|
|
2014-05-11 21:08:06 +00:00
|
|
|
inreplace %w[gio/gdbusprivate.c gio/xdgmime/xdgmime.c glib/gutils.c],
|
|
|
|
"@@HOMEBREW_PREFIX@@", HOMEBREW_PREFIX
|
|
|
|
|
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
|
2013-09-15 10:55:32 +00:00
|
|
|
--disable-silent-rules
|
2012-05-01 00:29:16 +00:00
|
|
|
--disable-dtrace
|
2013-04-13 06:54:52 +00:00
|
|
|
--disable-libelf
|
2012-04-21 10:58:50 +00:00
|
|
|
--prefix=#{prefix}
|
2012-05-06 22:25:25 +00:00
|
|
|
--localstatedir=#{var}
|
2013-03-24 20:39:27 +00:00
|
|
|
--with-gio-module-dir=#{HOMEBREW_PREFIX}/lib/gio/modules
|
2012-04-21 10:58:50 +00:00
|
|
|
]
|
2010-07-24 03:19:08 +00:00
|
|
|
|
2015-03-07 08:12:02 +00:00
|
|
|
args << "--enable-static" if build.with? "static"
|
2013-12-28 01:38:48 +00:00
|
|
|
|
2010-07-24 03:19:08 +00:00
|
|
|
system "./configure", *args
|
|
|
|
|
2012-08-10 05:00:06 +00:00
|
|
|
if build.universal?
|
2015-03-07 08:12:02 +00:00
|
|
|
buildpath.install resource("config.h.ed")
|
2015-03-09 00:14:46 +00:00
|
|
|
system "ed -s - config.h <config.h.ed"
|
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
|
2015-03-09 00:14:46 +00:00
|
|
|
system "ulimit -n 1024; make check" if build.with? "test"
|
2015-03-07 08:12:02 +00:00
|
|
|
system "make", "install"
|
2009-09-24 22:35:10 +00:00
|
|
|
|
2013-12-05 07:37:52 +00:00
|
|
|
# `pkg-config --libs glib-2.0` includes -lintl, and gettext itself does not
|
|
|
|
# have a pkgconfig file, so we add gettext lib and include paths here.
|
2014-02-25 14:27:54 +00:00
|
|
|
gettext = Formula["gettext"].opt_prefix
|
2015-03-07 08:12:02 +00:00
|
|
|
inreplace lib+"pkgconfig/glib-2.0.pc" do |s|
|
|
|
|
s.gsub! "Libs: -L${libdir} -lglib-2.0 -lintl",
|
2013-12-05 07:37:52 +00:00
|
|
|
"Libs: -L${libdir} -lglib-2.0 -L#{gettext}/lib -lintl"
|
2015-03-07 08:12:02 +00:00
|
|
|
s.gsub! "Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include",
|
2013-12-05 07:37:52 +00:00
|
|
|
"Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include -I#{gettext}/include"
|
|
|
|
end
|
|
|
|
|
2015-03-07 08:12:02 +00:00
|
|
|
(share+"gtk-doc").rmtree
|
2009-06-06 22:54:52 +00:00
|
|
|
end
|
2012-03-12 22:51:27 +00:00
|
|
|
|
2013-02-02 05:12:36 +00:00
|
|
|
test do
|
2015-03-07 08:12:02 +00:00
|
|
|
(testpath/"test.c").write <<-EOS.undent
|
2013-02-02 05:12:36 +00:00
|
|
|
#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
|
2014-02-22 12:48:41 +00:00
|
|
|
flags = ["-I#{include}/glib-2.0", "-I#{lib}/glib-2.0/include", "-lglib-2.0"]
|
2014-05-15 18:45:50 +00:00
|
|
|
system ENV.cc, "-o", "test", "test.c", *(flags + ENV.cflags.to_s.split)
|
2013-02-02 05:12:36 +00:00
|
|
|
system "./test"
|
2012-03-12 22:51:27 +00:00
|
|
|
end
|
2009-06-06 22:54:52 +00:00
|
|
|
end
|