coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] scripts: add autotools-install, for those stuck with outdate


From: Stefano Lattarini
Subject: Re: [PATCH] scripts: add autotools-install, for those stuck with outdated tools
Date: Fri, 31 Aug 2012 15:41:18 +0200

On 08/31/2012 02:50 PM, Jim Meyering wrote:
> 
> Thanks for all of the feedback.
> I've gone ahead and committed it as-is, hoping that you'll be willing to write
> the patch.
>
Here it is.  Note that it is partly untested, as the configuration of pkg-config
fails early on my system with:

    checking for Win32... no
    checking if internal glib should be used... no
    checking for pkg-config... pkg-config
    configure: error: pkg-config and "glib-2.0 >= 2.16" not found, please
      set GLIB_CFLAGS and GLIB_LIBS to the correct values or pass
      --with-internal-glib to configure

Should that option be passed by default maybe?

Regards,
  Stefano

-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----

>From 8dc60c6ec5b4e8f259e3753e2c54a50712c6bcb3 Mon Sep 17 00:00:00 2001
Message-Id: <address@hidden>
From: Stefano Lattarini <address@hidden>
Date: Fri, 31 Aug 2012 15:27:10 +0200
Subject: [PATCH 1/2] scripts: style and portability fixes in
 'autotools-install'

* scripts/autotools-install: Here.
---
 scripts/autotools-install | 48 +++++++++++++++++++++++------------------------
 1 file changed, 23 insertions(+), 25 deletions(-)

diff --git a/scripts/autotools-install b/scripts/autotools-install
index e9e3151..422f0b1 100755
--- a/scripts/autotools-install
+++ b/scripts/autotools-install
@@ -3,8 +3,8 @@
 # tools like autoconf, automake, gettext, etc. that are newer than the ones
 # provided by the distribution on which you want to build.  In that case,
 # you can use this script to bootstrap the "autotools" tool chain, starting
-# with m4 (prereq of autoconf), then autoconf, which a prereq of automake,
-# etc.  It also builds a few others, including gettext and pkg-config.
+# with m4 (prereq of autoconf), then autoconf (prereq of automake), etc.
+# It also builds a few others, including gettext and pkg-config.
 # The results are installed in a directory whose --prefix you specify, and
 # it tells you how to update envvars like PATH and (if you use pkg-config)
 # PKG_CONFIG_PATH.
@@ -69,10 +69,10 @@ get_sources()

   # Download the each tar-ball along with its signature, if there is one.
   pkgs=
-  for t in $(echo $tarballs); do
-    base=$(basename $t)
+  for t in $tarballs; do
+    base=`basename $t`
     pkgs="$pkgs $base"
-    test -f $base     || $WGET_COMMAND $t
+    test -f $base || $WGET_COMMAND $t

     # No signatures for some :-(
     case $base in pkg-config*) continue;; esac
@@ -120,12 +120,8 @@ esac

 # Don't run as root.
 # Make sure id -u succeeds.
-my_uid=`id -u`
-test $? = 0 || {
-  echo "$0: cannot run \`id -u'" 1>&2
-  (exit 1); exit 1
-}
-test $my_uid = 0 && die "please don't run this program as root"
+my_uid=`id -u` && test -n "$my_uid" || die "'id -u' failed"
+test $my_uid -ne 0 || die "please don't run this program as root"

 # Ensure that prefix is not /usr/bin or /bin, /sbin, etc.
 case $prefix in
@@ -139,31 +135,33 @@ tmpdir=.build-auto-tools
 mkdir -p $tmpdir
 cd $tmpdir

-pkgs=$(get_sources)
+pkgs=`get_sources`

 export PATH=$prefix/bin:$PATH
 for pkg in $pkgs; do
   echo building/installing $pkg...
-  dir=$(basename $pkg .tar.gz)
-  rm -rf dir
-  gzip -dc $pkg|tar xf -
+  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
-  make                                                  > makerr-build   2>&1
-  if test "$make_check" = yes; then
+  ./configure CFLAGS=-O2 LDFLAGS=-s --prefix=$prefix >makerr-config 2>&1
+  make >makerr-build 2>&1
+  if test $make_check = yes; then
     case $pkg in
+      # FIXME: these are probably out-of-date.
       automake*) expected_duration_minutes=40;;
       autoconf*) expected_duration_minutes=15;;
       libtool*) expected_duration_minutes=3;;
       *);;
     esac
-    test -n "$expected_duration_minutes" \
-      && echo "running 'make check' for $pkg; NB: this can take over" \
-              "$expected_duration_minutes minutes"
-    make check                                      > makerr-check   2>&1
+    if test -n "$expected_duration_minutes"; then
+      echo "running 'make check' for $pkg; NB: this can take over" \
+           "$expected_duration_minutes minutes"
+    fi
+    make check >makerr-check 2>&1
   fi
-  make install                                      > makerr-install 2>&1
-  echo done at $(date +%Y-%m-%d.%T)
+  make install >makerr-install 2>&1
+  echo "done at `date +%Y-%m-%d.%T`"
   cd ..
 done

@@ -176,7 +174,7 @@ case $PKG_CONFIG_PATH in
   *) cat <<EOF;;
 **************************************************************************
 Be sure that PKG_CONFIG_PATH is set in your environment, e.g.,
-PKG_CONFIG_PATH=$prefix/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
+PKG_CONFIG_PATH=$prefix/lib/pkgconfig:/usr/lib/pkgconfig
 **************************************************************************
 EOF
 esac
-- 
1.7.12




reply via email to

[Prev in Thread] Current Thread [Next in Thread]