diff options
-rwxr-xr-x | tools/gen_scripts/generate_all.sh | 2 | ||||
-rwxr-xr-x | tools/gen_scripts/gio_generate_docs.sh | 25 | ||||
-rwxr-xr-x | tools/gen_scripts/gio_generate_enums.sh | 31 | ||||
-rwxr-xr-x | tools/gen_scripts/gio_generate_extra_defs.sh | 20 | ||||
-rwxr-xr-x | tools/gen_scripts/gio_generate_methods.sh | 20 | ||||
-rwxr-xr-x | tools/gen_scripts/glib_generate_docs.sh | 24 | ||||
-rwxr-xr-x | tools/gen_scripts/glib_generate_enums.sh | 33 | ||||
-rwxr-xr-x | tools/gen_scripts/glib_generate_extra_defs.sh | 8 | ||||
-rwxr-xr-x | tools/gen_scripts/glib_generate_methods.sh | 33 | ||||
-rwxr-xr-x | tools/gen_scripts/init_generate.sh | 49 |
10 files changed, 132 insertions, 113 deletions
diff --git a/tools/gen_scripts/generate_all.sh b/tools/gen_scripts/generate_all.sh index 5e7f3de1..c16ac6a6 100755 --- a/tools/gen_scripts/generate_all.sh +++ b/tools/gen_scripts/generate_all.sh @@ -2,6 +2,8 @@ # Regenerate all glibmm's docs.xml and .defs files +cd "$(dirname "$0")" + ./glib_generate_docs.sh ./glib_generate_enums.sh ./glib_generate_extra_defs.sh diff --git a/tools/gen_scripts/gio_generate_docs.sh b/tools/gen_scripts/gio_generate_docs.sh index 81fc2e8a..ff6d53cf 100755 --- a/tools/gen_scripts/gio_generate_docs.sh +++ b/tools/gen_scripts/gio_generate_docs.sh @@ -1,22 +1,17 @@ #!/bin/bash -# Note that JHBUILD_SOURCES should be defined to contain the path to the root -# of the jhbuild sources. Also the script assumes that it resides in the -# tools/gen_scripts directory and the XML file will be placed in glib/src. +# The script assumes that it resides in the tools/gen_scripts directory and +# the XML file will be placed in gio/src. -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" -ROOT_DIR="$(dirname "$0")/../.." -OUT_DIR="$ROOT_DIR/gio/src" +out_dir="$root_dir/gio/src" -PARAMS="--with-properties --no-recursion" -for dir in "$PREFIX"/glib/gio; do - PARAMS="$PARAMS -s $dir" +params="--with-properties --no-recursion" +for dir in "$source_prefix/gio" "$build_prefix/gio"; do + params="$params -s $dir" done +# Exclude $build_prefix/gio/xdp-dbus.c. +params="$params -x $build_prefix/gio/xdp-dbus.c" -DOCEXTRACT_TO_XML_PY="$JHBUILD_SOURCES/glibmm/tools/defs_gen/docextract_to_xml.py" -$DOCEXTRACT_TO_XML_PY $PARAMS > "$OUT_DIR"/gio_docs.xml +"$gen_docs" $params > "$out_dir/gio_docs.xml" diff --git a/tools/gen_scripts/gio_generate_enums.sh b/tools/gen_scripts/gio_generate_enums.sh index f891868b..9e5c5317 100755 --- a/tools/gen_scripts/gio_generate_enums.sh +++ b/tools/gen_scripts/gio_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 file will be placed in gio/src. +# The script assumes that it resides in the tools/gen_scripts directory and +# the defs file will be placed in gio/src. # To update the gio_enums.defs file: # 1. ./gio_generate_enums.sh @@ -17,30 +16,26 @@ # 3. ./gio_generate_enums.sh --make-patch # 4. Like step 2 when updating only the gio_enums.defs file. -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/gio/src" -OUT_FILE=gio_enums.defs -OUT_DIR_FILE="$OUT_DIR"/$OUT_FILE +out_dir="$root_dir/gio/src" +out_file=gio_enums.defs +out_dir_file="$out_dir"/$out_file 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"/gio/!(*private).h > "$OUT_DIR_FILE" + # Exclude $build_prefix/gio/xdp-dbus.h. + "$gen_enums" "$source_prefix"/gio/!(*private).h "$build_prefix"/gio/!(*private|xdp-dbus).h > "$out_dir_file" # patch version 2.7.5 does not like directory names. - cd "$OUT_DIR" - PATCH_OPTIONS="--backup --version-control=simple --suffix=.orig" - patch $PATCH_OPTIONS $OUT_FILE $OUT_FILE.patch + cd "$out_dir" + patch_options="--backup --version-control=simple --suffix=.orig" + patch $patch_options $out_file $out_file.patch elif [ "$1" = "--make-patch" ] then - diff --unified=5 "$OUT_DIR_FILE".orig "$OUT_DIR_FILE" > "$OUT_DIR_FILE".patch + diff --unified=5 "$out_dir_file".orig "$out_dir_file" > "$out_dir_file".patch else echo "Usage: $0 [--make-patch]" exit 1 diff --git a/tools/gen_scripts/gio_generate_extra_defs.sh b/tools/gen_scripts/gio_generate_extra_defs.sh index b4330d71..3d493113 100755 --- a/tools/gen_scripts/gio_generate_extra_defs.sh +++ b/tools/gen_scripts/gio_generate_extra_defs.sh @@ -16,22 +16,22 @@ # 3. ./gio_generate_extra_defs.sh --make-patch # 4. Like step 2 when updating only the gio_signals.defs file. -ROOT_DIR="$(dirname "$0")/../.." -GEN_DIR="$ROOT_DIR/tools/extra_defs_gen" -OUT_DIR="$ROOT_DIR/gio/src" -OUT_FILE=gio_signals.defs -OUT_DIR_FILE="$OUT_DIR"/$OUT_FILE +source "$(dirname "$0")/init_generate.sh" + +out_dir="$root_dir/gio/src" +out_file=gio_signals.defs +out_dir_file="$out_dir"/$out_file if [ $# -eq 0 ] then - "$GEN_DIR"/generate_defs_gio > "$OUT_DIR_FILE" + "$extra_defs_gen_dir"/generate_defs_gio > "$out_dir_file" # patch version 2.7.5 does not like directory names. - cd "$OUT_DIR" - PATCH_OPTIONS="--backup --version-control=simple --suffix=.orig" - patch $PATCH_OPTIONS $OUT_FILE $OUT_FILE.patch + cd "$out_dir" + patch_options="--backup --version-control=simple --suffix=.orig" + patch $patch_options $out_file $out_file.patch elif [ "$1" = "--make-patch" ] then - diff --unified=5 "$OUT_DIR_FILE".orig "$OUT_DIR_FILE" > "$OUT_DIR_FILE".patch + diff --unified=5 "$out_dir_file".orig "$out_dir_file" > "$out_dir_file".patch else echo "Usage: $0 [--make-patch]" exit 1 diff --git a/tools/gen_scripts/gio_generate_methods.sh b/tools/gen_scripts/gio_generate_methods.sh index c7dc79fb..4a3def34 100755 --- a/tools/gen_scripts/gio_generate_methods.sh +++ b/tools/gen_scripts/gio_generate_methods.sh @@ -1,20 +1,14 @@ #!/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 glib/src. +# The script assumes that it resides in the tools/gen_scripts directory and +# the defs file will be placed in gio/src. -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/gio/src" +out_dir="$root_dir/gio/src" shopt -s extglob # Enable extended pattern matching -H2DEF_PY="$JHBUILD_SOURCES/glibmm/tools/defs_gen/h2def.py" +shopt -s nullglob # Skip a filename pattern that matches no file # Process files whose names end with .h, but not with private.h. -$H2DEF_PY "$PREFIX"/gio/!(*private).h > "$OUT_DIR"/gio_methods.defs -#patch "$OUT_DIR"/gio_methods.defs "$OUT_DIR"/gio_methods.defs.patch +# Exclude $build_prefix/gio/xdp-dbus.h. +"$gen_methods" "$source_prefix"/gio/!(*private).h "$build_prefix"/gio/!(*private|xdp-dbus).h > "$out_dir"/gio_methods.defs diff --git a/tools/gen_scripts/glib_generate_docs.sh b/tools/gen_scripts/glib_generate_docs.sh index 92a942ff..c6618eee 100755 --- a/tools/gen_scripts/glib_generate_docs.sh +++ b/tools/gen_scripts/glib_generate_docs.sh @@ -1,22 +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 XML file will be placed in glib/src. +# The script assumes that it resides in the tools/gen_scripts directory and +# the XML file will be placed in glib/src. -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" -ROOT_DIR="$(dirname "$0")/../.." -OUT_DIR="$ROOT_DIR/glib/src" +out_dir="$root_dir/glib/src" -PARAMS="--with-properties --no-recursion" -for dir in "$PREFIX"/glib/{glib,glib/deprecated,gmodule,gobject,gthread}; do - PARAMS="$PARAMS -s $dir" +params="--with-properties --no-recursion" +for dir in "$source_prefix"/{glib,glib/deprecated,gmodule,gobject,gthread} \ + "$build_prefix"/{glib,gmodule,gobject,gthread}; 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/glib_docs.xml" +"$gen_docs" $params > "$out_dir/glib_docs.xml" 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 diff --git a/tools/gen_scripts/glib_generate_extra_defs.sh b/tools/gen_scripts/glib_generate_extra_defs.sh index ae3f285b..fdfdff45 100755 --- a/tools/gen_scripts/glib_generate_extra_defs.sh +++ b/tools/gen_scripts/glib_generate_extra_defs.sh @@ -3,8 +3,8 @@ # This script assumes that it resides in the tools/gen_scripts directory and # the defs file will be placed in glib/src. -ROOT_DIR="$(dirname "$0")/../.." -GEN_DIR="../extra_defs_gen" -OUT_DIR="$ROOT_DIR/glib/src" +source "$(dirname "$0")/init_generate.sh" -"$GEN_DIR"/generate_defs_glib > "$OUT_DIR"/glib_signals.defs +out_dir="$root_dir/glib/src" + +"$extra_defs_gen_dir"/generate_defs_glib > "$out_dir"/glib_signals.defs diff --git a/tools/gen_scripts/glib_generate_methods.sh b/tools/gen_scripts/glib_generate_methods.sh index 701856a6..e42daff3 100755 --- a/tools/gen_scripts/glib_generate_methods.sh +++ b/tools/gen_scripts/glib_generate_methods.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 it resides in the -# tools/gen_scripts directory and the defs files will be placed in glib/src. +# The script assumes 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]_functions.defs files: # 1. ./glib_generate_methods.sh @@ -17,31 +16,27 @@ # 3. ./glib_generate_methods.sh --make-patch # 4. Like step 2 when updating only the g[lib|module|object]_functions.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 - H2DEF_PY="$JHBUILD_SOURCES/glibmm/tools/defs_gen/h2def.py" # Process files whose names end with .h, but not with private.h. - $H2DEF_PY "$PREFIX"/glib/!(*private).h "$PREFIX"/glib/deprecated/!(*private).h > "$OUT_DIR"/glib_functions.defs - $H2DEF_PY "$PREFIX"/gmodule/!(*private).h > "$OUT_DIR"/gmodule_functions.defs - $H2DEF_PY "$PREFIX"/gobject/!(*private).h > "$OUT_DIR"/gobject_functions.defs + "$gen_methods" "$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_functions.defs + "$gen_methods" "$source_prefix"/gmodule/!(*private).h "$build_prefix"/gmodule/!(*private).h > "$out_dir"/gmodule_functions.defs + "$gen_methods" "$source_prefix"/gobject/!(*private).h "$build_prefix"/gobject/!(*private).h > "$out_dir"/gobject_functions.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_functions.defs glib_functions.defs.patch + cd "$out_dir" + patch_options="--backup --version-control=simple --suffix=.orig" + patch $patch_options glib_functions.defs glib_functions.defs.patch elif [ "$1" = "--make-patch" ] then - OUT_DIR_FILE="$OUT_DIR"/glib_functions.defs - diff --unified=5 "$OUT_DIR_FILE".orig "$OUT_DIR_FILE" > "$OUT_DIR_FILE".patch + out_dir_file="$out_dir"/glib_functions.defs + diff --unified=5 "$out_dir_file".orig "$out_dir_file" > "$out_dir_file".patch else echo "Usage: $0 [--make-patch]" exit 1 diff --git a/tools/gen_scripts/init_generate.sh b/tools/gen_scripts/init_generate.sh new file mode 100755 index 00000000..d0d81f7c --- /dev/null +++ b/tools/gen_scripts/init_generate.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +# This file is part of glibmm. +# Initializes some variables for the scripts that generate docs and defs files. +# Not intented to be called directly from the command line. + +# Global environment variables: +# GMMPROC_GEN_SOURCE_DIR Top directory where source files are searched for. +# Default value: $(dirname "$0")/../../.. +# i.e. 3 levels above this file. +# GMMPROC_GEN_BUILD_DIR Top directory where built files are searched for. +# Default value: $GMMPROC_GEN_SOURCE_DIR +# +# If you use jhbuild, you can set these environment variables equal to jhbuild's +# configuration variables checkoutroot and buildroot, respectively. +# Usually you can leave GMMPROC_GEN_SOURCE_DIR undefined. +# If you have set buildroot=None, GMMPROC_GEN_BUILD_DIR can also be undefined. + +# Root directory of glibmm source files. +root_dir="$(dirname "$0")/../.." + +# Where to search for source files. +if [ -z "$GMMPROC_GEN_SOURCE_DIR" ]; then + GMMPROC_GEN_SOURCE_DIR="$root_dir/.." +fi + +# Where to search for built files. +if [ -z "$GMMPROC_GEN_BUILD_DIR" ]; then + GMMPROC_GEN_BUILD_DIR="$GMMPROC_GEN_SOURCE_DIR" +fi + +# Scripts in glibmm. These are source files. +gen_docs="$GMMPROC_GEN_SOURCE_DIR/glibmm/tools/defs_gen/docextract_to_xml.py" +gen_methods="$GMMPROC_GEN_SOURCE_DIR/glibmm/tools/defs_gen/h2def.py" +gen_enums="$GMMPROC_GEN_SOURCE_DIR/glibmm/tools/enum.pl" + +# Where to find executables that generate extra defs (signals and properties). +# glibmm is built with autotools. +# autotools support non-source-dir builds, but glibmm does not. +# See the glibmm entry in jhbuild's modulesets files. +extra_defs_gen_dir="$GMMPROC_GEN_SOURCE_DIR/glibmm/tools/extra_defs_gen" + +source_prefix="$GMMPROC_GEN_SOURCE_DIR/glib" +build_prefix="$GMMPROC_GEN_BUILD_DIR/glib" +if [ "$build_prefix" == "$source_prefix" ]; then + # glib is built with meson, which requires non-source-dir builds. + # This is what jhbuild does, if neccesary, to force non-source-dir builds. + build_prefix="$build_prefix/build" +fi |