After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 674756 - move libgjs-gdbus and corresponding introspection files to pkglibdir
move libgjs-gdbus and corresponding introspection files to pkglibdir
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
1.32.x
Other Linux
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2012-04-24 20:37 UTC by Michael Biebl
Modified: 2012-04-26 14:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fold libgjs-gdbus.so into libgjs.so (3.18 KB, patch)
2012-04-25 19:32 UTC, Colin Walters
none Details | Review
Fold libgjs-gdbus.so into libgjs.so (3.89 KB, patch)
2012-04-26 02:02 UTC, Colin Walters
committed Details | Review

Description Michael Biebl 2012-04-24 20:37:48 UTC
libgjs-gdbus and the curresponding introspection files (GjsDBus-1.0) are currently installed system-wide although they are not meant to be used outside of gjs (e.g. libgjs-gdbus doesn't provide any header or pkg-config file).

They are basically an implementation detail used in the Gio override.

As such, they should be moved to a package-private directory like $pkglibdir.
Comment 1 Colin Walters 2012-04-24 20:55:43 UTC
Technically, "unversioned .so in /usr/lib" is a regression introduced by:

commit e5b6e9663f12541fd1b84cce56e187fa7993b180
Author: Giovanni Campagna <gcampagna@src.gnome.org>
Date:   Sat Apr 23 17:38:12 2011 +0200

    Complete porting to GDBus


So while the obvious initial response is to move them to $pkglibdir, I think an alternative we should at least consider is to simply roll the code into libgjs.so.0.  Having it be a separate shared library isn't really worth the overhead.

To implement this, GjsDBus-1.0.gir would have libgjs.so.0 as its shared-library.


If we were to try the alternative of moving it into $pkglibdir, there are two things:

1) looking up GjsDBus-1.0.typelib when code does "imports.gi.GjsDBus".

We'd need to patch gjs to use g_irepository_prepend_search_path() which is just gross =/

2) looking up libgjs-gdbus.so.0 once we've found the typelib

See https://bugzilla.gnome.org/show_bug.cgi?id=670477 for some discussion of how to use rpath for finding private shared libraries.


The "gross" part of both 1) and 2) is why I lean a lot towards just merging libgjs-gdbus.so into libgjs.so.
Comment 2 Michael Biebl 2012-04-24 21:08:51 UTC
(In reply to comment #1)
> Technically, "unversioned .so in /usr/lib" is a regression introduced by:
> 
> commit e5b6e9663f12541fd1b84cce56e187fa7993b180
> Author: Giovanni Campagna <gcampagna@src.gnome.org>
> Date:   Sat Apr 23 17:38:12 2011 +0200
> 
>     Complete porting to GDBus
> 
> 
> So while the obvious initial response is to move them to $pkglibdir, I think an
> alternative we should at least consider is to simply roll the code into
> libgjs.so.0.  Having it be a separate shared library isn't really worth the
> overhead.
> 
> To implement this, GjsDBus-1.0.gir would have libgjs.so.0 as its
> shared-library.

So you'd like to keep GjsDBus-1.0.gir in the system directories? Are the introspection files supposed to be used outside of gjs?

> If we were to try the alternative of moving it into $pkglibdir, there are two
> things:
> 
> 1) looking up GjsDBus-1.0.typelib when code does "imports.gi.GjsDBus".
> 
> We'd need to patch gjs to use g_irepository_prepend_search_path() which is just
> gross =/

Why do you consider this approach "gross"?

> 2) looking up libgjs-gdbus.so.0 once we've found the typelib
> 
> See https://bugzilla.gnome.org/show_bug.cgi?id=670477 for some discussion of
> how to use rpath for finding private shared libraries.

> The "gross" part of both 1) and 2) is why I lean a lot towards just merging
> libgjs-gdbus.so into libgjs.so.

I don't see any obvious problem with merging libgjs-gdbus into libgjs, so no real objection on this particular part.

Still, if GjsDBus-1.0.gir is supposed to be an implementation detail and not used outside of (lib)gjs, then moving the gir files to $pkglibdir is still something I'd like to see happen.

There are a lot of packages which use private gir files. Is the gjs case different or what problem do you see with g_irepository_prepend_search_path()?
Comment 3 Colin Walters 2012-04-24 21:31:24 UTC
(In reply to comment #2)

> > So you'd like to keep GjsDBus-1.0.gir in the system directories? Are the
> introspection files supposed to be used outside of gjs?

Actually, I bet we could simply not install the .gir; I don't know what would use it.  We *do* need to install the .typelib.
 
> Why do you consider this approach "gross"?

It's a bit like doing setenv("LD_LIBRARY_PATH", ...) inside a shared library, then dlopen() your dependency.  It has process-global effects, but it's really an implementation detail of gjs.

> There are a lot of packages which use private gir files. 

Similarly, those components should probably not install private .gir files, because I'm not aware of a way in which it's useful to do so.  Private .typelib files, yes.
Comment 4 Michael Biebl 2012-04-25 03:47:52 UTC
(In reply to comment #3)
> (In reply to comment #2)
> 
> > > So you'd like to keep GjsDBus-1.0.gir in the system directories? Are the
> > introspection files supposed to be used outside of gjs?
> 
> Actually, I bet we could simply not install the .gir; I don't know what would
> use it.  We *do* need to install the .typelib.

On a related note: The following GNOME applications use private typelib files in $pkglibdir and also install a corresponding gir file:
eog
gedit
gnome-documents
gnome-sushi
gtranslator

Should I file bugs against those packages to *not* install the gir file, like:

diff --git a/src/Makefile.am b/src/Makefile.am
index 8c4883f..8a1b7cd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -208,9 +208,6 @@ Gtranslator_3_0_gir_PROGRAM = $(builddir)/gtranslator
 Gtranslator_3_0_gir_FILES = $(INST_H_FILES) $(libgtranslator_c_files)
 Gtranslator_3_0_gir_INCLUDES = Gtk-3.0 GtkSource-3.0
 
-girdir = $(datadir)/gtranslator/gir-1.0
-gir_DATA = $(INTROSPECTION_GIRS)
-
 typelibdir = $(libdir)/gtranslator/girepository-1.0
 typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
Comment 5 Colin Walters 2012-04-25 14:05:17 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > (In reply to comment #2)
> > 
> > > > So you'd like to keep GjsDBus-1.0.gir in the system directories? Are the
> > > introspection files supposed to be used outside of gjs?
> > 
> > Actually, I bet we could simply not install the .gir; I don't know what would
> > use it.  We *do* need to install the .typelib.
> 
> On a related note: The following GNOME applications use private typelib files
> in $pkglibdir and also install a corresponding gir file:
> eog
> gedit
> gnome-documents
> gnome-sushi
> gtranslator
> 
> Should I file bugs against those packages to *not* install the gir file, like:

Basically, yes.  Now, I can't say with 100% certainty that those packages don't rely on the installed .gir file; but I am not personally aware of a current use case for it.
Comment 6 Colin Walters 2012-04-25 19:32:52 UTC
Created attachment 212831 [details] [review]
Fold libgjs-gdbus.so into libgjs.so

There's no strong reason to have it be a separate shared library,
and having private shared libraries in the main $(libdir) is
frowned upon.

We should also install Gjs-DBus.typelib into a package-private
typelib directory.  Fortunately, gjs_context_constructor() already
had the code to push PKGLIBDIR into the girepository search path.
Comment 7 Michael Biebl 2012-04-25 22:34:47 UTC
Folding libgjs-gdbus.so into libgjs.so still exposes those symbols (via libgjs.so) so it's kind of cheating, but keeping libgjs-gdbus.so separate and moved to $pkglibdir has its downsides, too. So I'm personally happy with this patch, as it makes it obvious that Gjs-DBus.typelib is basically used as an internal implementation detail.

As for the location of the private typelib file: I've seen both $pkglibdir and $pkglibdir/girepository-1.0. I kinda like the latter, as it keeps the typelib files in a separate folder and is somewhat symmetrical to $libdir/girepository-1.0. Is there some "official" guideline what to use? Would it make sense to document such a location for private typelib files so we have have consistency between different applications.
Comment 8 Colin Walters 2012-04-26 02:02:15 UTC
Created attachment 212842 [details] [review]
Fold libgjs-gdbus.so into libgjs.so

Now using girepository-1.0
Comment 9 Colin Walters 2012-04-26 02:02:41 UTC
(In reply to comment #7)
> Folding libgjs-gdbus.so into libgjs.so still exposes those symbols (via
> libgjs.so) so it's kind of cheating,

True, but I'm happiest with this versus the alternative of a tiny .so.
 
> As for the location of the private typelib file: I've seen both $pkglibdir and
> $pkglibdir/girepository-1.0. I kinda like the latter, as it keeps the typelib
> files in a separate folder and is somewhat symmetrical to
> $libdir/girepository-1.0. Is there some "official" guideline what to use? Would
> it make sense to document such a location for private typelib files so we have
> have consistency between different applications.

I'm not aware of a guideline (or even just precedent) here.  I've updated the patch to use girepository-1.0 though.
Comment 10 Michael Biebl 2012-04-26 14:37:18 UTC
(In reply to comment #8)
> Created an attachment (id=212842) [details] [review]
> Fold libgjs-gdbus.so into libgjs.so
> 
> Now using girepository-1.0

lgtm
Comment 11 Colin Walters 2012-04-26 14:51:51 UTC
Attachment 212842 [details] pushed as d9bf2a4 - Fold libgjs-gdbus.so into libgjs.so