Last active
August 29, 2015 14:03
-
-
Save nipo/8e549d11f593acb50f92 to your computer and use it in GitHub Desktop.
Test pkg-config and pkgconf outputs coherence
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
basedir=/tmp/test-$$ | |
mkdir ${basedir} | |
cat > ${basedir}/test.pc << EOF | |
prefix=/usr | |
datarootdir=\${prefix}/share | |
libdir=\${prefix}/lib | |
otherlibdir=/non/prefix/lib | |
Version: 0.1 | |
Name: Test package | |
Description: Lol | |
Cflags: -DTEST | |
Libs: -L\${libdir} -L\${otherlibdir} -ltest -ltest-1 | |
EOF | |
echo .pc file: | |
echo | |
sed 's:^: :' < ${basedir}/test.pc | |
echo | |
export PKG_CONFIG_LIBDIR=$basedir | |
export PKG_CONFIG_SYSROOT_DIR=/lol | |
echo PKG_CONFIG_LIBDIR=$PKG_CONFIG_LIBDIR | |
echo PKG_CONFIG_SYSROOT_DIR=$PKG_CONFIG_SYSROOT_DIR | |
call() { | |
cmd0="pkgconf test $*" | |
cmd1="pkg-config test $*" | |
v0="$($cmd0)" | |
v1="$($cmd1)" | |
echo | |
if [ "$v0" = "$v1" ] ; then | |
echo "Result OK for $*:" | |
echo | |
echo " " $v0 | |
else | |
echo "Results differ for $*:" | |
echo | |
echo " " $cmd0 | |
echo " " $v0 | |
echo " " $cmd1 | |
echo " " $v1 | |
fi | |
} | |
call --variable=libdir | |
call --variable=otherlibdir | |
call --libs | |
rm -r ${basedir} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment