[libchamplainmm] Add scripts to generate .defs files



commit f6960762d80db3bc132761111089d864a4f76f57
Author: Juan R. GarcĂ­a Blanco <juanrgar gmail com>
Date:   Tue Feb 25 20:52:17 2014 +0100

    Add scripts to generate .defs files

 tools/gen_scripts/champlain_generate_docs.sh       |   20 ++++++++++
 tools/gen_scripts/champlain_generate_enums.sh      |   16 ++++++++
 tools/gen_scripts/champlain_generate_extra_defs.sh |   38 ++++++++++++++++++++
 tools/gen_scripts/champlain_generate_methods.sh    |   16 ++++++++
 4 files changed, 90 insertions(+), 0 deletions(-)
---
diff --git a/tools/gen_scripts/champlain_generate_docs.sh b/tools/gen_scripts/champlain_generate_docs.sh
new file mode 100755
index 0000000..5578bf3
--- /dev/null
+++ b/tools/gen_scripts/champlain_generate_docs.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# Note that JHBUILD_SOURCES should be defined to contain the path to the root
+# of the jhbuild sources. The script assumes that it resides in the
+# tools/gen_scripts/ directory and the XML file will be placed in libchamplain/src.
+
+if [ -z "$JHBUILD_SOURCES" ]; then
+  echo -e "JHBUILD_SOURCES must contain the path to the jhbuild sources."
+  exit 1;
+fi
+
+ROOT_DIR="$(dirname "$0")/../.."
+OUT_DIR="$ROOT_DIR/libchamplain/src"
+
+for dir in "$JHBUILD_SOURCES"/libchamplain/champlain; do
+  PARAMS="$PARAMS -s $dir"
+done
+
+DOCEXTRACT_TO_XML_PY="$JHBUILD_SOURCES/glibmm/tools/defs_gen/docextract_to_xml.py"
+$DOCEXTRACT_TO_XML_PY $PARAMS > "$OUT_DIR/libchamplain_docs.xml"
diff --git a/tools/gen_scripts/champlain_generate_enums.sh b/tools/gen_scripts/champlain_generate_enums.sh
new file mode 100755
index 0000000..bab8988
--- /dev/null
+++ b/tools/gen_scripts/champlain_generate_enums.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# Note that JHBUILD_SOURCES should be defined to contain the path to the root
+# of the jhbuild sources. The script assumes that it resides in the
+# tools/gen_scripts/ directory and the defs file will be placed in gtk/src.
+
+if [ -z "$JHBUILD_SOURCES" ]; then
+  echo -e "JHBUILD_SOURCES must contain the path to the jhbuild sources."
+  exit 1;
+fi
+
+ROOT_DIR="$(dirname "$0")/../.."
+OUT_DIR="$ROOT_DIR/libchamplain/src"
+
+ENUM_PL="$JHBUILD_SOURCES/glibmm/tools/enum.pl"
+$ENUM_PL "$JHBUILD_SOURCES"/libchamplain/champlain/*.h > "$OUT_DIR"/libchamplain_enums.defs
diff --git a/tools/gen_scripts/champlain_generate_extra_defs.sh 
b/tools/gen_scripts/champlain_generate_extra_defs.sh
new file mode 100755
index 0000000..f6c8372
--- /dev/null
+++ b/tools/gen_scripts/champlain_generate_extra_defs.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+# The script assumes that it resides in the tools/gen_scripts directory
+# and the defs files will be placed in libchamplain/src.
+# It shall be executed from the tools/gen_scripts directory.
+
+# To update the libchamplain_signals.defs file:
+# 1. ./champlain_generate_extra_defs.sh
+#    Generates libchamplain/src/libchamplain_signals.defs.orig and 
libchamplain/src/libchamplain_signals.defs.
+#    If any hunks from the patch file fail to apply, apply them manually to the
+#    libchamplain_signals.defs file, if required.
+# 2. Optional: Remove libchamplain/src/libchamplain_signals.defs.orig.
+
+# To update the libchamplain_signals.defs file and the patch file:
+# 1. Like step 1 when updating only the libchamplain_signals.defs file.
+# 2. Apply new patches manually to the libchamplain_signals.defs file.
+# 3. ./champlain_generate_extra_defs.sh --make-patch
+# 4. Like step 2 when updating only the libchamplain_signals.defs file.
+
+ROOT_DIR="$(dirname "$0")/../.."
+GEN_DIR="$ROOT_DIR/tools/extradefs"
+OUT_DIR="$ROOT_DIR/libchamplain/src"
+OUT_DEFS_FILE="$OUT_DIR"/libchamplain_signals.defs
+
+if [ $# -eq 0 ]
+then
+  # Without LC_ALL=C documentation (docs "xxx") may be translated in the .defs file.
+  LC_ALL=C "$GEN_DIR"/generate_extra_defs > "$OUT_DEFS_FILE"
+  PATCH_OPTIONS="--backup --version-control=simple --suffix=.orig"
+  patch $PATCH_OPTIONS "$OUT_DEFS_FILE" "$OUT_DEFS_FILE".patch
+elif [ "$1" = "--make-patch" ]
+then
+  diff --unified=10 "$OUT_DEFS_FILE".orig "$OUT_DEFS_FILE" > "$OUT_DEFS_FILE".patch
+else
+  echo "Usage: $0 [--make-patch]"
+  exit 1
+fi
+
diff --git a/tools/gen_scripts/champlain_generate_methods.sh b/tools/gen_scripts/champlain_generate_methods.sh
new file mode 100755
index 0000000..9da46c7
--- /dev/null
+++ b/tools/gen_scripts/champlain_generate_methods.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# Note that JHBUILD_SOURCES should be defined to contain the path to the root
+# of the jhbuild sources. The script assumes that it resides in the
+# tools/gen_scripts/ directory and the defs file will be placed in gtk/src.
+
+if [ -z "$JHBUILD_SOURCES" ]; then
+  echo -e "JHBUILD_SOURCES must contain the path to the jhbuild sources."
+  exit 1;
+fi
+
+ROOT_DIR="$(dirname "$0")/../.."
+OUT_DIR="$ROOT_DIR/libchamplain/src"
+
+H2DEF_PY="$JHBUILD_SOURCES/glibmm/tools/defs_gen/h2def.py"
+$H2DEF_PY "$JHBUILD_SOURCES"/libchamplain/champlain/*.h > "$OUT_DIR"/libchamplain_methods.defs


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]