9aee9a
From 9636b85c5570911c753bc8074ce5bd73f490d4da Mon Sep 17 00:00:00 2001
9aee9a
From: Michal Fabik <mfabik@redhat.com>
9aee9a
Date: Wed, 19 Jun 2019 13:42:07 +0200
9aee9a
Subject: [PATCH] Add autogen.sh
9aee9a
9aee9a
---
9aee9a
 autogen.sh | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
9aee9a
 1 file changed, 97 insertions(+)
9aee9a
 create mode 100755 autogen.sh
9aee9a
9aee9a
diff --git a/autogen.sh b/autogen.sh
9aee9a
new file mode 100755
9aee9a
index 00000000..fd48b5f0
9aee9a
--- /dev/null
9aee9a
+++ b/autogen.sh
9aee9a
@@ -0,0 +1,97 @@
9aee9a
+#!/bin/sh
9aee9a
+
9aee9a
+print_help()
9aee9a
+{
9aee9a
+cat << EOH
9aee9a
+Prepares the source tree for configuration
9aee9a
+
9aee9a
+Usage:
9aee9a
+  autogen.sh [sysdeps [--install]]
9aee9a
+
9aee9a
+Options:
9aee9a
+
9aee9a
+  sysdeps          prints out all dependencies
9aee9a
+    --install      install all dependencies ('sudo yum install \$DEPS')
9aee9a
+
9aee9a
+EOH
9aee9a
+}
9aee9a
+
9aee9a
+parse_build_requires_from_spec_file()
9aee9a
+{
9aee9a
+    PACKAGE=$1
9aee9a
+    TEMPFILE=$(mktemp -u --suffix=.spec)
9aee9a
+    sed 's/@@LIBREPORT_VERSION@@/1/' < $PACKAGE.spec.in | sed 's/@.*@//' > $TEMPFILE
9aee9a
+    rpmspec -P $TEMPFILE | grep "^\(Build\)\?Requires:" | \
9aee9a
+        tr -s " " | tr "," "\n" | cut -f2- -d " " | \
9aee9a
+        grep -v "\(^\|python[23]-\)"$PACKAGE | sort -u | sed -E 's/^(.*) (.*)$/"\1 \2"/' | tr \" \'
9aee9a
+    rm $TEMPFILE
9aee9a
+}
9aee9a
+
9aee9a
+list_build_dependencies()
9aee9a
+{
9aee9a
+    local BUILD_SYSTEM_DEPS_LIST="gettext-devel"
9aee9a
+    echo $BUILD_SYSTEM_DEPS_LIST $(parse_build_requires_from_spec_file libreport)
9aee9a
+}
9aee9a
+
9aee9a
+case "$1" in
9aee9a
+    "--help"|"-h")
9aee9a
+            print_help
9aee9a
+            exit 0
9aee9a
+        ;;
9aee9a
+    "sysdeps")
9aee9a
+            DEPS_LIST=$(list_build_dependencies)
9aee9a
+
9aee9a
+            if [ "$2" == "--install" ]; then
9aee9a
+                set -x verbose
9aee9a
+                eval sudo dnf install --setopt=strict=0 $DEPS_LIST
9aee9a
+                set +x verbose
9aee9a
+            else
9aee9a
+                echo $DEPS_LIST
9aee9a
+            fi
9aee9a
+            exit 0
9aee9a
+        ;;
9aee9a
+    *)
9aee9a
+            echo "Running gen-version"
9aee9a
+            ./gen-version
9aee9a
+
9aee9a
+            mkdir -p m4
9aee9a
+            echo "Creating m4/aclocal.m4 ..."
9aee9a
+            test -r m4/aclocal.m4 || touch m4/aclocal.m4
9aee9a
+
9aee9a
+            echo "Running autopoint"
9aee9a
+            autopoint --force || exit 1
9aee9a
+
9aee9a
+            echo "Running intltoolize..."
9aee9a
+            intltoolize --force --copy --automake || exit 1
9aee9a
+
9aee9a
+            echo "Running aclocal..."
9aee9a
+            aclocal || exit 1
9aee9a
+
9aee9a
+            echo "Running libtoolize..."
9aee9a
+            libtoolize || exit 1
9aee9a
+
9aee9a
+            echo "Running autoheader..."
9aee9a
+            autoheader || return 1
9aee9a
+
9aee9a
+            echo "Running autoconf..."
9aee9a
+            autoconf --force || exit 1
9aee9a
+
9aee9a
+            echo "Running automake..."
9aee9a
+            automake --add-missing --force --copy || exit 1
9aee9a
+
9aee9a
+            echo "Running configure ..."
9aee9a
+            if [ 0 -eq $# ]; then
9aee9a
+                ./configure \
9aee9a
+                    --prefix=/usr \
9aee9a
+                    --sysconfdir=/etc \
9aee9a
+                    --localstatedir=/var \
9aee9a
+                    --sharedstatedir=/var/lib \
9aee9a
+                    --mandir=/usr/share/man \
9aee9a
+                    --infodir=/usr/share/info \
9aee9a
+                    --enable-debug
9aee9a
+                echo "Configured for local debugging ..."
9aee9a
+            else
9aee9a
+                ./configure "$@"
9aee9a
+            fi
9aee9a
+        ;;
9aee9a
+esac
9aee9a
-- 
9aee9a
2.21.0
9aee9a