Subject: Re: pkg-config vs. buildlink3
To: Juan RP <juan@xtrarom.org>
From: Johnny Lam <jlam@NetBSD.org>
List: tech-pkg
Date: 04/20/2005 14:03:24
Juan RP wrote:
> On Wed, 20 Apr 2005 19:32:02 +0200
> Matthias Drochner <M.Drochner@fz-juelich.de> wrote:
> 
> 
>>juan@xtrarom.org said:
>>
>>>the code just does  getenv(PKG_CONFIG_PATH)
>>
>>anf 5 lines later it unconditionally adds PKG_CONFIG_PC_PATH,
>>which is a compile time constant.
> 
> 
> Thanks I just found it, I suggest to do the following:
> 
> search_path = getenv ("PKG_CONFIG_PATH");
> if (search_path) {
> 	add_search_dirs(search_path, G_SEARCHPATH_SEPARATOR_S);
> } else
> 	add_search_dirs(PKG_CONFIG_PC_PATH, G_SEARCHPATH_SEPARATOR_S);
> 
> 
> This should be safe for all cases, comments?

This changes pkgsrc's pkgconfig in ways that are incompatible with the 
stock pkgconfig.  Could we instead simply make the code match the 
documentation by implementing PKG_CONFIG_LIBDIR?

search_path = getenv("PKG_CONFIG_LIBDIR");
if (search_path) {
	add_search_dirs(search_path, G_SEARCHPATH_SEPARATOR_S);
} else {
	search_path = getenv("PKG_CONFIG_PATH");
	if (search_path) {
		add_search_dirs(search_path, G_SEARCHPATH_SEPARATOR_S);
	}
	add_search_dirs(PKG_CONFIG_PC_PATH, G_SEARCHPATH_SEPARATOR_S);
}

This would preserve the semantics of PKG_CONFIG_PATH, which would be 
nicer for software built without using pkgsrc.  We would then switch 
pkgsrc to use PKG_CONFIG_LIBDIR instead.

	Cheers,

	-- Johnny Lam <jlam@NetBSD.org>