File: generate_defs_and_docs.sh

package info (click to toggle)
atkmm1.6 2.28.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 3,284 kB
  • sloc: xml: 5,642; sh: 4,197; perl: 236; cpp: 142; makefile: 88
file content (81 lines) | stat: -rwxr-xr-x 2,704 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash

# atkmm/codegen/generate_defs_and_docs.sh

# This script must be executed from directory atkmm/codegen.

# Assumed directory structure:
#   glibmm/tools/defs_gen/docextract_to_xml.py
#   glibmm/tools/defs_gen/h2def.py
#   glibmm/tools/enum.pl
#   atk/atk/*.h atk/build/atk/*.h
#   atk/atk/*.c atk/build/atk/*.c
#   atkmm/codegen/extradefs/generate_extra_defs

# Generated files:
#   atkmm/atk/src/atk_docs.xml
#   atkmm/atk/src/atk_enums.defs
#   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

if [ $# -eq 0 ]
then
  # Documentation
  PARAMS="--with-properties --no-recursion"
  for dir in $ATK_DIR/atk $ATK_DIR/build/atk; do
    if [ -d "$dir" ]; then
      PARAMS="$PARAMS -s $dir"
    fi
  done
  $GLIBMM_TOOLS_DIR/defs_gen/docextract_to_xml.py $PARAMS \
    >$ATKMM_ATK_SRC_DIR/atk_docs.xml

  shopt -s nullglob # Skip a filename pattern that matches no file

  # Enums
  $GLIBMM_TOOLS_DIR/enum.pl \
    $ATK_DIR/atk/*.h $ATK_DIR/build/atk/*.h \
    >$ATKMM_ATK_SRC_DIR/atk_enums.defs

  # Functions and methods
  $GLIBMM_TOOLS_DIR/defs_gen/h2def.py \
    $ATK_DIR/atk/*.h $ATK_DIR/build/atk/*.h \
    >$ATKMM_ATK_SRC_DIR/atk_methods.defs

  # Properties and signals
  extradefs/generate_extra_defs \
    >$ATKMM_ATK_SRC_DIR/atk_signals.defs
  if [ -f $ATKMM_ATK_SRC_DIR/atk_signals.defs.patch ]; then
    # 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
  else
    echo "File $ATKMM_ATK_SRC_DIR/atk_signals.defs.patch does not exist."
    echo "You may have to patch $ATKMM_ATK_SRC_DIR/atk_signals.defs manually."
  fi
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