summaryrefslogtreecommitdiff
path: root/tools/gen_scripts/glib_generate_enums.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gen_scripts/glib_generate_enums.sh')
-rwxr-xr-xtools/gen_scripts/glib_generate_enums.sh33
1 files changed, 14 insertions, 19 deletions
diff --git a/tools/gen_scripts/glib_generate_enums.sh b/tools/gen_scripts/glib_generate_enums.sh
index b366ffd5..b41f2430 100755
--- a/tools/gen_scripts/glib_generate_enums.sh
+++ b/tools/gen_scripts/glib_generate_enums.sh
@@ -1,8 +1,7 @@
#!/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 files will be placed in glib/src.
+# The script assumes that it resides in the tools/gen_scripts directory and
+# the defs files will be placed in glib/src.
# To update the g[lib|module|object]_enums.defs files:
# 1. ./glib_generate_enums.sh
@@ -17,31 +16,27 @@
# 3. ./glib_generate_enums.sh --make-patch
# 4. Like step 2 when updating only the g[lib|module|object]_enums.defs files.
-if [ -z "$JHBUILD_SOURCES" ]; then
- echo -e "JHBUILD_SOURCES must contain the path to the jhbuild sources."
- exit 1;
-fi
+source "$(dirname "$0")/init_generate.sh"
-PREFIX="$JHBUILD_SOURCES/glib"
-ROOT_DIR="$(dirname "$0")/../.."
-OUT_DIR="$ROOT_DIR/glib/src"
+out_dir="$root_dir/glib/src"
shopt -s extglob # Enable extended pattern matching
+shopt -s nullglob # Skip a filename pattern that matches no file
if [ $# -eq 0 ]
then
- ENUM_PL="$JHBUILD_SOURCES/glibmm/tools/enum.pl"
# Process files whose names end with .h, but not with private.h.
- $ENUM_PL "$PREFIX"/glib/!(*private).h "$PREFIX"/glib/deprecated/!(*private).h > "$OUT_DIR"/glib_enums.defs
- $ENUM_PL "$PREFIX"/gmodule/!(*private).h > "$OUT_DIR"/gmodule_enums.defs
- $ENUM_PL "$PREFIX"/gobject/!(*private).h > "$OUT_DIR"/gobject_enums.defs
+ "$gen_enums" "$source_prefix"/glib/!(*private).h "$source_prefix"/glib/deprecated/!(*private).h \
+ "$build_prefix"/glib/!(*private).h "$build_prefix"/glib/deprecated/!(*private).h > "$out_dir"/glib_enums.defs
+ "$gen_enums" "$source_prefix"/gmodule/!(*private).h "$build_prefix"/gmodule/!(*private).h > "$out_dir"/gmodule_enums.defs
+ "$gen_enums" "$source_prefix"/gobject/!(*private).h "$build_prefix"/gobject/!(*private).h > "$out_dir"/gobject_enums.defs
# patch version 2.7.5 does not like directory names.
- cd "$OUT_DIR"
- PATCH_OPTIONS="--backup --version-control=simple --suffix=.orig"
- patch $PATCH_OPTIONS glib_enums.defs glib_enums.defs.patch
+ cd "$out_dir"
+ patch_options="--backup --version-control=simple --suffix=.orig"
+ patch $patch_options glib_enums.defs glib_enums.defs.patch
elif [ "$1" = "--make-patch" ]
then
- OUT_DIR_FILE="$OUT_DIR"/glib_enums.defs
- diff --unified=5 "$OUT_DIR_FILE".orig "$OUT_DIR_FILE" > "$OUT_DIR_FILE".patch
+ out_dir_file="$out_dir"/glib_enums.defs
+ diff --unified=5 "$out_dir_file".orig "$out_dir_file" > "$out_dir_file".patch
else
echo "Usage: $0 [--make-patch]"
exit 1