# Support for pkgconfig

**URL:** <https://www.ruby-forum.com/t/support-for-pkgconfig/169335>\
**Category:** Ruby-Gnome 2\
**Created:** [June 2, 2009, 2:50pm UTC](https://www.ruby-forum.com/t/support-for-pkgconfig/169335 "2009-06-02T14:50:06Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [June 2, 2009, 2:50pm UTC](https://www.ruby-forum.com/t/support-for-pkgconfig/169335/1 "2009-06-02T14:50:06Z")

</div>

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](http://det.cable.nu)

---

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [June 2, 2009, 2:59pm UTC](https://www.ruby-forum.com/t/support-for-pkgconfig/169335/2 "2009-06-02T14:59:31Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“[ruby-gnome2-devel-en] Support for pkgconfig” on Tue, 2 Jun 2009  
14:49:05 +0200,  
Detlef R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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. 🙂

## Thanks,

kou

---

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [June 3, 2009, 12:57am UTC](https://www.ruby-forum.com/t/support-for-pkgconfig/169335/3 "2009-06-03T00:57:35Z")

</div>

Hi,

Kouhei S. schrieb:

> I agree with your suggestion.  
> You can commit your suggestion into trunk. 🙂

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

---

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [June 3, 2009, 2:48pm UTC](https://www.ruby-forum.com/t/support-for-pkgconfig/169335/4 "2009-06-03T14:48:55Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“Re: [ruby-gnome2-devel-en] Support for pkgconfig” on Wed, 3 Jun 2009  
12:10:59 +0200,  
Detlef R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [June 3, 2009, 12:12pm UTC](https://www.ruby-forum.com/t/support-for-pkgconfig/169335/5 "2009-06-03T12:12:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [June 3, 2009, 6:59pm UTC](https://www.ruby-forum.com/t/support-for-pkgconfig/169335/6 "2009-06-03T18:59:54Z")

</div>

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 🙂

> 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](http://det.cable.nu)

---

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [August 1, 2009, 12:59pm UTC](https://www.ruby-forum.com/t/support-for-pkgconfig/169335/7 "2009-08-01T12:59:15Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“Re: [ruby-gnome2-devel-en] Support for pkgconfig” on Wed, 29 Jul 2009  
09:10:48 +0200,  
“Yaakov (cygwin ports)” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [July 29, 2009, 9:10am UTC](https://www.ruby-forum.com/t/support-for-pkgconfig/169335/8 "2009-07-29T09:10:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [August 2, 2009, 11:03am UTC](https://www.ruby-forum.com/t/support-for-pkgconfig/169335/9 "2009-08-02T11:03:44Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“Re: [ruby-gnome2-devel-en] Support for pkgconfig” on Sun, 2 Aug 2009  
08:27:25 +0200,  
“Yaakov (cygwin ports)” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [August 2, 2009, 8:27am UTC](https://www.ruby-forum.com/t/support-for-pkgconfig/169335/10 "2009-08-02T08:27:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [August 4, 2009, 12:54pm UTC](https://www.ruby-forum.com/t/support-for-pkgconfig/169335/11 "2009-08-04T12:54:48Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“Re: [ruby-gnome2-devel-en] Support for pkgconfig” on Mon, 3 Aug 2009  
19:51:50 +0200,  
“Yaakov (cygwin ports)” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [August 3, 2009, 7:51pm UTC](https://www.ruby-forum.com/t/support-for-pkgconfig/169335/12 "2009-08-03T19:51:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [August 4, 2009, 9:43pm UTC](https://www.ruby-forum.com/t/support-for-pkgconfig/169335/13 "2009-08-04T21:43:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [August 4, 2009, 10:39pm UTC](https://www.ruby-forum.com/t/support-for-pkgconfig/169335/14 "2009-08-04T22:39:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [August 9, 2009, 4:59pm UTC](https://www.ruby-forum.com/t/support-for-pkgconfig/169335/15 "2009-08-09T16:59:43Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“Re: [ruby-gnome2-devel-en] Support for pkgconfig” on Tue, 4 Aug 2009  
21:43:24 +0200,  
“Yaakov (cygwin ports)” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [August 10, 2009, 2:09am UTC](https://www.ruby-forum.com/t/support-for-pkgconfig/169335/16 "2009-08-10T02:09:50Z")

</div>

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
