]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/patch_deps.sh
test branch
[helm.git] / helm / ocaml / patch_deps.sh
diff --git a/helm/ocaml/patch_deps.sh b/helm/ocaml/patch_deps.sh
new file mode 100755 (executable)
index 0000000..cd9f09c
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+# script args: source_file target_file
+
+use_clusters='no'
+if [ ! -z "$USE_CLUSTERS" ]; then
+  use_clusters=$USE_CLUSTERS
+fi
+
+# args: file snippet
+# file will be modified in place
+include_dot_snippet ()
+{
+  echo "Adding to $1 graphviz snipet $2 ..."
+  sed -i "/digraph/r $2" $1
+}
+
+# args: file patch
+apply_patch ()
+{
+  if [ -f "$2" ]; then
+    echo "Applying to $1 patch $2 ..."
+    patch $1 $2
+  fi
+}
+
+cp $1 $2
+apply_patch $2 deps.patch
+include_dot_snippet $2 daemons.dot
+if [ "$use_clusters" = "yes" ]; then
+  include_dot_snippet $2 clusters.dot
+fi
+