[atkmm] generate_defs_and_docs.sh: Update for atk built with meson



commit 7e70dd7732184b31f1d3737150a464b997dbbf7f
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Mon Sep 4 20:02:47 2017 +0200

    generate_defs_and_docs.sh: Update for atk built with meson
    
    When atk is built with meson instead of autotools, generated .h and .c
    files are stored in atk/build/atk. Files in that directory shall be read
    when atk_docs.xml and the .defs files are generated.
    
    atk_signals.defs contain manually changed lines. Add a .defs.patch file
    that automatically makes these changes when atk_signals.defs is regenerated.

 atk/src/atk_signals.defs.patch    |   28 +++++++++++++++++++
 codegen/generate_defs_and_docs.sh |   55 ++++++++++++++++++++++++++++---------
 2 files changed, 70 insertions(+), 13 deletions(-)
---
diff --git a/atk/src/atk_signals.defs.patch b/atk/src/atk_signals.defs.patch
new file mode 100644
index 0000000..fe1b35f
--- /dev/null
+++ b/atk/src/atk_signals.defs.patch
@@ -0,0 +1,28 @@
+--- ../atk/src/atk_signals.defs.orig   2017-09-04 17:16:11.876601000 +0200
++++ ../atk/src/atk_signals.defs        2017-09-04 18:43:44.087322801 +0200
+@@ -22,11 +22,11 @@
+ (define-signal property-change
+   (of-object "AtkObject")
+   (return-type "void")
+   (when "last")
+   (parameters
+-    '("gpointer" "p0")
++    '("AtkPropertyValues*" "p0")
+   )
+ )
+ 
+ (define-signal state-change
+   (of-object "AtkObject")
+@@ -47,11 +47,11 @@
+ (define-signal active-descendant-changed
+   (of-object "AtkObject")
+   (return-type "void")
+   (when "last")
+   (parameters
+-    '("gpointer" "p0")
++    '("gpointer*" "p0")
+   )
+ )
+ 
+ (define-property accessible-name
+   (of-object "AtkObject")
diff --git a/codegen/generate_defs_and_docs.sh b/codegen/generate_defs_and_docs.sh
index 7d5cce4..7952e66 100755
--- a/codegen/generate_defs_and_docs.sh
+++ b/codegen/generate_defs_and_docs.sh
@@ -8,8 +8,8 @@
 #   glibmm/tools/defs_gen/docextract_to_xml.py
 #   glibmm/tools/defs_gen/h2def.py
 #   glibmm/tools/enum.pl
-#   atk/atk/*.h
-#   atk/atk/*.c
+#   atk/atk/*.h atk/build/atk/*.h
+#   atk/atk/*.c atk/build/atk/*.c
 #   atkmm/codegen/extradefs/generate_extra_defs
 
 # Generated files:
@@ -18,22 +18,51 @@
 #   atkmm/atk/src/atk_methods.defs
 #   atkmm/atk/src/atk_signals.defs
 
+# To update the atk_docs.xml file and the .defs files:
+# 1. ./generate_defs_and_docs.sh
+#    Generates atk/src/atk_signals.defs.orig and atk/src/atk_signals.defs.
+#    If any hunks from the patch file fail to apply, apply them manually to the
+#    atk_signals.defs file, if required.
+# 2. Optional: Remove atk/src/atk_signals.defs.orig.
+
+# To update the atk_signals.defs file and the patch file:
+# 1. Like step 1 when updating only the docs.xml and .defs files.
+# 2. Apply new patches manually to the atk_signals.defs file.
+# 3. ./generate_defs_and_docs.sh --make-patch
+# 4. Like step 2 when updating only the nly the docs.xml and .defs files.
+
 GLIBMM_TOOLS_DIR=../../glibmm/tools
 ATK_DIR=../../atk
 ATKMM_ATK_SRC_DIR=../atk/src
 
-$GLIBMM_TOOLS_DIR/defs_gen/docextract_to_xml.py \
-  -s $ATK_DIR/atk \
-  >$ATKMM_ATK_SRC_DIR/atk_docs.xml
+if [ $# -eq 0 ]
+then
+  $GLIBMM_TOOLS_DIR/defs_gen/docextract_to_xml.py \
+    --with-properties --no-recursion \
+    -s $ATK_DIR/atk -s $ATK_DIR/build/atk \
+    >$ATKMM_ATK_SRC_DIR/atk_docs.xml
 
-$GLIBMM_TOOLS_DIR/enum.pl \
-  $ATK_DIR/atk/*.h \
-  >$ATKMM_ATK_SRC_DIR/atk_enums.defs
+  shopt -s nullglob # Skip a filename pattern that matches no file
 
-$GLIBMM_TOOLS_DIR/defs_gen/h2def.py \
-  $ATK_DIR/atk/*.h \
-  >$ATKMM_ATK_SRC_DIR/atk_methods.defs
+  $GLIBMM_TOOLS_DIR/enum.pl \
+    $ATK_DIR/atk/*.h $ATK_DIR/build/atk/*.h \
+    >$ATKMM_ATK_SRC_DIR/atk_enums.defs
 
-extradefs/generate_extra_defs \
-  >$ATKMM_ATK_SRC_DIR/atk_signals.defs
+  $GLIBMM_TOOLS_DIR/defs_gen/h2def.py \
+    $ATK_DIR/atk/*.h $ATK_DIR/build/atk/*.h \
+    >$ATKMM_ATK_SRC_DIR/atk_methods.defs
 
+  extradefs/generate_extra_defs \
+    >$ATKMM_ATK_SRC_DIR/atk_signals.defs
+  # patch version 2.7.5 does not like directory names.
+  cd "$ATKMM_ATK_SRC_DIR"
+  PATCH_OPTIONS="--backup --version-control=simple --suffix=.orig"
+  patch $PATCH_OPTIONS atk_signals.defs atk_signals.defs.patch
+elif [ "$1" = "--make-patch" ]
+then
+  ATKMM_ATK_SRC_DIR_FILE=$ATKMM_ATK_SRC_DIR/atk_signals.defs
+  diff --unified=5 $ATKMM_ATK_SRC_DIR_FILE.orig $ATKMM_ATK_SRC_DIR_FILE > $ATKMM_ATK_SRC_DIR_FILE.patch
+else
+  echo "Usage: $0 [--make-patch]"
+  exit 1
+fi


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