[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: multiarch and pkg-config



Am Dienstag 02 Februar 2010 21:43:21 schrieb Tollef Fog Heen:
> ]] Hendrik Sattler
> 
> | Am Dienstag 02 Februar 2010 16:14:27 schrieb Simon McVittie:
> | > However, this would also require that pkg-config itself was multiarch
> | > or otherwise supported cross-compilation
> | > (/usr/bin/i486-linux-gnu-pkg-config, like AC_CHECK_TOOL would use?
> | > pkg-config --arch=i486-linux-gnu? etc.); until then, it's not useful
> | > for pkg-config-using libraries to be multiarch (if I have i386 and
> | > amd64 versions of libdbus-1-dev, but only the one whose architecture
> | > matches my version of pkg-config actually works, then I might as well
> | > uninstall the other version of libdbus-1-dev).
> |
> | pkg-config actually does support relocation of the libraries but for a
> | strange reason only on Windows. That means that for cross-compiling,
> | you have to fixup all paths it returns. The patch would be trivial.
> 
> Uhm, no.  You make sure the generated .pc files are correct and it will
> Just Work.

The keyword here is _relocatable_
With a hard-coded 'prefix', there is no "correct".

> | The undocumented "pcfiledir" variable can be used to hack around it,
> | probably better to convinve upstream to make pkg-config more
> | cross-compile-friendly. Thus, it may be possible to a generic shell
> | script as cross-pkg-config wrapper that does what you want (with many
> | symlinks to make autotools happy).
> 
> Feel free to try to convince me.

----------------------------------------
#!/bin/sh

#find the GNU prefix
GNU_PREFIX=`basename $0 | sed -e 's/\(.*\)-pkg-config/\\1/'`

#set the new search path for pkg-config
PKG_CONFIG_LIBDIR="/usr/lib/$GNU_PREFIX/pkgconfig:$PKG_CONFIG_LIBDIR"
export PKG_CONFIG_LIBDIR

#get the location of the .pc file
PC_NONOPTS=`echo $@ | sed -e 's/\(--[^ ]* \)*//g'`
PC_FILEDIR=`pkg-config --variable=pcfiledir "$PC_NONOPTS"`
PC_RESULT=$?
test "$PC_FILEDIR" || exit $PC_RESULT

#we assume that the wanted prefix is the parent directory
#of the directory where the .pc file was found
PC_PREFIX=`dirname $PC_FILEDIR`

exec pkg-config --define-variable=prefix=$PC_PREFIX "$@"
----------------------------------------

May that work as a preplacement for xxx-yyy-zzz-pkg-config?

HS


Reply to: