# Prerequisites:
# Glib - As of 0.27, a copy of glib2 is included
# Get the source tarball
cd
test -f installed/pkg-config-0.29.2.tar.gz &&
mv installed/pkg-config-0.29.2.tar.gz .
test ! -f pkg-config-0.29.2.tar.gz &&
wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "pkg-config-*" -exec rm -r {} \;
find -maxdepth 1 -type d -name "pkgconfig-*" -exec rm -r {} \;
tar xzvf ~/pkg-config-0.29.2.tar.gz
cd pkg-config-0.29.2
test $UID = 0 && chown -R root:root .
# Building pkg-config requires one of these options:
# a) itself (to find Glib)
# b) you to pass GLIB_CFLAGS and GLIB_LIBS
# c) you to pass --with-internal-glib
# If you want pkg-config to search through more than just the default .pc
# file directory (prefix/lib*/pkgconfig), you can pass a list to the
# --with-pc-path configure option. You can also pass a list of additional
# directories to search to the PKG_CONFIG_PATH environment variable. See
# the notes at the bottom for more information about this.
# Configure the build for 64-bit
test $(uname -m) = "x86_64" &&
./configure --prefix=/usr --docdir=/usr/doc/pkg-config \
--mandir=/usr/man --libdir=/usr/lib64
# Configure the build for anything else
test $(uname -m) != "x86_64" &&
./configure --prefix=/usr --docdir=/usr/doc/pkg-config --mandir=/usr/man
# Build it
make
# Become root to install it
su
# Remove Slackware package version of pkg-config
test -x /sbin/removepkg && /sbin/removepkg pkgconfig pkg-config
# Install the new version
make install
# In addition to passing --with-pc-path to configure as noted above, to
# cover packages that use pkg-config that install files under a prefix
# other than /usr (the pkg-config files won't end up in /usr/lib*/pkgconfig),
# you can either create a symlink pointing /usr/local/lib*/pkgconfig and any
# others you need to /usr/lib*/pkgconfig or you can specify additional
# directories to look in by setting the PKG_CONFIG_PATH environment
# variable. Seperate multiple directories with a colon.
#
# Some apps like OpenSSL and Qt install everything under a prefix like
# /usr/local/ssl or /usr/lib/qt, so you end up with a pkgconfig directory
# in there that pkg-config isn't aware of. To cover those, add that
# directory to PKG_CONFIG_PATH. My howtos that cover apps that install
# pkg-config files (GraphViz, OpenSSL, Qt, etc.) have been or will be
# updated to create their own /etc/profile.d/* file that will update
# PKG_CONFIG_PATH.
#
# I rarely, if ever, use csh:
# see Slackware64's source for a pkgconfig.csh
# see Slackware's source for a pkgconfig.csh
# example and don't forget to use lib64 if you use 64-bit Slackware,
# lib if not.
#
# Run this to create a /etc/profile.d/pkgconfig.sh that will add several
# different directories to the PKG_CONFIG_PATH variable if they exist and
# are not a symlink:
cat << EOF > /etc/profile.d/pkgconfig.sh
#!/bin/sh
for dir in \\
/lib/pkgconfig \\
/lib64/pkgconfig \\
/usr/lib/pkgconfig \\
/usr/lib64/pkgconfig \\
/usr/local/lib/pkgconfig \\
/usr/local/lib64/pkgconfig \\
/usr/X11R6/lib/pkgconfig \\
/usr/X11R6/lib64/pkgconfig;
do
if [ -d "\$dir" -a ! -L "\$dir" ]; then
if [ -n "\$PKG_CONFIG_PATH" ]; then
PKG_CONFIG_PATH="\$PKG_CONFIG_PATH:\$dir"
else
PKG_CONFIG_PATH="\$dir"
fi
fi
done
export PKG_CONFIG_PATH
EOF
chmod +x /etc/profile.d/pkgconfig.sh
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .
# Become yourself again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/pkgconfig-*.tar.* installed/pkg-config-*.tar.*
mv pkg-config-0.29.2.tar.gz installed/
# If you ever want to uninstall pkg-config, this should do it:
cd
su
test -x /sbin/removepkg && /sbin/removepkg pkg-config pkgconfig
test -d src/pkg-config-* && ( cd src/pkg-config-* ; make uninstall )
rm -f /usr/bin/pkg-config /usr/man/man1/pkg-config.1* \
/usr/share/aclocal/pkg.m4 /usr/share/man/man1/pkg-config.1*
test -d /usr/doc/pkg-config && rm -r /usr/doc/pkg-config
test ! -L /usr/share/doc &&
test -d /usr/share/doc/pkg-config && rm -r /usr/share/doc/pkg-config
find /usr/doc -maxdepth 1 -type d -name "pkg-config-*" -exec rm -r {} \;
test ! -L /usr/share/doc &&
find /usr/share/doc -maxdepth 1 -type d -name "pkg-config-*" \
-exec rm -r {} \;
exit
find ~/src -maxdepth 1 -type d -name "pkg-config-*" -exec rm -r {} \;
find ~/src -maxdepth 1 -type d -name "pkgconfig-*" -exec rm -r {} \;
rm -f ~/installed/pkg-config-*.tar.* ~/installed/pkgconfig.*