Hello,

an email from Bruce to BLFS Support set me thinking about the how to
get pkg-config back into LFS. Obviously puting glib et al back in LFS
is a non starter and I quite like the idea of pkg-config using the glib
functions, it makes sense to use shared libraries where we can. So that
led me to wonder if I could implement a simple script that would
emulate pkg-config for the first few packages that need it.

This is a crude hack, I'm sure others could improve it a lot, but it
works for me. e2fsprogs, man-db and glib compile with this pkg-config
script in my ${PATH}:

cat > /usr/bin/pkg-config << "HERE"
#!/bin/bash
set -e

case ${1} in
  --libs)
    libraries=(${2})
    sed '/^Libs: /!d;s/^Libs: //;s#-L${[a-z]*libdir}##g' \
           /usr/lib/pkgconfig/${libraries[0]}.pc
    ;;
  --cflags)
    includes=(${2})
    prefix=$(sed '/^prefix/!d;s#^prefix=##' \
      /usr/lib/pkgconfig/${includes[0]}.pc)
    includedir=$(sed '/^includedir/!d;s#^includedir=##' \
      /usr/lib/pkgconfig/${includes[0]}.pc)
    libdir=$(sed '/^libdir/!d;s#^libdir=##' \
      /usr/lib/pkgconfig/${includes[0]}.pc)
    sed "/^Cflags: /!d;s#^Cflags: ##;s#\${includedir}#${includedir}#g
      s#\${libdir}#${libdir}#g;s#\${prefix}#${prefix}#g" \
           /usr/lib/pkgconfig/${includes[0]}.pc
    ;;
  *)
    true
    ;;
esac
HERE

I've not tested it for real in chroot yet. I'm just about to.

Andy
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to