]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Support GNOME Build API
authorColin Walters <walters@verbum.org>
Thu, 27 Sep 2012 01:59:55 +0000 (21:59 -0400)
committerHarald Hoyer <harald@redhat.com>
Thu, 27 Sep 2012 10:59:57 +0000 (12:59 +0200)
For dracut:

See people.gnome.org/~walters/docs/build-api.txt

We have a new stub configure script that writes out a Makefile.inc.

.gitignore
Makefile
configure [new file with mode: 0755]

index 44ede87021e3ba460564712371e9f805343d3c85..bec31ab3f160c1861399af2340f449cb8e2d6db2 100644 (file)
@@ -1,3 +1,4 @@
+/Makefile.inc
 /dracut.8
 /dracut-catimages.8
 /dracut.conf.5
index f179e171e45e9bb687b41a952daa3a388d934956..d04d3dd2996a91f1ea9b8a92cd2fde75bc4fa819 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,8 @@
 VERSION=023
 GITVERSION=$(shell [ -d .git ] && git rev-list  --abbrev-commit  -n 1 HEAD  |cut -b 1-8)
 
+-include Makefile.inc
+
 prefix ?= /usr
 libdir ?= ${prefix}/lib
 datadir ?= ${prefix}/share
diff --git a/configure b/configure
new file mode 100755 (executable)
index 0000000..8632398
--- /dev/null
+++ b/configure
@@ -0,0 +1,49 @@
+#!/bin/bash
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+# We don't support srcdir != builddir
+echo \#buildapi-variable-no-builddir >/dev/null
+
+prefix=/usr
+
+# Little helper function for reading args from the commandline.
+# it automatically handles -a b and -a=b variants, and returns 1 if
+# we need to shift $3.
+read_arg() {
+    # $1 = arg name
+    # $2 = arg value
+    # $3 = arg parameter
+    local rematch='^[^=]*=(.*)$'
+    if [[ $2 =~ $rematch ]]; then
+        read "$1" <<< "${BASH_REMATCH[1]}"
+    else
+        read "$1" <<< "$3"
+        # There is no way to shift our callers args, so
+        # return 1 to indicate they should do it instead.
+        return 1
+    fi
+}
+
+while (($# > 0)); do
+    case "${1%%=*}" in
+        --prefix) read_arg prefix "$@" || shift;;
+        --libdir) read_arg libdir "$@" || shift;;
+        --datadir) read_arg datadir "$@" || shift;;
+        --sysconfdir) read_arg sysconfdir "$@" || shift;;
+        --sbindir) read_arg sbindir "$@" || shift;;
+        --mandir) read_arg mandir "$@" || shift;;
+        *) echo "Ignoring unknown option '$1'";;
+    esac
+    shift
+done
+
+cat > Makefile.inc.tmp <<EOF
+prefix ?= ${prefix}
+libdir ?= ${libdir:-${prefix}/lib}
+datadir ?= ${datadir:-${prefix}/share}
+sysconfdir ?= ${sysconfdir:-${prefix}/etc}
+sbindir ?= ${sbindir:-${prefix}/sbin}
+mandir ?= ${mandir:-${prefix}/share/man}
+EOF
+mv Makefile.inc.tmp Makefile.inc