New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #33877 (closed enhancement: fixed)

Opened 2 years ago

Last modified 22 months ago

Build atk, pango and gdk-pixbuf2 with GObject Introspection

Reported by: cal@… Owned by: singingwolfboy@…
Priority: Normal Milestone:
Component: ports Version: 2.0.99
Keywords: haspatch Cc: mmoll@…, suv-sf@…, Deil.Christoph@…, zach.charlop.powers@…, charlie.clark@…, dougalg@…
Port: atk pango pango-devel gdk-pixbuf2 gtk3

Description

GObject Introspection is only useful when the libraries trying to be used through introspection are built with --enable-introspection.

Current practice (e.g. in the gtk3 port) is to provide a variant for introspection, which is however a pain to maintain, because every port trying to depend on, e.g., gtk3 +introspection needs to check for a file installed by that variant, abort if it's not there and instruct the user to install the dependency with the needed variant.

Because of this, I would suggest to enable introspection by default. This adds a dependency on the gobject-introspection port. I don't see this as a blocker, because the port is a rather quick build and its dependencies will mostly be installed in systems where introspection is used anyway (e.g., cairo is needed by pango, glib2 is needed by gtk3, python27 is required by a huge number of ports).

I'll attach patches for atk, gdk-pixbuf2 and pango shortly.

Attachments

atk-enable-introspection.patch (1.1 KB) - added by cal@… 2 years ago.
Patch against the atk Portfile enabling introspection
gdk-pixbuf2-enable-introspection.patch (1.2 KB) - added by cal@… 2 years ago.
Patch against the gdk-pixbuf2 Portfile enabling introspection
pango-enable-introspection.patch (1.1 KB) - added by cal@… 2 years ago.
Patch against the pango Portfile enabling introspection
pango-devel-enable-introspection.patch (1.2 KB) - added by cal@… 2 years ago.
Patch against the pango-devel Portfile enabling introspection

Change History

Changed 2 years ago by cal@…

Patch against the atk Portfile enabling introspection

Changed 2 years ago by cal@…

Patch against the gdk-pixbuf2 Portfile enabling introspection

Changed 2 years ago by cal@…

Patch against the pango Portfile enabling introspection

Changed 2 years ago by cal@…

Patch against the pango-devel Portfile enabling introspection

comment:1 Changed 2 years ago by cal@…

Any comments? Should I just go ahead and commit those, since all those ports are marked openmaintainer?

comment:2 Changed 2 years ago by ryandesign@…

Enabling introspection has previously caused lots of problems. I don't know what introspection is or what's going on. If you have reviewed the previous problems, and come to the conclusion that they won't happen again, then proceed at your discretion. I agree if the feature is useful and does not cause problems it should be turned on.

comment:3 follow-up: ↓ 4 Changed 2 years ago by msm@…

I brought this up a few months ago here: #33054

The patches I generated allow for introspection to be turned off if needed.

@ryandesign Introspection allows for a dynamic analysis of the api for gobject/gdk/gtk and a few others. For one this allows python developers to move forward with using gtk3 as PyGtk is going to be deprecated.

comment:4 in reply to: ↑ 3 ; follow-up: ↓ 5 Changed 2 years ago by cal@…

Replying to msm@…:

The patches I generated allow for introspection to be turned off if needed.

Yes, I was aware of this. This method has the problem that it can't be directly depended upon, because the MacPorts dependency engine doesn't handle variants (i.e. you can't easily depend on gtk3 +introspection). This makes writing Portfiles using introspection (imho unnecessarily) hard and often requires user interaction to get the dependencies right.

comment:5 in reply to: ↑ 4 Changed 2 years ago by msm@…

Replying to cal@…:

i.e. you can't easily depend on gtk3 +introspection

That makes sense.

comment:6 Changed 2 years ago by mmoll@…

  • Cc mmoll@… added

Cc Me!

comment:7 Changed 2 years ago by mmoll@…

  • Cc mmoll@… removed

Cc Me!

comment:8 Changed 2 years ago by mmoll@…

  • Cc mmoll@… added

Cc Me!

comment:9 Changed 2 years ago by suv-sf@…

  • Cc suv-sf@… added

Cc Me!

comment:10 Changed 2 years ago by Deil.Christoph@…

  • Cc Deil.Christoph@… added

Cc Me!

comment:11 Changed 2 years ago by zach.charlop.powers@…

  • Cc zach.charlop.powers@… added

Cc Me!

comment:12 Changed 22 months ago by charlie.clark@…

I've just tried the Pango patch (+ py27-gobject3) but Pango is not coming through.

Type "help", "copyright", "credits" or "license" for more information.
>>> from gi.repository import cairo
>>> from gi.repository import Pango
ERROR:root:Could not find any typelib for Pango
Traceback (most recent call last):

comment:13 Changed 22 months ago by cal@…

Which files did your pango install? Check with port contents pango. Also make sure you're not getting the binary download from the buildbot without the changes in the Portfile, but force build from source: port -s install pango.

comment:14 follow-up: ↓ 18 Changed 22 months ago by charlie.clark@…

Yes, I did trip up over the different behaviour of port -D . build and port -D . install

After that I was still hitting problems until I added /opt/local/lib to the LD_LIBRARY_PATH:

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/local/lib

Result: Weasyprint, http://www.weasyprint.org now runs on Mac OS.

comment:15 Changed 22 months ago by cal@…

This is a known problem and I'm going to fix this by modifying gobject-introspection to include the full path of the to-be-loaded libraries in the typelib file. Unfortunately upstream gobject-introspection disregards Mac OS X' linking style here (which works fine as long as the libraries are located in /usr/lib).

comment:16 Changed 22 months ago by charlie.clark@…

Great! I'm sure I'm not the only one who struggles with some of the unix environment variables. I managed to destroy my LD_LIBRARY_PATH earlier and had to reinstall py-Gobject3 to get things working again.

comment:17 Changed 22 months ago by charlie.clark@…

  • Cc charlie.clark@… added

Cc Me!

comment:18 in reply to: ↑ 14 Changed 22 months ago by dougalg@…

Charlie, can you clarify how you got it to work? I'm stuck at the typelib error, and cannot get pango to install. Do I need to manually add these patches or have they been moved into the main repository already?

I've already added opt/local/lib to my LD_LIBRARY_PATH

Any help would be appreciated, thanks.

Replying to charlie.clark@…:

Yes, I did trip up over the different behaviour of port -D . build and port -D . install

After that I was still hitting problems until I added /opt/local/lib to the LD_LIBRARY_PATH:

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/local/lib


Result: Weasyprint, http://www.weasyprint.org now runs on Mac OS.

comment:19 Changed 22 months ago by dougalg@…

  • Cc dougalg@… added

Cc Me!

comment:20 follow-up: ↓ 21 Changed 22 months ago by dougalg@…

OK, I found and looked at the portfile, then patched it with the patch. Now when I try to build it fails with:

Error: Unable to open port: invalid command name "CC=/usr/bin/clang"

Thank you if you have any idea what might be wrong.

comment:21 in reply to: ↑ 20 ; follow-up: ↓ 24 Changed 22 months ago by ryandesign@…

Replying to dougalg@…:

Error: Unable to open port: invalid command name "CC=/usr/bin/clang"

I'm not sure which of the four patches in this ticket you're talking about. The only thing I can imagine is that you did not actually use the patch(es), but rather tried to make equivalent changes to the Portfile(s) manually, and ended up inserting something like the following, which is a syntax error:

build.env-append
    CC=${configure.cc}

Rather than the following, which is what you want:

build.env-append \
    CC=${configure.cc}

comment:22 Changed 22 months ago by cal@…

  • Port changed from atk pango pango-devel gdk-pixbuf2 to atk pango pango-devel gdk-pixbuf2 gtk3

GObject Introspection from MacPorts as of r95227 generates .gir and .typelib files with absolute paths. This should lift any requirements to specify DYLD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH.

In order for this change to work, the .gir and .typelib files must be regenerated, i.e. the ports installing these files must be rebuilt.

comment:23 Changed 22 months ago by cal@…

  • Status changed from new to closed
  • Resolution set to fixed

Introspection was enabled for

comment:24 in reply to: ↑ 21 Changed 22 months ago by dougalg@…

Thank you for your help. The patch did indeed not patch all the lines so I manually added those which it missed, so you must be right. However, since it's been added to the trunk now, I just updated and it worked great!

Replying to ryandesign@…:

I'm not sure which of the four patches in this ticket you're talking about. The only thing I can imagine is that you did not actually use the patch(es), but rather tried to make equivalent changes to the Portfile(s) manually, and ended up inserting something like the following, which is a syntax error...

Note: See TracTickets for help on using tickets.