[libvirt] [glib PATCH 1/2] autogen.sh: Simplify autogen.sh

Fabiano Fidêncio posted 2 patches 6 years, 8 months ago
There is a newer version of this series
[libvirt] [glib PATCH 1/2] autogen.sh: Simplify autogen.sh
Posted by Fabiano Fidêncio 6 years, 8 months ago
Let's use an autogen.sh based on libosinfo's one, which is cleaner and
matches the current GNOME guidelines.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
---
 .gitignore |  3 +++
 autogen.sh | 70 +++++++++++++++++++-----------------------------------
 2 files changed, 28 insertions(+), 45 deletions(-)

diff --git a/.gitignore b/.gitignore
index de89c4d..4b9467e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,11 +19,14 @@ Makefile.in
 *.la
 *~
 *.orig
+m4/gtk-doc.m4
+m4/introspection.m4
 m4/ltsugar.m4
 m4/lt~obsolete.m4
 m4/libtool.m4
 m4/ltversion.m4
 m4/ltoptions.m4
+m4/pkg.m4
 autom4te.cache
 config.*
 COPYING
diff --git a/autogen.sh b/autogen.sh
index 3b593ce..c679131 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,57 +1,37 @@
 #!/bin/sh
 # Run this to generate all the initial makefiles, etc.
+test -n "$srcdir" || srcdir=$(dirname "$0")
+test -n "$srcdir" || srcdir=.
 
-set -e
-srcdir=`dirname $0`
-test -z "$srcdir" && srcdir=.
+olddir=$(pwd)
 
-THEDIR=`pwd`
-cd $srcdir
+cd "$srcdir"
 
-DIE=0
-
-for prog in autoreconf automake autoconf libtoolize
-do
-    ($prog --version) < /dev/null > /dev/null 2>&1 || {
-        echo
-        echo "You must have $prog installed to compile libvirt-glib."
-        DIE=1
-    }
-done
-
-if test "$DIE" -eq 1; then
-        exit 1
-fi
-
-if test -z "$*"; then
-        echo "I am going to run ./configure with no args - if you "
-        echo "wish to pass any extra arguments to it, please specify them on "
-        echo "the $0 command line."
-fi
+(test -f libvirt-glib/libvirt-glib-main.c) || {
+    echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
+    echo " top-level libvirt-glib directory"
+    exit 1
+}
 
 # Real ChangeLog/AUTHORS is auto-generated from GIT logs at
 # make dist time, but automake requires that it
 # exists at all times :-(
 touch ChangeLog AUTHORS
 
-mkdir -p build-aux
-autoreconf -if
-
-cd $THEDIR
-
-if test "x$1" = "x--system"; then
-    shift
-    prefix=/usr
-    libdir=$prefix/lib
-    sysconfdir=/etc
-    localstatedir=/var
-    if [ -d /usr/lib64 ]; then
-      libdir=$prefix/lib64
-    fi
-    EXTRA_ARGS="--prefix=$prefix --sysconfdir=$sysconfdir --localstatedir=$localstatedir --libdir=$libdir"
-fi
+aclocal --install || exit 1
+gtkdocize --copy || exit 1
+autoreconf --verbose --force --install || exit 1
 
-$srcdir/configure $EXTRA_ARGS "$@" && {
-    echo
-    echo "Now type 'make' to compile libvirt-glib."
-}
+cd "$olddir"
+
+if [ "$NOCONFIGURE" = "" ]; then
+        $srcdir/configure "$@" || 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
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [glib PATCH 1/2] autogen.sh: Simplify autogen.sh
Posted by Michal Prívozník 6 years, 8 months ago
On 5/24/19 5:32 PM, Fabiano Fidêncio wrote:
> Let's use an autogen.sh based on libosinfo's one, which is cleaner and
> matches the current GNOME guidelines.
> 
> Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
> ---
>  .gitignore |  3 +++
>  autogen.sh | 70 +++++++++++++++++++-----------------------------------
>  2 files changed, 28 insertions(+), 45 deletions(-)
> 
> diff --git a/.gitignore b/.gitignore
> index de89c4d..4b9467e 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -19,11 +19,14 @@ Makefile.in
>  *.la
>  *~
>  *.orig
> +m4/gtk-doc.m4
> +m4/introspection.m4
>  m4/ltsugar.m4
>  m4/lt~obsolete.m4
>  m4/libtool.m4
>  m4/ltversion.m4
>  m4/ltoptions.m4
> +m4/pkg.m4
>  autom4te.cache
>  config.*
>  COPYING
> diff --git a/autogen.sh b/autogen.sh
> index 3b593ce..c679131 100755
> --- a/autogen.sh
> +++ b/autogen.sh
> @@ -1,57 +1,37 @@
>  #!/bin/sh
>  # Run this to generate all the initial makefiles, etc.
> +test -n "$srcdir" || srcdir=$(dirname "$0")
> +test -n "$srcdir" || srcdir=.
>  
> -set -e
> -srcdir=`dirname $0`
> -test -z "$srcdir" && srcdir=.
> +olddir=$(pwd)
>  
> -THEDIR=`pwd`
> -cd $srcdir
> +cd "$srcdir"
>  
> -DIE=0
> -
> -for prog in autoreconf automake autoconf libtoolize
> -do
> -    ($prog --version) < /dev/null > /dev/null 2>&1 || {
> -        echo
> -        echo "You must have $prog installed to compile libvirt-glib."
> -        DIE=1
> -    }
> -done
> -
> -if test "$DIE" -eq 1; then
> -        exit 1
> -fi
> -
> -if test -z "$*"; then
> -        echo "I am going to run ./configure with no args - if you "
> -        echo "wish to pass any extra arguments to it, please specify them on "
> -        echo "the $0 command line."
> -fi
> +(test -f libvirt-glib/libvirt-glib-main.c) || {
> +    echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
> +    echo " top-level libvirt-glib directory"
> +    exit 1
> +}
>  
>  # Real ChangeLog/AUTHORS is auto-generated from GIT logs at
>  # make dist time, but automake requires that it
>  # exists at all times :-(
>  touch ChangeLog AUTHORS
>  
> -mkdir -p build-aux
> -autoreconf -if
> -
> -cd $THEDIR
> -
> -if test "x$1" = "x--system"; then

Please keep this in. It's a nice shortcut that's standardized through
libvirt projects. it's nice to have an argument that sets all them paths:

> -    shift
> -    prefix=/usr
> -    libdir=$prefix/lib
> -    sysconfdir=/etc
> -    localstatedir=/var
> -    if [ -d /usr/lib64 ]; then
> -      libdir=$prefix/lib64
> -    fi
> -    EXTRA_ARGS="--prefix=$prefix --sysconfdir=$sysconfdir --localstatedir=$localstatedir --libdir=$libdir"
> -fi

Otherwise looking good.

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list