Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

GObject introspection support #22314

Closed
wants to merge 13 commits into from
3 changes: 2 additions & 1 deletion Library/Formula/atk.rb
Expand Up @@ -8,14 +8,15 @@ class Atk < Formula
depends_on 'pkg-config' => :build
depends_on 'xz' => :build
depends_on 'glib'
depends_on 'gobject-introspection'

option :universal

def install
ENV.universal_binary if build.universal?
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
"--enable-introspection=no"
"--enable-introspection=yes"
system "make"
system "make install"
end
Expand Down
3 changes: 2 additions & 1 deletion Library/Formula/gdk-pixbuf.rb
Expand Up @@ -13,6 +13,7 @@ class GdkPixbuf < Formula
depends_on 'jpeg'
depends_on 'libtiff'
depends_on :libpng
depends_on 'gobject-introspection'

# 'loaders.cache' must be writable by other packages
skip_clean 'lib/gdk-pixbuf-2.0'
Expand All @@ -23,7 +24,7 @@ def install
"--disable-maintainer-mode",
"--enable-debug=no",
"--prefix=#{prefix}",
"--enable-introspection=no",
"--enable-introspection=yes",
"--disable-Bsymbolic",
"--without-gdiplus"
system "make"
Expand Down
40 changes: 35 additions & 5 deletions Library/Formula/gobject-introspection.rb
Expand Up @@ -6,21 +6,51 @@ class GobjectIntrospection < Formula
sha256 '3575e5d353c17a567fdf7ffaaa7aebe9347b5b0eee8e69d612ba56a9def67d73'

option :universal
option 'with-tests', 'run tests'

depends_on 'pkg-config' => :build
depends_on 'xz' => :build
depends_on 'glib'
depends_on 'libffi'
if build.with? 'tests'
depends_on 'cairo'
depends_on :x11
end

# To avoid: ImportError: dlopen(./.libs/_giscanner.so, 2): Symbol not found: _PyList_Check
depends_on :python

if build.with? 'tests'
# Patch to fix `make check` for OS X, changes expected '.so' extension to '.dylib'
def patches
"https://gist.github.com/krrk/6958869/download"
end
end

def install
ENV.universal_binary if build.universal?
inreplace 'giscanner/transformer.py', '/usr/share', HOMEBREW_PREFIX/'share'
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
# Tests require (at least) cairo, disable them.
"--disable-tests"
system "make install"
inreplace 'configure' do |s|
s.change_make_var! 'GOBJECT_INTROSPECTION_LIBDIR', HOMEBREW_PREFIX/'lib'
end

if build.with? 'tests'
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
"--with-cairo"
system "make install"
system "make check"
else
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make install"
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of repeating this, use an array for the arguments and conditionally push "--with-cairo" onto the array:

args = %W[--disable-dependency-tracking --prefix=#{prefix}]
args << "--with-cairo" if build.with? 'tests'

system "./configure", *args

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very neat way of doing it! I've committed it.


end

def caveats; <<-EOS.undent
To run tests install using '--with-tests' these tests require that you have cairo and XQuartz installed.
EOS
end

end
8 changes: 5 additions & 3 deletions Library/Formula/gtk+3.rb
Expand Up @@ -3,7 +3,7 @@
class Gtkx3 < Formula
homepage 'http://gtk.org/'
url 'http://ftp.gnome.org/pub/gnome/sources/gtk+/3.10/gtk+-3.10.1.tar.xz'
sha1 '6840ce0c7180344b063147332d4bf515a79ccebf'
sha256 'c12e6897fb1ec8d8f1a6de6cd0ac1372fee6fd63ee3a5a63813dc5f3473e6ab8'

depends_on :x11 => '2.5' # needs XInput2, introduced in libXi 1.3
depends_on 'pkg-config' => :build
Expand All @@ -17,14 +17,16 @@ class Gtkx3 < Formula
depends_on 'jasper' => :optional
depends_on 'atk'
depends_on 'at-spi2-atk'
depends_on 'gobject-introspection'

def install
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--prefix=#{prefix}",
"--disable-glibtest",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer to be explicit here with --enable-introspection=yes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have pushed a commit for this.

"--disable-introspection",
"--enable-x11-backend"
"--enable-x11-backend",
"--enable-introspection=yes"

system "make install"
# Prevent a conflict between this and Gtk+2
mv bin/'gtk-update-icon-cache', bin/'gtk3-update-icon-cache'
Expand Down
3 changes: 2 additions & 1 deletion Library/Formula/pango.rb
Expand Up @@ -14,6 +14,7 @@ class Pango < Formula
depends_on 'harfbuzz'
depends_on 'fontconfig'
depends_on :x11 unless build.without? 'x'
depends_on 'gobject-introspection'

fails_with :llvm do
build 2326
Expand All @@ -26,7 +27,7 @@ def install
--prefix=#{prefix}
--enable-man
--with-html-dir=#{share}/doc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer to be explicit here with --enable-introspection=yes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have pushed a commit for this.

--disable-introspection
--enable-introspection=yes
]

if build.include? 'without-x'
Expand Down
25 changes: 25 additions & 0 deletions Library/Formula/py3cairo.rb
@@ -0,0 +1,25 @@
require 'formula'

class Py3cairo < Formula
homepage 'http://cairographics.org/pycairo/'
url 'http://cairographics.org/releases/pycairo-1.10.0.tar.bz2'
sha1 'b4283aa1cc9aafd12fd72ad371303a486da1d014'

depends_on 'pkg-config' => :build
depends_on 'cairo'
depends_on :x11
depends_on :python3

def install
python3 do
ENV['PYTHON'] = "python3"
system "./waf", "configure", "--prefix=#{prefix}"
system "./waf", "build"
system "./waf", "install"
end
end

test do
system "python3", "-c", "import cairo; print(cairo.version)"
end
end
54 changes: 54 additions & 0 deletions Library/Formula/pygobject3.rb
@@ -0,0 +1,54 @@
require 'formula'

class Pygobject3 < Formula
homepage 'http://live.gnome.org/PyGObject'
url 'http://ftp.gnome.org/pub/GNOME/sources/pygobject/3.8/pygobject-3.8.3.tar.xz'
sha256 '384b3e1b8d1e7c8796d7eb955380d62946dd0ed9c54ecf0817af2d6b254e082c'

option 'with-tests', 'run tests'

depends_on 'pkg-config' => :build
depends_on 'xz' => :build
if build.with? 'tests'
depends_on 'automake' => :build
depends_on 'autoconf' => :build
depends_on 'gnome-common' => :build
depends_on 'libtool' => :build
depends_on 'gtk+3' => :build
end
depends_on 'glib'
depends_on :python
depends_on 'py2cairo'
depends_on 'gobject-introspection'

option :universal

if build.with? 'tests'
def patches
# necessary for tests
"https://gist.github.com/krrk/6439665/download"
end
end

def install
ENV.universal_binary if build.universal?

python do
if build.with? 'tests'
# autogen.sh is necessary to update the build system after the above
# patch and XDG_DATA_DIRS needs to be fixed for some tests to run
inreplace 'tests/Makefile.am', '/usr/share', HOMEBREW_PREFIX/'share'
system "./autogen.sh"
end

system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make"
system "make install"
end

if build.with? 'tests'
system "make check"
end
end
end