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