Support for pkgconfig

Hi,

till now one has to load a ruby-gnome library to see, which version is
installed.

So I will suggest to provide pkg-config files. They shall use the
original pkg-config name of the base library like gtk ±2.0.pc and add
-ruby in front of the .pc, so it will look like gtk ±2.0-ruby.pc

This will have two benefits: The test if a library is installed is much
faster and the build systems of i.e. linux distributors don’t need to
have an X-Server installed.

Cheers, detlef


http://det.cable.nu

Hi,

In [email protected]
“[ruby-gnome2-devel-en] Support for pkgconfig” on Tue, 2 Jun 2009
14:49:05 +0200,
Detlef R. [email protected] wrote:

till now one has to load a ruby-gnome library to see, which version is
installed.

So I will suggest to provide pkg-config files. They shall use the
original pkg-config name of the base library like gtk ±2.0.pc and add
-ruby in front of the .pc, so it will look like gtk ±2.0-ruby.pc

This will have two benefits: The test if a library is installed is much
faster and the build systems of i.e. linux distributors don’t need to
have an X-Server installed.

I agree with your suggestion.
You can commit your suggestion into trunk. :slight_smile:

Thanks,

kou

Hi,

Kouhei S. schrieb:

I agree with your suggestion.
You can commit your suggestion into trunk. :slight_smile:

because the changes are a little bit bigger, I’ll post 'em first here.
For now the name, description and version arguments are supported.

bonobo, bonoboui, gdkpixbuf, gstreamer, gtkglext and libart are not
supported for now, cause they don’t have a static version information.

Cheers, detlef

Hi,

In [email protected]
“Re: [ruby-gnome2-devel-en] Support for pkgconfig” on Wed, 3 Jun 2009
12:10:59 +0200,
Detlef R. [email protected] wrote:

bonobo, bonoboui, gdkpixbuf, gstreamer, gtkglext and libart are not
supported for now, cause they don’t have a static version information.

I changed the patch a little bit, so it takes now the version, that is
delivered by pkg-config for gstreamer, gtkglext and libart.

What about passing .pc related information as arguments of
create_pkg_config_file instead of creating pkgconfig.rb?

def create_pkg_config_file(module_name, h_file_name, pc_file)

end

You can write
File.new(@pc_out_file_name, File::CREAT|File::TRUNC|File::RDWR, 0644)
as
File.new(@pc_out_file_name, “w+”, 0644)

For gdkpixbuf the pc-file got build, but I have no clue how to install
it.

Changes in create_top_makefile should be done in ./src/depend
file. (./depend for Ruby/GdkPixbuf)

bonobo and bonoboui provide no version information in the ruby version.
Maybe this shall be changed. For now I have excluded them.

You can add it.

Thanks,

kou

Hi,

Detlef R. schrieb:

bonobo, bonoboui, gdkpixbuf, gstreamer, gtkglext and libart are not
supported for now, cause they don’t have a static version information.

I changed the patch a little bit, so it takes now the version, that is
delivered by pkg-config for gstreamer, gtkglext and libart.

For gdkpixbuf the pc-file got build, but I have no clue how to install
it.

bonobo and bonoboui provide no version information in the ruby version.
Maybe this shall be changed. For now I have excluded them.

Cheers, detlef

Hi,

Kouhei S. schrieb:

What about passing .pc related information as arguments of
create_pkg_config_file instead of creating pkgconfig.rb?

the simplest solutions often the best :slight_smile:

Changes in create_top_makefile should be done in ./src/depend
file. (./depend for Ruby/GdkPixbuf)

Ahh, learned something new. Thanks!

bonobo and bonoboui provide no version information in the ruby version.
Maybe this shall be changed. For now I have excluded them.

You can add it.

Done and committed.

Cheers, detlef


http://det.cable.nu

Hi,

In [email protected]
“Re: [ruby-gnome2-devel-en] Support for pkgconfig” on Wed, 29 Jul 2009
09:10:48 +0200,
“Yaakov (cygwin ports)” [email protected] wrote:

  1. The DESTDIR build is broken because nothing assures that
    $(libdir)/pkgconfig exists before installing files there. Patch against
    SVN trunk attached.

Please commit.

  1. If vte-0.20 is present, no vte-ruby.pc is created at all, and hence
    ‘make install’ fails due to the missing file. I can make a patch for
    this as well, but exactly how depends on:

Please.

  1. What exactly is Version: supposed to represent, the rg2 version or
    the version of the C library it is built against? Most contain the
    latter, except for glib/gtk/rsvg which all use
    glib/src/rbglib.h(RBGLIB_*_VERSION) and hence have “0.19.1”. IMHO it
    should be the rg2 version, but whichever way it should at least be
    consistent.

We should provide Ruby-GNOME2 version as BINDING_VERSION.
Could you fix it like Ruby/GLib2, Ruby/GTK+ and Ruby/RSVG?

Thanks,

kou

Detlef R. wrote:

Done and committed.

I have several issues related to the pkgconfig files in 0.19.1:

  1. The DESTDIR build is broken because nothing assures that
    $(libdir)/pkgconfig exists before installing files there. Patch against
    SVN trunk attached.

  2. If vte-0.20 is present, no vte-ruby.pc is created at all, and hence
    ‘make install’ fails due to the missing file. I can make a patch for
    this as well, but exactly how depends on:

  3. What exactly is Version: supposed to represent, the rg2 version or
    the version of the C library it is built against? Most contain the
    latter, except for glib/gtk/rsvg which all use
    glib/src/rbglib.h(RBGLIB_*_VERSION) and hence have “0.19.1”. IMHO it
    should be the rg2 version, but whichever way it should at least be
    consistent.

Yaakov
Ruby/GtkSourceView2 maintainer

Hi,

In [email protected]
“Re: [ruby-gnome2-devel-en] Support for pkgconfig” on Sun, 2 Aug 2009
08:27:25 +0200,
“Yaakov (cygwin ports)” [email protected] wrote:

Kouhei S. wrote:

Yaakov (cygwin ports) wrote:

  1. The DESTDIR build is broken because nothing assures that
    $(libdir)/pkgconfig exists before installing files there. Patch against
    SVN trunk attached.

Please commit.

Done, r3682.

Thanks.

should be the rg2 version, but whichever way it should at least be
consistent.

We should provide Ruby-GNOME2 version as BINDING_VERSION.
Could you fix it like Ruby/GLib2, Ruby/GTK+ and Ruby/RSVG?

Patch attached.

First please do 2). 3) is the next step.

I noticed that create_pkg_config_file’s signature is strange
after I saw your patch. create_pkg_config_file’s signature
should be:
def create_pkg_config_file(out_file_name, version=nil)

And we provide ruby_gnome2_version method:
def ruby_gnome2_version(glib_source_directory=nil)
glib_source_directory ||= File.join(File.dirname(FILE), “…”)
# extract version from File.join(glib_source_directory, “rbglib.h”)
version
end

We will use them like the following in extconf.rb:
create_pkg_config_file(“…-ruby.pc”, ruby_gnome2_version)

What do you think about this?

Thanks,

kou

Kouhei S. wrote:

Yaakov (cygwin ports) wrote:

  1. The DESTDIR build is broken because nothing assures that
    $(libdir)/pkgconfig exists before installing files there. Patch against
    SVN trunk attached.

Please commit.

Done, r3682.

  1. If vte-0.20 is present, no vte-ruby.pc is created at all, and hence
    ‘make install’ fails due to the missing file. I can make a patch for
    this as well, but exactly how depends on:

Please.

  1. What exactly is Version: supposed to represent, the rg2 version or
    the version of the C library it is built against? Most contain the
    latter, except for glib/gtk/rsvg which all use
    glib/src/rbglib.h(RBGLIB_*_VERSION) and hence have “0.19.1”. IMHO it
    should be the rg2 version, but whichever way it should at least be
    consistent.

We should provide Ruby-GNOME2 version as BINDING_VERSION.
Could you fix it like Ruby/GLib2, Ruby/GTK+ and Ruby/RSVG?

Patch attached.

Yaakov
Ruby/GtkSourceView2 maintainer

Hi,

In [email protected]
“Re: [ruby-gnome2-devel-en] Support for pkgconfig” on Mon, 3 Aug 2009
19:51:50 +0200,
“Yaakov (cygwin ports)” [email protected] wrote:

And we provide ruby_gnome2_version method:

Patch against trunk attached for review.

Please commit. If there is a bug, we will fix it after your
commit.

Thanks,

kou

Kouhei S. wrote:

First please do 2). 3) is the next step.

The patch does both 2) and 3), since they are related.

I noticed that create_pkg_config_file’s signature is strange
after I saw your patch. create_pkg_config_file’s signature
should be:
def create_pkg_config_file(out_file_name, version=nil)

And we provide ruby_gnome2_version method:
def ruby_gnome2_version(glib_source_directory=nil)
glib_source_directory ||= File.join(File.dirname(FILE), “…”)
# extract version from File.join(glib_source_directory, “rbglib.h”)
version
end

We will use them like the following in extconf.rb:
create_pkg_config_file("…-ruby.pc", ruby_gnome2_version)

What do you think about this?

Patch against trunk attached for review.

Yaakov

Kouhei S. wrote:

Please commit. If there is a bug, we will fix it after your
commit.

I discovered an issue with the patch. Two .pc files were renamed:
libgnome-2.0-ruby.pc -> libgnomeui-2.0-ruby.pc and poppler-ruby.pc ->
poppler-glib-ruby.pc.

The problem is that create_pkg_config_file() requires that the ruby .pc
filename match that of the respective C library with the ‘-ruby.pc’
suffix. In the first case, Ruby/Gnome2 binds both libgnome-2.0 and
libgnomeui-2.0; in the second, Ruby/Poppler bindings libpoppler-glib but
the module is simply called ‘poppler’. Furthermore, with gtkmozembed,
the .pc file may be any of 5 different names but the ruby module has the
same name regardless of which it is built against.

Perhaps for consistency we should consider changing the naming scheme of
the .pc files:

def create_pkg_config_file(ruby_mod_name, c_package, version=nil)
version ||= PKGConfig.modversion c_package
pc_file = File.new(‘ruby-’ + ruby_mod_name + ‘.pc’, ‘w+’, 0644)

with each module doing:

create_pkg_config_file(PACKAGE_NAME, PACKAGE_ID, ruby_gnome2_version)

thereby creating ruby-glib2.pc, ruby-atk.pc, ruby-poppler.pc, etc.

OTOH, as there was already one (unstable) release with the existing
names, would it be too late to change this?

Please advise.

Yaakov

Yaakov (cygwin ports) wrote:

Perhaps for consistency we should consider changing the naming scheme of
the .pc files:

def create_pkg_config_file(ruby_mod_name, c_package, version=nil)
version ||= PKGConfig.modversion c_package
pc_file = File.new(‘ruby-’ + ruby_mod_name + ‘.pc’, ‘w+’, 0644)

with each module doing:

create_pkg_config_file(PACKAGE_NAME, PACKAGE_ID, ruby_gnome2_version)

thereby creating ruby-glib2.pc, ruby-atk.pc, ruby-poppler.pc, etc.

Patch against trunk attached. Please let me know how you wish to
proceed.

Yaakov

Hi,

In [email protected]
“Re: [ruby-gnome2-devel-en] Support for pkgconfig” on Tue, 4 Aug 2009
21:43:24 +0200,
“Yaakov (cygwin ports)” [email protected] wrote:

def create_pkg_config_file(ruby_mod_name, c_package, version=nil)
version ||= PKGConfig.modversion c_package
pc_file = File.new(‘ruby-’ + ruby_mod_name + ‘.pc’, ‘w+’, 0644)

with each module doing:

create_pkg_config_file(PACKAGE_NAME, PACKAGE_ID, ruby_gnome2_version)

thereby creating ruby-glib2.pc, ruby-atk.pc, ruby-poppler.pc, etc.

OK. Please commit your patch.

OTOH, as there was already one (unstable) release with the existing
names, would it be too late to change this?

We can change it because the current naming rule doesn’t
follow convention. Many .pc uses prefix (e.g. Clutter uses
clutter- prefix) not suffix.

Packagers, I’m so sorry…

Thanks,

kou

Kouhei S. wrote:

OK. Please commit your patch.

Committed to trunk, r3684.

Packagers, I’m so sorry…

0.19 is meant to be an unstable/development series, after all.

Yaakov