[gjs/wip/ptomato/autotools: 3/18] build: Modernize autogen.sh



commit be3d3b51fd6f62d3a4932da0af813d3f3d318ac9
Author: Philip Chimento <philip chimento gmail com>
Date:   Mon Sep 26 20:12:39 2016 -0700

    build: Modernize autogen.sh
    
    This gets rid of the dependency on the old gnome-autogen.sh and moves
    instead to the suggested autogen.sh given as an example in the
    gnome-common migration guide:
    https://wiki.gnome.org/Projects/GnomeCommon/Migration

 autogen.sh |   52 ++++++++++++++++++++++------------------------------
 1 files changed, 22 insertions(+), 30 deletions(-)
---
diff --git a/autogen.sh b/autogen.sh
index e4d2bed..7d526f5 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,44 +1,36 @@
 #!/bin/sh
 # Run this to generate all the initial makefiles, etc.
-
-srcdir=`dirname $0`
+test -n "$srcdir" || srcdir=`dirname "$0"`
 test -z "$srcdir" && srcdir=.
+olddir=`pwd`
+cd "$srcdir"
 
-PKG_NAME="gjs"
-REQUIRED_AUTOCONF_VERSION=2.53
-REQUIRED_AUTOMAKE_VERSION=1.7.2
+# shellcheck disable=SC2016
+PKG_NAME=$(autoconf --trace 'AC_INIT:$1' configure.ac)
 
-(test -f $srcdir/configure.ac \
-  && test -f $srcdir/autogen.sh) || {
+(test -f configure.ac) || {
     echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
     echo " top-level $PKG_NAME directory"
     exit 1
 }
 
-DIE=0
-
-# This is a bit complicated here since we can't use gnome-config yet.
-# It'll be easier after switching to pkg-config since we can then
-# use pkg-config to find the gnome-autogen.sh script.
+if [ "$#" = 0 -a "x$NOCONFIGURE" = "x" ]; then
+    echo "*** WARNING: I am going to run 'configure' with no arguments." >&2
+    echo "*** If you wish to pass any to it, please specify them on the" >&2
+    echo "*** '$0' command line." >&2
+    echo "" >&2
+fi
 
-gnome_autogen=
-gnome_datadir=
+aclocal --install || exit 1  # autoreconf will do this automatically in future
+autoreconf --verbose --force --install || exit 1
 
-ifs_save="$IFS"; IFS=":"
-for dir in $PATH ; do
-  test -z "$dir" && dir=.
-  if test -f $dir/gnome-autogen.sh ; then
-    gnome_autogen="$dir/gnome-autogen.sh"
-    gnome_datadir=`echo $dir | sed -e 's,/bin$,/share,'`
-    break
-  fi
-done
-IFS="$ifs_save"
+cd "$olddir"
+if [ "$NOCONFIGURE" = "" ]; then
+    "$srcdir/configure" "$@" || exit 1
 
-if test -z "$gnome_autogen" ; then
-  echo "You need to install the gnome-common module and make"
-  echo "sure the gnome-autogen.sh script is in your \$PATH."
-  exit 1
+    if [ "$1" = "--help" ]; then exit 0 else
+        echo "Now type 'make' to compile $PKG_NAME" || exit 1
+    fi
+else
+    echo "Skipping configure process."
 fi
-
-GNOME_DATADIR="$gnome_datadir" USE_GNOME2_MACROS=1 . $gnome_autogen


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