From 6cf0c4ceb89e68db4478d74c21d172b3e65e8d2b Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 25 Jul 2013 09:09:19 -0400 Subject: Add a simple build system implementing GNOME Build API See http://people.gnome.org/~walters/docs/build-api.txt This way I can easily add it to the gnome-ostree manifest and have it install into /usr, package people can do their thing, etc. This dead simple non-autotools configure/Makefile system is adapted from one I wrote for gtk-doc-stub. Note I also added a --disable-documentation flag since gnome-ostree doesn't have asciidoc. --- Makefile | 20 +++++++++++++++++++- configure | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100755 configure diff --git a/Makefile b/Makefile index 842eb31..e6828f3 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,12 @@ -all: git-bz.html git-bz.1 +include Makefile.inc + +ifeq ($(enable_documentation),yes) +docs = git-bz.html git-bz.1 +else +docs = +endif + +all: $(docs) %.xml: %.txt asciidoc -f asciidoc.conf -d manpage -b docbook $< @@ -16,3 +24,13 @@ upload-html: git-bz.html clean: rm -f git-bz.xml git-bz.html git-bz.1 + +install: install-bin $(if $(findstring yes,$(enable_documentation)),install-doc) + +install-bin: + mkdir -p $(DESTDIR)$(bindir) + install -m 0755 $(srcdir)/git-bz $(DESTDIR)$(bindir) + +install-doc: + mkdir -p $(DESTDIR)$(mandir)/man1 + install -m 0644 git-bz.1 $(DESTDIR)$(mandir)/man1 diff --git a/configure b/configure new file mode 100755 index 0000000..37d7ecf --- /dev/null +++ b/configure @@ -0,0 +1,65 @@ +#!/bin/bash +# -*- mode: sh -*- +# Minimal configure script which writes out a Makefile.inc +# Copyright 2010, 2011 Colin Walters +# Licensed under the new-BSD license (http://www.opensource.org/licenses/bsd-license.php) + +prefix=/usr +enable_documentation=yes + +# 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;; + --bindir) read_arg bindir "$@" || shift;; + --sbindir) read_arg sbindir "$@" || shift;; + --libexecdir) read_arg libexecdir "$@" || shift;; + --datarootdir) read_arg datarootdir "$@" || shift;; + --datadir) read_arg datadir "$@" || shift;; + --sysconfdir) read_arg sysconfdir "$@" || shift;; + --libdir) read_arg libdir "$@" || shift;; + --mandir) read_arg mandir "$@" || shift;; + --disable-documentation) enable_documentation=no;; + *) echo "Ignoring unknown option '$1'";; + esac + shift +done + +# Handle srcdir != builddir +srcdir=$(dirname $0) +if ! test -f Makefile; then + ln -s ${srcdir}/Makefile Makefile +fi + +cat > Makefile.inc.tmp <