Hello,

Trying to use 'scripts/autotools-install' on a problematic system (Mac OS X 
10.6.8, already has few other related bugs), building "pkg-config" fails.

Two patches attached:

1. When "./configure" or "make" fail, use "die()" to print an error, pointing 
the user to the error log file. 
This helps when troubleshooting errors, because the script has "set -e" and 
simply exits on errors.

2. Recent "pkg-config" has a cyclic requirement of "glib", explained in the 
README [1]:
   pkg-config depends on glib.  Note that glib build-depends on pkg-config,
   but you can just set the corresponding environment variables (ZLIB_LIBS,
   ZLIB_CFLAGS are the only needed ones when this is written) to build it.

   If this requirement is too cumbersome, a bundled copy of a recent glib
   stable release is included. Pass --with-internal-glib to configure to
   use this copy.

The second patch adds this "--with-internal-glib" flag when configuring 
pkg-config .

Sadly, autotools-install still doesn't complete, because gettext0.18.1 fails to 
compile with stpncpy() related problem (exactly as solved in coreutils [2]) but 
that's is not a coreutil bug.

-gordon

[1] http://cgit.freedesktop.org/pkg-config/tree/README?id=pkg-config-0.27.1
[2] http://bugs.gnu.org/13495

>From ba2c30e47e808c60bd5e899caca1207dae5aa95a Mon Sep 17 00:00:00 2001
From: Assaf Gordon <[email protected]>
Date: Thu, 21 Feb 2013 17:50:28 -0500
Subject: [PATCH 1/2] maint: print errors with autotools-install fails

* scripts/autotools-install: call die() when configure/make fail. Point
the user to the relevant error log file.
---
 scripts/autotools-install |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/autotools-install b/scripts/autotools-install
index bd49664..419806d 100755
--- a/scripts/autotools-install
+++ b/scripts/autotools-install
@@ -148,8 +148,12 @@ for pkg in $pkgs; do
   rm -rf $dir
   gzip -dc $pkg | tar xf -
   cd $dir
-  ./configure CFLAGS=-O2 LDFLAGS=-s --prefix=$prefix >makerr-config 2>&1
-  $MAKE >makerr-build 2>&1
+  ./configure CFLAGS=-O2 LDFLAGS=-s --prefix=$prefix >makerr-config 2>&1 \
+    || die "configuring package $dir failed. " \
+            "check '$tmpdir/$dir/makerr-config' for possible details."
+  $MAKE >makerr-build 2>&1 \
+    || die "building package $dir failed. " \
+            "check '$tmpdir/$dir/makerr-build' for possible details."
   if test $make_check = yes; then
     case $pkg in
       # FIXME: these are out of date and very system-sensitive
-- 
1.7.7.4


>From c3d135c51e20ceb72d5b453081bea1e1899f9ef1 Mon Sep 17 00:00:00 2001
From: Assaf Gordon <[email protected]>
Date: Thu, 21 Feb 2013 17:58:55 -0500
Subject: [PATCH 2/2] maint: add special config flags for pkg-config

* scripts/autotools-install: force pkg-config to use internal 'glib'
files when compiling from source.
---
 scripts/autotools-install |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/scripts/autotools-install b/scripts/autotools-install
index 419806d..2b626ff 100755
--- a/scripts/autotools-install
+++ b/scripts/autotools-install
@@ -144,11 +144,13 @@ pkgs=`get_sources`
 export PATH=$prefix/bin:$PATH
 for pkg in $pkgs; do
   echo building/installing $pkg...
+  extra=
+  case $pkg in pkg-config*) extra="--with-internal-glib";; esac
   dir=`basename $pkg .tar.gz`
   rm -rf $dir
   gzip -dc $pkg | tar xf -
   cd $dir
-  ./configure CFLAGS=-O2 LDFLAGS=-s --prefix=$prefix >makerr-config 2>&1 \
+  ./configure CFLAGS=-O2 LDFLAGS=-s --prefix=$prefix $extra>makerr-config 2>&1 \
     || die "configuring package $dir failed. " \
             "check '$tmpdir/$dir/makerr-config' for possible details."
   $MAKE >makerr-build 2>&1 \
-- 
1.7.7.4

Reply via email to