Author Topic: Help in understanding pkgconfig()  (Read 551 times)

Offline Archie

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8583
  • Aurum nostrum non est aurum vulgi.
Help in understanding pkgconfig()
« on: March 27, 2012, 05:13:26 PM »
Hey there.

I was instructed by the boss to rebuild Eye of Gnome and on looking at the SPEC and running rpmbuild -ba, the BuildRequires are listed as follows:

  • BuildRequires:   pkgconfig(gobject-introspection-1.0)
  • BuildRequires:   pkgconfig(libexif)
  • BuildRequires:   pkgconfig(lcms2)
  • BuildRequires:   pkgconfig(exempi-2.0)
  • BuildRequires:   pkgconfig(gtk+-3.0) >= 3.0.2
  • BuildRequires:   pkgconfig(librsvg-2.0)
  • BuildRequires:   pkgconfig(gnome-desktop-3.0) >= 2.91.2
  • BuildRequires:   pkgconfig(gsettings-desktop-schemas) >= 2.91.92
  • BuildRequires:   pkgconfig(libpeas-1.0) >= 0.7.4
  • BuildRequires:   pkgconfig(gnome-icon-theme)
  • BuildRequires:   pkgconfig(shared-mime-info)

Checking the items inside the parenthesis (), most of them are already installed on my environment. So if someone can explain this to me, I'd be most appreciative.

Peace and much respect,
Archie
Since 2006 | LiCo 401868 | Bare Metal | What is necessary is never unwise. --Sarek, 2258.42


Offline muungwana

  • Hero Member
  • *****
  • Posts: 6214
Re: Help in understanding pkgconfig()
« Reply #1 on: March 28, 2012, 02:35:37 PM »
I dont do packaging, my system is not powerful enough to run a clean environment but i have done enough building from sources to know what pkgconfig does.

pkgconfig tool reads .pc files and report its finding to whoever request them.

Some programs,usually their development packages when installed add text files at "/usr/lib/pkgconfig/" to tell other programs that want to interface with them that they are present, where they are located, what they depend on, what they provide among other things.

below is the content of "/usr/lib/pkgconfig/libexif.pc" that shows the package is present in my system and properties the package has.
Code: [Select]
prefix=/usr
exec_prefix=/usr
libdir=/usr/lib
includedir=/usr/include/libexif

Name: libexif
Description: Library for easy access to EXIF data
Requires:
Version: 0.6.18
Libs: -L${libdir} -lexif -lm
Cflags: -I${includedir}

With the above example, a script using pkgconfig can know what version of libexif is installed,where to find its header files,what options where used to build the library, what other libraries the library depends on, what the package provides.

If you install a package in a non standard location, pkgconfig tool can find these .pc files at the non standard location by setting PKG_CONFIG_PATH environmental variable.

I think those lines Archie means "use pkgconfig to see if these packages are installed".
« Last Edit: March 28, 2012, 02:42:23 PM by muungwana »
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..