Thread: added pkg-config script

added pkg-config script

From
phoemix@harmless.hu (Czuczy Gergely)
Date:
Hello,

I've added a pkg-config script.
The "diff -rc -x configure from to" output is attached.

Changes:
1) added config/postgresql.pc.in, template for the pkg-config config file
2) extended the install and clean target at config/Makefile
3) added the pkgconfigdirs var to src/Makefile.global.in
4) added --with-pkgconfig-dir to configure.in, defaults to /usr/lib/pkgconfig/

Bye,

Gergely Czuczy
mailto: phoemix@harmless.hu
PGP: http://phoemix.harmless.hu/phoemix.pgp

Weenies test. Geniuses solve problems that arise.

Attachment

Re: added pkg-config script

From
Tom Lane
Date:
phoemix@harmless.hu (Czuczy Gergely) writes:
> I've added a pkg-config script.
> The "diff -rc -x configure from to" output is attached.

Considering that this patch is lacking both the script itself, and any
documentation, it's not got much hope of being accepted...

But before you run off to produce those things, I would suggest
putting up a proposal on pghackers about what you want to do
and why.  In particular, what problem are you solving that isn't
already solved?

            regards, tom lane

Re: added pkg-config script

From
phoemix@harmless.hu (Czuczy Gergely)
Date:
I've attached a corrected patch, the postgresql.pc.in was missing.

On Sun, Aug 22, 2004 at 01:49:08PM -0400, Tom Lane wrote:
> phoemix@harmless.hu (Czuczy Gergely) writes:
> > I've added a pkg-config script.
> > The "diff -rc -x configure from to" output is attached.
>
> Considering that this patch is lacking both the script itself, and any
> documentation, it's not got much hope of being accepted...
What kind of documentation does it need? i don't see.

>
> But before you run off to produce those things, I would suggest
> putting up a proposal on pghackers about what you want to do
> and why.  In particular, what problem are you solving that isn't
The most common way to get a package's libflags and cflags is the solution
that pkg-config offers. the problem with pg_config that it's not in the path,
it's place depends on the prefix, so to use it required an extra effort.
pkg-config is a standardized way to check for a package's libs and cflags.
The patch I've made adds the generation of this script, and extends the Makefiles
to install them. The place of this .pc (Pkg-Config) file is at /usr/lib/pkgconfig/,
but with the patch it can be altered with --with-pkgconfig-dir.
> already solved?
I haven't seen any pkg-config support in postgres, so, I've assumed
it hasn't been solved.

>             regards, tom lane

Bye,

Gergely Czuczy
mailto: phoemix@harmless.hu
PGP: http://phoemix.harmless.hu/phoemix.pgp

Weenies test. Geniuses solve problems that arise.

Attachment

Re: added pkg-config script

From
Stephan Szabo
Date:
On Sun, 22 Aug 2004, Czuczy Gergely wrote:

> I've attached a corrected patch, the postgresql.pc.in was missing.
>
> On Sun, Aug 22, 2004 at 01:49:08PM -0400, Tom Lane wrote:
> > phoemix@harmless.hu (Czuczy Gergely) writes:
> > > I've added a pkg-config script.
> > > The "diff -rc -x configure from to" output is attached.
> >
> > Considering that this patch is lacking both the script itself, and any
> > documentation, it's not got much hope of being accepted...
> What kind of documentation does it need? i don't see.

Well, you've added a configure option, so the installation sgml at the
very least.  If it's meant to replace or do the same general thing as
pg_config, then the places pg_config is mentioned in mainline docs should
probably be added to as well (libpq and xfunc).

> > But before you run off to produce those things, I would suggest
> > putting up a proposal on pghackers about what you want to do
> > and why.  In particular, what problem are you solving that isn't
> The most common way to get a package's libflags and cflags is the solution
> that pkg-config offers. the problem with pg_config that it's not in the path,
> it's place depends on the prefix, so to use it required an extra effort.
> pkg-config is a standardized way to check for a package's libs and cflags.
> The patch I've made adds the generation of this script, and extends the Makefiles
> to install them. The place of this .pc (Pkg-Config) file is at /usr/lib/pkgconfig/,
> but with the patch it can be altered with --with-pkgconfig-dir.

How is the pkg-config stuff meant to interact with having multiple
different installations on a machine? I might, for example, have two or
three copies of the same version of postgresql with different options
under some circumstances.

Re: added pkg-config script

From
phoemix@harmless.hu (Czuczy Gergely)
Date:
On Sun, Aug 22, 2004 at 11:39:38AM -0700, Stephan Szabo wrote:
>
> On Sun, 22 Aug 2004, Czuczy Gergely wrote:
>
> > I've attached a corrected patch, the postgresql.pc.in was missing.
> >
> > On Sun, Aug 22, 2004 at 01:49:08PM -0400, Tom Lane wrote:
> > > phoemix@harmless.hu (Czuczy Gergely) writes:
> > > > I've added a pkg-config script.
> > > > The "diff -rc -x configure from to" output is attached.
> > >
> > > Considering that this patch is lacking both the script itself, and any
> > > documentation, it's not got much hope of being accepted...
> > What kind of documentation does it need? i don't see.
>
> Well, you've added a configure option, so the installation sgml at the
> very least.  If it's meant to replace or do the same general thing as
> pg_config, then the places pg_config is mentioned in mainline docs should
> probably be added to as well (libpq and xfunc).
not replaces, just an alternative.

>
> > > But before you run off to produce those things, I would suggest
> > > putting up a proposal on pghackers about what you want to do
> > > and why.  In particular, what problem are you solving that isn't
> > The most common way to get a package's libflags and cflags is the solution
> > that pkg-config offers. the problem with pg_config that it's not in the path,
> > it's place depends on the prefix, so to use it required an extra effort.
> > pkg-config is a standardized way to check for a package's libs and cflags.
> > The patch I've made adds the generation of this script, and extends the Makefiles
> > to install them. The place of this .pc (Pkg-Config) file is at /usr/lib/pkgconfig/,
> > but with the patch it can be altered with --with-pkgconfig-dir.
>
> How is the pkg-config stuff meant to interact with having multiple
> different installations on a machine? I might, for example, have two or
> three copies of the same version of postgresql with different options
> under some circumstances.
it doesn't. pkg-config is a very simple thing, good for generalism. what
you are talking about is an extrem environment, as I noticed, less then
1% of the users have this. on the other side the vast majority's configure, pmk,
and so on scripts do not find the required config script, because it's out-of-path,
and has to be given by hand. for these situation pkg-config provides a simple
solution, adds a general file to the place, and whenever a configure/pmk/etc script
needs the libs/cflags/so on it can ask pkg-config for it. no need to search for
pg_config's location. anyway, if you want to have multiple installations, it can be
solved but that will break the generalism that pkg-config provides. adding some
kind of suffix to the .pc file, like postgresql-myinstance.pc, or so. But, as I've
said it will break the generalism, because the configure/pmk/etc scripts look for
'postgresql', not 'postgresql-myinstance'.

Bye,

Gergely Czuczy
mailto: phoemix@harmless.hu
PGP: http://phoemix.harmless.hu/phoemix.pgp

Weenies test. Geniuses solve problems that arise.

Attachment

Re: added pkg-config script

From
Stephan Szabo
Date:
On Sun, 22 Aug 2004, Czuczy Gergely wrote:

> On Sun, Aug 22, 2004 at 11:39:38AM -0700, Stephan Szabo wrote:
> >
> > On Sun, 22 Aug 2004, Czuczy Gergely wrote:
> >
> > > I've attached a corrected patch, the postgresql.pc.in was missing.
> > >
> > > On Sun, Aug 22, 2004 at 01:49:08PM -0400, Tom Lane wrote:
> > > > phoemix@harmless.hu (Czuczy Gergely) writes:
> > > > > I've added a pkg-config script.
> > > > > The "diff -rc -x configure from to" output is attached.
> > > >
> > > > Considering that this patch is lacking both the script itself, and any
> > > > documentation, it's not got much hope of being accepted...
> > > What kind of documentation does it need? i don't see.
> >
> > Well, you've added a configure option, so the installation sgml at the
> > very least.  If it's meant to replace or do the same general thing as
> > pg_config, then the places pg_config is mentioned in mainline docs should
> > probably be added to as well (libpq and xfunc).
> not replaces, just an alternative.

Well, it probably should get a mention in those places.  In addition, the
dangers of the below need to be mentioned somewhere.

> > > > But before you run off to produce those things, I would suggest
> > > > putting up a proposal on pghackers about what you want to do
> > > > and why.  In particular, what problem are you solving that isn't
> > > The most common way to get a package's libflags and cflags is the solution
> > > that pkg-config offers. the problem with pg_config that it's not in the path,
> > > it's place depends on the prefix, so to use it required an extra effort.
> > > pkg-config is a standardized way to check for a package's libs and cflags.
> > > The patch I've made adds the generation of this script, and extends the Makefiles
> > > to install them. The place of this .pc (Pkg-Config) file is at /usr/lib/pkgconfig/,
> > > but with the patch it can be altered with --with-pkgconfig-dir.
> >
> > How is the pkg-config stuff meant to interact with having multiple
> > different installations on a machine? I might, for example, have two or
> > three copies of the same version of postgresql with different options
> > under some circumstances.
>
> it doesn't. pkg-config is a very simple thing, good for generalism. what
> you are talking about is an extrem environment, as I noticed, less then
> 1% of the users have this. on the other side the vast majority's configure, pmk,
> and so on scripts do not find the required config script, because it's out-of-path,
> and has to be given by hand. for these situation pkg-config provides a simple
> solution, adds a general file to the place, and whenever a configure/pmk/etc script
> needs the libs/cflags/so on it can ask pkg-config for it. no need to search for
> pg_config's location. anyway, if you want to have multiple installations, it can be
> solved but that will break the generalism that pkg-config provides. adding some
> kind of suffix to the .pc file, like postgresql-myinstance.pc, or so. But, as I've
> said it will break the generalism, because the configure/pmk/etc scripts look for
> 'postgresql', not 'postgresql-myinstance'.

Can the users do that without manually modifying the file with the patch
you've provided?  It seems like there'd be a non-zero chance of those
outside packages using pkg-config actively getting incorrect results for
people with multiple installations. And, those outside packages would have
no way to get the "right" information unless they allow you to change the
name to look for, which makes them effectively broken for those users.


Re: added pkg-config script

From
Peter Eisentraut
Date:
Czuczy Gergely wrote:
> I've added a pkg-config script.

Since the PostgreSQL source tree offers at least three APIs (libpq,
ecpg, server), you should be adding at least three pkg-config scripts.

I agree with others, however, that we're fine with pg_config and don't
want to add more mechanisms of the kind.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


Re: added pkg-config script

From
Tom Lane
Date:
phoemix@harmless.hu (Czuczy Gergely) writes:
> pkg-config is a standardized way to check for a package's libs and cflags.

Standardized by whom?  It seems like a fairly dubious idea to me, since
it can't support multiple installations on one machine.  I see no such
directory as /usr/lib/pkgconfig/ on my own machines anyway.

> The place of this .pc (Pkg-Config) file is at /usr/lib/pkgconfig/,
> but with the patch it can be altered with --with-pkgconfig-dir.

[ blink ] Doesn't that immediately defeat the claimed purpose?  If you
don't know where to look for the .pc file then you are back with the
same complaint you lodge against pg_config.

What would seem saner to me is a switch that determines whether to
install it or not, period.  The "not" case is required for non-root
installs.

Since I haven't heard anyone else asking for pkgconfig support, I'm
inclined to say we should put the whole idea on the shelf until there's
more evidence that it's worth something.

            regards, tom lane

Re: added pkg-config script

From
phoemix@harmless.hu (Czuczy Gergely)
Date:
On Sun, Aug 22, 2004 at 03:16:09PM -0400, Tom Lane wrote:
> Since I haven't heard anyone else asking for pkgconfig support, I'm
> inclined to say we should put the whole idea on the shelf until there's
> more evidence that it's worth something.
pkg-config is a relatively new method, but most packages
(like gtk, silc's debian package, sqlite, alsa, atk, fontconfig, freetype2, gdk-*,
glib, gthread, libexslt, libpng, openssl, pango, sigc++, xft, etc) support it,
because it's prefferd, doesn't have non-standard behaviour(like php-config, doesn't
have --cflags, it has --includes instead). make a poll on the website to see if
people want it or not. there are hundred millions of configure script that
cannot decide how to get postgres' cflags and libs by themselves. I can
modify the patch to make it disable-able, but I don't think so it would
worth the effort.

and I've also thought for multiple instances for libpq, libecpg, but currently
i've just made it for libpq. doesn't take much more effort to modify it for them.

Bye,

Gergely Czuczy
mailto: phoemix@harmless.hu
PGP: http://phoemix.harmless.hu/phoemix.pgp

Weenies test. Geniuses solve problems that arise.

Attachment

Re: added pkg-config script

From
Peter Eisentraut
Date:
Czuczy Gergely wrote:
> pkg-config is a relatively new method, but most packages
> (like gtk, silc's debian package, sqlite, alsa, atk, fontconfig,
> freetype2, gdk-*, glib, gthread, libexslt, libpng, openssl, pango,
> sigc++, xft, etc) support it,

That sounds very GNOME-biased, and the list on my machine supports that.
So it's far from universal.

> because it's prefferd, doesn't have
> non-standard behaviour(like php-config, doesn't have --cflags, it has
> --includes instead).

It depends on what you define as standard.  pkg-config doesn't have a
--cppflags option, only --cflags, so I'm already wondering how one can
write correct makefiles with it.

> there are hundred millions of configure script that cannot
> decide how to get postgres' cflags and libs by themselves.

That's nonsense.  pg_config is successfully used to interface to
PostgreSQL libraries.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


Re: added pkg-config script

From
phoemix@harmless.hu (Czuczy Gergely)
Date:
On Sun, Aug 22, 2004 at 09:54:24PM +0200, Peter Eisentraut wrote:
> That's nonsense.  pg_config is successfully used to interface to
> PostgreSQL libraries.
never saw it working

>
> --
> Peter Eisentraut
> http://developer.postgresql.org/~petere/
>

Bye,

Gergely Czuczy
mailto: phoemix@harmless.hu
PGP: http://phoemix.harmless.hu/phoemix.pgp

Weenies test. Geniuses solve problems that arise.

Attachment