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 693471 - Problems using it in vala: gir does not contain proper .h file; there is no .vapi file
Problems using it in vala: gir does not contain proper .h file; there is no ....
Status: RESOLVED OBSOLETE
Product: libgweather
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: future
Assigned To: libgweather-maint
libgweather-maint
Depends on:
Blocks:
 
 
Reported: 2013-02-09 10:41 UTC by Paolo Borelli
Modified: 2021-06-09 21:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add a global gweather.h header file (3.12 KB, patch)
2013-02-16 09:55 UTC, Paolo Borelli
committed Details | Review
patch proposal for the vala support (2.38 KB, patch)
2013-08-30 13:00 UTC, Evgeny Bobkin
none Details | Review
patch proposal for the vala support (2.38 KB, patch)
2013-08-30 13:40 UTC, Evgeny Bobkin
none Details | Review
patch proposal for the vala support (2.41 KB, patch)
2013-08-30 13:42 UTC, Evgeny Bobkin
committed Details | Review

Description Paolo Borelli 2013-02-09 10:41:52 UTC
There are a few problems when trying to use libgweather in vala:

1) the gir does not contain the proper .h file
2) there is no .vapi file

I worked around in the following way:

-GWeather_3_0_gir_SCANNERFLAGS = --identifier-prefix=GWeather --symbol-prefix=gweather --pkg-export=gweather-3.0
+GWeather_3_0_gir_SCANNERFLAGS = --identifier-prefix=GWeather --symbol-prefix=gweather --pkg-export=gweather-3.0 --c-include "libgweather/gweather-weather.h,libgweather/location-entry.h"

in the libgweather makefile and then generated a vapi with 
vapigen --pkg gio-2.0 --pkg gtk+-3.0 --library gweather-3.0 GWeather-3.0.gir


I think that

1) it would be better to have a single <libgweather/gweather.h> header file
2) we should fix the gir generation to include that header
3) we should ship the vapi file either in libgweather itself or in vala
Comment 1 Evan Nemerson 2013-02-09 11:09:37 UTC
(In reply to comment #0)
> There are a few problems when trying to use libgweather in vala:
> 
> 1) the gir does not contain the proper .h file
> 2) there is no .vapi file
> 
> I worked around in the following way:
> 
> -GWeather_3_0_gir_SCANNERFLAGS = --identifier-prefix=GWeather
> --symbol-prefix=gweather --pkg-export=gweather-3.0
> +GWeather_3_0_gir_SCANNERFLAGS = --identifier-prefix=GWeather
> --symbol-prefix=gweather --pkg-export=gweather-3.0 --c-include
> "libgweather/gweather-weather.h,libgweather/location-entry.h"

This should be --c-include "libgweather/gweather-weather.h" --c-include "libgweather/location-entry.h".

> in the libgweather makefile and then generated a vapi with 
> vapigen --pkg gio-2.0 --pkg gtk+-3.0 --library gweather-3.0 GWeather-3.0.gir
> 
> 
> I think that
> 
> 1) it would be better to have a single <libgweather/gweather.h> header file

From Vala's perspective, this is really important if the bindings are not distributed with gweather.  Since G-I doesn't support per-type or per-symbol C headers we end up including all the library's headers.  If gweather then adds a header we start adding that to all generated code, but gweather may be older than valac, in which case we are including a header which doesn't exist.

Distributing the VAPI with gweather means that the VAPI is always targeted for the right version of gweather.

I would also argue that a single include (or at least a small number) is nicer for C consumers as well.  Most GNOME libraries are already using that convention.

> 2) we should fix the gir generation to include that header
> 3) we should ship the vapi file either in libgweather itself or in vala

From Vala's point of view, shipping the file with gweather is preferred.  Some reasons why are mentioned on https://live.gnome.org/Vala/UpstreamGuide

I'm happy to help with maintenance just as I would if the bindings were distributed with Vala.  If you're okay with distributing bindings with gweather I can throw together a patch.
Comment 2 Giovanni Campagna 2013-02-10 16:41:17 UTC
I personally don't have an interest in Vala bindings for GWeather (although I care about PyGObject and gjs, so the GIR should be usable), thus if you can prepare a patch it would be very helpful.
Otherwise I'll look at this soon.
Comment 3 Paolo Borelli 2013-02-10 17:50:01 UTC
Do you agree on a global gweather.h header file?
Comment 4 Giovanni Campagna 2013-02-10 19:27:53 UTC
Yeah, that's fine, although I'd avoid forcing single includes, at least for the first stable release.
Comment 5 Paolo Borelli 2013-02-16 09:55:56 UTC
Created attachment 236356 [details] [review]
Add a global gweather.h header file
Comment 6 Giovanni Campagna 2013-02-16 12:50:47 UTC
Review of attachment 236356 [details] [review]:

Looks good!
Comment 7 Paolo Borelli 2013-02-16 13:39:42 UTC
Comment on attachment 236356 [details] [review]
Add a global gweather.h header file

pushed.

I'll try to get to the vapi stuff later or wait for Evan
Comment 8 Evgeny Bobkin 2013-08-30 13:00:34 UTC
Created attachment 253603 [details] [review]
patch proposal for the vala support

me and Paolo can take care of its maintenance in future.
Comment 9 Evgeny Bobkin 2013-08-30 13:40:12 UTC
Created attachment 253608 [details] [review]
patch proposal for the vala support
Comment 10 Evgeny Bobkin 2013-08-30 13:42:22 UTC
Created attachment 253609 [details] [review]
patch proposal for the vala support
Comment 11 Giovanni Campagna 2013-08-30 13:53:35 UTC
Review of attachment 253609 [details] [review]:

Looks good to me
Comment 12 Evan Nemerson 2013-08-30 17:10:25 UTC
With this patch Vala would have to be installed, even if you didn't want to build the VAPI, since it depends on vapigen.m4.  Generally, people prefer to copy vapigen.m4 to their macro directory.

vapigen.m4 code is at https://git.gnome.org/browse/vala/tree/vapigen/vapigen.m4
Comment 13 Giovanni Campagna 2013-08-31 12:28:43 UTC
(In reply to comment #12)
> With this patch Vala would have to be installed, even if you didn't want to
> build the VAPI, since it depends on vapigen.m4.  Generally, people prefer to
> copy vapigen.m4 to their macro directory.
> 
> vapigen.m4 code is at https://git.gnome.org/browse/vala/tree/vapigen/vapigen.m4

Nah, vala is part of the default installation of gnome, and is available in ostree and jhbuild.
Also, it's a dependency only for git builds, so I'm fine with not having vapigen.m4 (and not having to keep it up to date)
Comment 14 Evgeny Bobkin 2013-09-01 10:50:04 UTC
(In reply to comment #12)
> With this patch Vala would have to be installed, even if you didn't want to
> build the VAPI, since it depends on vapigen.m4.  Generally, people prefer to
> copy vapigen.m4 to their macro directory.
> 
> vapigen.m4 code is at https://git.gnome.org/browse/vala/tree/vapigen/vapigen.m4

Hmm, I do not understand, why it would require vala to be installed anyway. I thought, that I have a m4_ifdef([VAPIGEN_CHECK] check added for that case.

I have just for fun uninstalled vala everywhere, and libgweather builds fine anyway, without generating any vapi file of course:-) 

libgweather-3.9.91 configure summary:

	Prefix:				/home/ibqn/opt/gnome
	Source code location:		.
	Compiler:			gcc
	Introspection support:          yes
	Build Vala bindings:            auto


That is why I am a bit confused?!:-/
Comment 15 GNOME Infrastructure Team 2021-06-09 21:05:47 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/libgweather/-/issues/117.