orc: Fix distcheck problems in orc.mk
authorDavid Schleef <ds@schleef.org>
Sun, 30 May 2010 21:35:28 +0000 (14:35 -0700)
committerDavid Schleef <ds@schleef.org>
Sun, 30 May 2010 21:35:28 +0000 (14:35 -0700)
Add gst-indent to common, since orc.mk uses it to clean up
source files.

Makefile.am
gst-indent [new file with mode: 0755]
orc.mk

index bf8303e..6a35a0d 100644 (file)
@@ -16,4 +16,6 @@ EXTRA_DIST = \
        coverage/coverage-report.pl \
        coverage/coverage-report.xsl \
        coverage/coverage-report-entry.pl \
-       download-translations
+       download-translations \
+       gst-indent \
+       orc.mk
diff --git a/gst-indent b/gst-indent
new file mode 100755 (executable)
index 0000000..732b2ba
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# Check that the code follows a consistant code style
+#
+
+# Check for existence of indent, and error out if not present.
+# On some *bsd systems the binary seems to be called gnunindent,
+# so check for that first.
+
+version=`gnuindent --version 2>/dev/null`
+if test "x$version" = "x"; then
+  version=`indent --version 2>/dev/null`
+  if test "x$version" = "x"; then
+    echo "GStreamer git pre-commit hook:"
+    echo "Did not find GNU indent, please install it before continuing."
+    exit 1
+  fi
+  INDENT=indent
+else
+  INDENT=gnuindent
+fi
+
+case `$INDENT --version` in
+  GNU*)
+      ;;
+  default)
+      echo "GStreamer git pre-commit hook:"
+      echo "Did not find GNU indent, please install it before continuing."
+      echo "(Found $INDENT, but it doesn't seem to be GNU indent)"
+      exit 1
+      ;;
+esac
+
+INDENT_PARAMETERS="--braces-on-if-line \
+       --case-brace-indentation0 \
+       --case-indentation2 \
+       --braces-after-struct-decl-line \
+       --line-length80 \
+       --no-tabs \
+       --cuddle-else \
+       --dont-line-up-parentheses \
+       --continuation-indentation4 \
+       --honour-newlines \
+       --tab-size8 \
+       --indent-level2 \
+       --leave-preprocessor-space"
+
+$INDENT ${INDENT_PARAMETERS} $@
+
diff --git a/orc.mk b/orc.mk
index 11176e8..8eebb37 100644 (file)
--- a/orc.mk
+++ b/orc.mk
 # 
 #
 
-ORC_SOURCES = $(ORC_BASE)orc.c $(ORC_BASE)orc.h
+ORC_SOURCES = tmp-orc.c $(ORC_BASE)orc.h
 
-#EXTRA_DIST = $(ORC_BASE).orc $(ORC_BASE)orc.c $(ORC_BASE)orc.h
+EXTRA_DIST = $(ORC_BASE).orc
+
+# This is needed if dist-hook-orc is not used
+#EXTRA_DIST = $(ORC_BASE).orc $(ORC_BASE)orc-dist.c $(ORC_BASE)orc-dist.h
 
 BUILT_SOURCES = $(ORC_SOURCES)
 
 
-orc-update: $(ORC_BASE)orc.c $(ORC_BASE)orc.h
-       cp $(ORC_BASE)orc.c $(srcdir)/$(ORC_BASE)orc-dist.c
-       $(top_srcdir)/common/gst-indent $(srcdir)/$(ORC_BASE)orc-dist.c
+orc-update: tmp-orc.c $(ORC_BASE)orc.h
+       $(top_srcdir)/common/gst-indent tmp-orc.c
+       cp tmp-orc.c $(srcdir)/$(ORC_BASE)orc-dist.c
        cp $(ORC_BASE)orc.h $(srcdir)/$(ORC_BASE)orc-dist.h
        
 
 if HAVE_ORC
-$(ORC_BASE)orc.c: $(srcdir)/$(ORC_BASE).orc
-       $(ORCC) --implementation --include glib.h -o $(ORC_BASE)orc.c $(srcdir)/$(ORC_BASE).orc
+tmp-orc.c: $(srcdir)/$(ORC_BASE).orc
+       $(ORCC) --implementation --include glib.h -o tmp-orc.c $(srcdir)/$(ORC_BASE).orc
 
 $(ORC_BASE)orc.h: $(srcdir)/$(ORC_BASE).orc
        $(ORCC) --header --include glib.h -o $(ORC_BASE)orc.h $(srcdir)/$(ORC_BASE).orc
 else
-$(ORC_BASE)orc.c: $(srcdir)/$(ORC_BASE).orc
-       cp $(srcdir)/$(ORC_BASE)orc-dist.c $(ORC_BASE)orc.c
+tmp-orc.c: $(srcdir)/$(ORC_BASE).orc
+       cp $(srcdir)/$(ORC_BASE)orc-dist.c tmp-orc.c
 
 $(ORC_BASE)orc.h: $(srcdir)/$(ORC_BASE).orc
        cp $(srcdir)/$(ORC_BASE)orc-dist.h $(ORC_BASE)orc.h
@@ -47,12 +50,17 @@ endif
 clean-local: clean-orc
 .PHONY: clean-orc
 clean-orc:
-       rm -f $(ORC_BASE)orc.c $(ORC_BASE)orc.h
+       rm -f tmp-orc.c $(ORC_BASE)orc.h
 
 dist-hook: dist-hook-orc
 .PHONY: dist-hook-orc
-dist-hook-orc: $(ORC_BASE)orc.c $(ORC_BASE)orc.h
-       cp $(ORC_BASE)orc.c $(srcdir)/$(ORC_BASE)orc-dist.c
-       $(top_srcdir)/common/gst-indent $(srcdir)/$(ORC_BASE)orc-dist.c
-       cp $(ORC_BASE)orc.h $(srcdir)/$(ORC_BASE)orc-dist.h
+dist-hook-orc: tmp-orc.c $(ORC_BASE)orc.h
+       $(top_srcdir)/common/gst-indent tmp-orc.c
+       rm -f tmp-orc.c~
+       cmp -s tmp-orc.c $(srcdir)/$(ORC_BASE)orc-dist.c || \
+         cp tmp-orc.c $(srcdir)/$(ORC_BASE)orc-dist.c
+       cmp -s $(ORC_BASE)orc.h $(srcdir)/$(ORC_BASE)orc-dist.h || \
+         cp $(ORC_BASE)orc.h $(srcdir)/$(ORC_BASE)orc-dist.h
+       cp -p $(srcdir)/$(ORC_BASE)orc-dist.c $(distdir)/
+       cp -p $(srcdir)/$(ORC_BASE)orc-dist.h $(distdir)/