+2.58.1 (stable):
+
+gmmproc:
+* _WRAP_ENUM and _WRAP_GERROR: Add gtype_func parameter
+ (Kjell Ahlstedt)
+* docextract_to_xml.py: Add --exclude-file option.
+ (Kjell Ahlstedt)
+
+Documentation:
+* README: Add installation instructions
+ (Tapasweni Pathak) Merge request !10
+* Don’t use @retval on out args, use @param[out]
+ (Daniel Boles) Merge request !6
+
+
2.58.0 (stable):
This release is identical to 2.56.1.
This is glibmm, a C++ API for parts of glib that are useful for C++.
See http://www.gtkmm.org
+Installation Procedure
+----------------------
+
+$ tar xf glibmm-@GLIBMM_VERSION@.tar.gz
+$ cd glibmm-@GLIBMM_VERSION@
+$ ./configure --prefix=/some_directory
+$ make
+$ make install
## You should have received a copy of the GNU Lesser General Public License
## along with this library. If not, see <http://www.gnu.org/licenses/>.
-AC_INIT([glibmm], [2.58.0],
+AC_INIT([glibmm], [2.58.1],
[https://gitlab.gnome.org/GNOME/glibmm/issues],
[glibmm], [http://www.gtkmm.org/])
AC_PREREQ([2.59])
AC_SUBST([LIBGLIBMM_SO_VERSION], [4:0:3])
AC_PROG_CXX
-MM_AX_CXX_COMPILE_STDCXX([11], [noext],[mandatory])
+MM_AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
AC_DISABLE_STATIC
LT_INIT([win32-dll])
giomm_files_not_mac = \
desktopappinfo.hg
-
-giomm_files_hg = \
- $(giomm_files_any_hg) \
- $(giomm_files_posix_hg) \
- $(giomm_files_not_mac)
-giomm_files_ccg = $(giomm_files_hg:.hg=.ccg)
#m4 _CONVERSION(`gchar**',`std::vector<Glib::ustring>',`Glib::ArrayHandler<Glib::ustring>::array_to_vector($3, Glib::OWNERSHIP_DEEP)')
_WRAP_METHOD(std::vector<Glib::ustring> list_children() const, g_settings_list_children)
- _WRAP_METHOD(std::vector<Glib::ustring> list_keys() const, g_settings_list_keys, deprecated "Use SettingsSchema::list_kes().")
+ _WRAP_METHOD(std::vector<Glib::ustring> list_keys() const, g_settings_list_keys, deprecated "Use SettingsSchema::list_keys().")
_IGNORE(g_settings_get_range, g_settings_list_relocatable_schemas) // deprecated
#include <giomm/tlsdatabase.h>
#include <giomm/tlsinteraction.h>
#include "slot_async.h"
+
+namespace Gio
+{
+
+// Deprecated in glib 2.60, but not in glibmm 2.58.
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+void TlsConnection::set_rehandshake_mode(TlsRehandshakeMode mode)
+{
+ g_tls_connection_set_rehandshake_mode(gobj(), ((GTlsRehandshakeMode)(mode)));
+}
+TlsRehandshakeMode TlsConnection::get_rehandshake_mode() const
+{
+ return ((TlsRehandshakeMode)(g_tls_connection_get_rehandshake_mode(const_cast<GTlsConnection*>(gobj()))));
+}
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+} // namespace Gio
_WRAP_METHOD(void set_require_close_notify(bool require_close_notify = true), g_tls_connection_set_require_close_notify)
_WRAP_METHOD(bool get_require_close_notify() const, g_tls_connection_get_require_close_notify)
- _WRAP_METHOD(void set_rehandshake_mode(TlsRehandshakeMode mode), g_tls_connection_set_rehandshake_mode)
- _WRAP_METHOD(TlsRehandshakeMode get_rehandshake_mode() const, g_tls_connection_get_rehandshake_mode)
+ // Deprecated in glib 2.60, but not in glibmm 2.58.
+ _WRAP_METHOD_DOCS_ONLY(g_tls_connection_set_rehandshake_mode)
+ void set_rehandshake_mode(TlsRehandshakeMode mode);
+ _WRAP_METHOD_DOCS_ONLY(g_tls_connection_get_rehandshake_mode)
+ TlsRehandshakeMode get_rehandshake_mode() const;
_WRAP_METHOD(void set_use_system_certdb(bool use_system_certdb = true), g_tls_connection_set_use_system_certdb,
deprecated "Use set_database() instead.")
*
* @param str The string to convert to a numeric value.
* @param start_index The index of the first character that should be used in the conversion.
- * @retval end_index The index of the character after the last character used in the conversion.
+ * @param[out] end_index The index of the character after the last character used in the conversion.
* @return The <tt>double</tt> value.
* @throw std::out_of_range Thrown if @a start_index is out of range.
* @throw std::overflow_error Thrown if the correct value would cause overflow.
*
* The actual name used is returned in @a name_used.
*
+ * @param[out] name_used The actual name used.
* @param prefix Template for file name, basename only.
- * @retval name_used The actual name used.
* @return A file handle (as from <tt>open()</tt>) to the file opened for reading
* and writing. The file is opened in binary mode on platforms where there is a
* difference. The file handle should be closed with <tt>close()</tt>.
* This function works like file_open_tmp(std::string&, const std::string&)
* but uses a default basename prefix.
*
- * @retval name_used The actual name used.
+ * @param[out] name_used The actual name used.
* @return A file handle (as from <tt>open()</tt>) to the file opened for reading
* and writing. The file is opened in binary mode on platforms where there is a
* difference. The file handle should be closed with <tt>close()</tt>.
#endif /* G_OS_WIN32 */
/** Read a single UCS-4 character.
- * @retval thechar The Unicode character.
+ * @param[out] thechar The Unicode character.
* @return The status of the operation.
* @throw Glib::IOChannelError
* @throw Glib::ConvertError
* @param count The size of the buffer in bytes. Note that the buffer may
* not be complelely filled even if there is data in the buffer if the
* remaining data is not a complete character.
- * @retval bytes_read The number of bytes read. This may be zero even on
+ * @param[out] bytes_read The number of bytes read. This may be zero even on
* success if @a count < 6 and the channel's encoding is not <tt>""</tt>.
* This indicates that the next UTF-8 character is too wide for the buffer.
* @return The status of the operation.
g_io_channel_read_chars, errthrow)
/** Read a maximum of @a count bytes into @a str.
+ * @param[out] str The characters that have been read.
* @param count The maximum number of bytes to read.
- * @retval str The characters that have been read.
* @return The status of the operation.
* @throw Glib::IOChannelError
* @throw Glib::ConvertError
/** Read a whole line.
* Reads until the line separator is found, which is included
* in the result string.
- * @retval line The line that was read.
+ * @param[out] line The line that was read.
* @return The status of the operation.
* @throw Glib::IOChannelError
* @throw Glib::ConvertError
_IGNORE(g_io_channel_read_line, g_io_channel_read_line_string)
/** Reads all the remaining data from the file.
- * @retval str The resulting string.
+ * @param[out] str The resulting string.
* @return Glib::IO_STATUS_NORMAL on success. This function never
* returns Glib::IO_STATUS_EOF.
* @throw Glib::IOChannelError
/** Write a memory area of @a count bytes to the I/O channel.
* @param buf The start of the memory area.
* @param count The number of bytes to write.
- * @retval bytes_written The number of bytes written to the channel.
+ * @param[out] bytes_written The number of bytes written to the channel.
* @return The status of the operation.
* @throw Glib::IOChannelError
* @throw Glib::ConvertError
return line
-def parse_dir(dir, doc_dict):
+def parse_dir(dir, exclude_files, doc_dict):
for file in os.listdir(dir):
if file in ('.', '..'): continue
path = os.path.join(dir, file)
+ if path in exclude_files: continue
if os.path.isdir(path):
if not no_recursion:
- parse_dir(path, doc_dict)
+ parse_dir(path, exclude_files, doc_dict)
elif len(file) > 2 and file[-2:] in ('.c', '.h'):
sys.stderr.write("Processing " + path + '\n')
parse_file(open(path, 'r'), doc_dict)
-def extract(dirs, doc_dict=None):
+def extract(dirs, exclude_files, doc_dict=None):
if not doc_dict: doc_dict = {}
for dir in dirs:
- parse_dir(dir, doc_dict)
+ parse_dir(dir, exclude_files, doc_dict)
return doc_dict
tmpl_section_pattern = re.compile(r'^<!-- ##### (\w+) (\w+) ##### -->$')
line = fp.readline()
-def extract_tmpl(dirs, doc_dict=None):
+def extract_tmpl(dirs, exclude_files, doc_dict=None):
if not doc_dict: doc_dict = {}
for dir in dirs:
for file in os.listdir(dir):
if file in ('.', '..'): continue
path = os.path.join(dir, file)
+ if path in exclude_files: continue
if os.path.isdir(path):
continue
if len(file) > 5 and file[-5:] == '.sgml':
def usage():
sys.stderr.write('usage: docextract_to_xml.py ' +
- '[-s /src/dir | --source-dir=/src/dir] [-a | --with-annotations] ' +
- '[-p | --with-properties] [-c | --with-sections] [-r | --no-recursion] ' +
+ '[-s /src/dir | --source-dir=/src/dir] ' +
+ '[-x /src/dir/file-to-exclude | --exclude-file=/src/dir/file-to-exclude] ' +
+ '[-a | --with-annotations] [-p | --with-properties] ' +
+ '[-c | --with-sections] [-r | --no-recursion] ' +
'[-n | --no-since] [-i | --no-signals ] [-e | --no-enums ]\n')
sys.exit(1)
if __name__ == '__main__':
try:
- opts, args = getopt.getopt(sys.argv[1:], "d:s:o:apcrnie",
- ["source-dir=", "with-annotations",
- "with-properties", "with-sections",
- "no-recursion", "no-since",
+ opts, args = getopt.getopt(sys.argv[1:], "s:x:apcrnie",
+ ["source-dir=", "exclude-file=",
+ "with-annotations", "with-properties",
+ "with-sections", "no-recursion", "no-since",
"no-signals", "no-enums"])
except getopt.error as e:
sys.stderr.write('docextract_to_xml.py: %s\n' % e)
usage()
source_dirs = []
+ exclude_files = []
with_annotations = False
with_signals = True
with_properties = False
for opt, arg in opts:
if opt in ('-s', '--source-dir'):
source_dirs.append(arg)
- if opt in ('-a', '--with-annotations'):
+ elif opt in ('-x', '--exclude-file'):
+ exclude_files.append(arg)
+ elif opt in ('-a', '--with-annotations'):
with_annotations = True
- if opt in ('-p', '--with-properties'):
+ elif opt in ('-p', '--with-properties'):
with_properties = True
- if opt in ('-c', '--with-sections'):
+ elif opt in ('-c', '--with-sections'):
with_sections = True
- if opt in ('-r', '--no-recursion'):
+ elif opt in ('-r', '--no-recursion'):
docextract.no_recursion = True
- if opt in ('-n', '--no-since'):
+ elif opt in ('-n', '--no-since'):
docextract.no_since = True
- if opt in ('-i', '--no-signals'):
+ elif opt in ('-i', '--no-signals'):
with_signals = False
- if opt in ('-e', '--no-enums'):
+ elif opt in ('-e', '--no-enums'):
with_enums = False
if len(args) != 0:
usage()
- docs = docextract.extract(source_dirs);
- docextract.extract_tmpl(source_dirs, docs); #Try the tmpl sgml files too.
+ docs = docextract.extract(source_dirs, exclude_files);
+ docextract.extract_tmpl(source_dirs, exclude_files, docs); #Try the tmpl sgml files too.
# print d.docs
# 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
#!/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"
#!/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
# 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
# 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
#!/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
#!/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"
#!/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
# 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
# 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
#!/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
# 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
--- /dev/null
+#!/bin/bash
+
+# This file is part of glibmm-2.4.
+# 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-2.4 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-2.4. These are source files.
+gen_docs="$GMMPROC_GEN_SOURCE_DIR/glibmm-2.4/tools/defs_gen/docextract_to_xml.py"
+gen_methods="$GMMPROC_GEN_SOURCE_DIR/glibmm-2.4/tools/defs_gen/h2def.py"
+gen_enums="$GMMPROC_GEN_SOURCE_DIR/glibmm-2.4/tools/enum.pl"
+
+# Where to find executables that generate extra defs (signals and properties).
+# glibmm-2.4 is built with autotools.
+# autotools support, but don't require, non-source-dir builds.
+extra_defs_gen_dir="$GMMPROC_GEN_BUILD_DIR/glibmm-2.4/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
dnl
-dnl _ENUM(cpp_type, c_type, value_suffix, `element_list', `no_gtype', `optional_refdoc_comment', 'deprecated')
-dnl $1 $2 $3 $4 $5 $6 $7
+dnl _ENUM(cpp_type, c_type, value_suffix, `element_list', `gtype_func', `optional_refdoc_comment', 'deprecated')
+dnl $1 $2 $3 $4 $5 $6 $7
dnl
m4_define(`_ENUM',`dnl
_PUSH()
')dnl endif Flags
ifelse(`$7',,,`_DEPRECATE_IFDEF_END')`'dnl The expansion of _DEPRECATE_IFDEF_END ends with a newline
-m4_ifelse($5,`NO_GTYPE',,`dnl else
+m4_ifelse(`$5',`NO_GTYPE',,`dnl else
__NAMESPACE_END__
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// static
GType Glib::Value<__NAMESPACE__::__ENUM_CPPNAME__>::value_type()
{
+m4_ifelse(`$5',,`dnl
return _GET_TYPE_FUNC(__ENUM_CNAME__);
+',`dnl
+ return `$5()';
+')dnl
}
ifelse(`$7',,,`_DEPRECATE_IFDEF_END')`'dnl
dnl
-dnl _GERROR(cpp_type, c_type, domain, `element_list', `no_gtype', `class_docs', `enum_docs', 'deprecated')
-dnl $1 $2 $3 $4 $5 $6 $7 $8
+dnl _GERROR(cpp_type, c_type, domain, `element_list', `gtype_func', `class_docs', `enum_docs', 'deprecated')
+dnl $1 $2 $3 $4 $5 $6 $7 $8
dnl
m4_define(`_GERROR',`dnl
};
ifelse(`$8',,,`_DEPRECATE_IFDEF_END')`'dnl The expansion of _DEPRECATE_IFDEF_END ends with a newline
-m4_ifelse($5,`NO_GTYPE',,`dnl else
+m4_ifelse(`$5',`NO_GTYPE',,`dnl else
__NAMESPACE_END__
#ifndef DOXYGEN_SHOULD_SKIP_THIS
throw __NAMESPACE__::__CPPNAME__`'(gobject);
}
-m4_ifelse($5,`NO_GTYPE',,`dnl else
+m4_ifelse(`$5',`NO_GTYPE',,`dnl else
// static
GType Glib::Value<__NAMESPACE__::__CPPNAME__::Code>::value_type()
{
+m4_ifelse(`$5',,`dnl
return _GET_TYPE_FUNC(__CNAME__);
+',`dnl
+ return `$5()';
+')dnl
}
')dnl endif !NO_GTYPE
}
# void output_wrap_enum($filename, $line_num, $cpp_type, $c_type,
-# $comment, $ref_subst_in, $ref_subst_out, $no_gtype,
+# $comment, $ref_subst_in, $ref_subst_out, $gtype_func,
# $deprecated, $deprecation_docs, $newin)
sub output_wrap_enum($$$$$$$$$$$$)
{
my ($self, $filename, $line_num, $cpp_type, $c_type,
- $comment, $ref_subst_in, $ref_subst_out, $no_gtype,
+ $comment, $ref_subst_in, $ref_subst_out, $gtype_func,
$deprecated, $deprecation_docs, $newin) = @_;
my $objEnum = GtkDefs::lookup_enum($c_type);
$c_type,
$value_suffix,
$elements,
- $no_gtype,
+ $gtype_func,
$comment,
$deprecated
);
}
# void output_wrap_gerror($filename, $line_num, $cpp_type, $c_type, $domain,
-# $class_docs, $ref_subst_in, $ref_subst_out, $no_gtype,
+# $class_docs, $ref_subst_in, $ref_subst_out, $gtype_func,
# $deprecated, $deprecation_docs, $newin)
sub output_wrap_gerror($$$$$$$$$$$$$)
{
my ($self, $filename, $line_num, $cpp_type, $c_type, $domain,
- $class_docs, $ref_subst_in, $ref_subst_out, $no_gtype,
+ $class_docs, $ref_subst_in, $ref_subst_out, $gtype_func,
$deprecated, $deprecation_docs, $newin) = @_;
my $objDefsParser = $$self{objDefsParser};
# Prevent Doxygen from auto-linking to a class called Exception.
$class_docs =~ s/([^%])(Exception class)/$1%$2/g;
- my $str = sprintf("_GERROR(%s,%s,%s,\`%s\',%s,\`%s\',\`%s\',\`%s\')dnl\n",
+ my $str = sprintf("_GERROR(%s,%s,%s,\`%s\',\`%s\',\`%s\',\`%s\',\`%s\')dnl\n",
$cpp_type,
$c_type,
$domain,
$elements,
- $no_gtype,
+ $gtype_func,
$class_docs,
$enum_docs,
$deprecated
my @subst_in = [];
my @subst_out = [];
- my $no_gtype = "";
+ my $gtype_func = "";
my $argDeprecated = "";
my $deprecation_docs = "";
my $newin = "";
+ # $gtype_func:
+ # 1. If an empty string, the M4 macro _ENUM or _GERROR calls _GET_TYPE_FUNC()
+ # that generates the function name from the name of the C type, e.g.
+ # GFileAttributeType -> g_file_attribute_type_get_type
+ # 2. If NO_GTYPE, no call to a *_get_type() function and no Glib::Value
+ # specialization is generated for the enum type.
+ # 3. If anything else, it's assumed to be the name of the *_get_type() function
+ # to generate a call to.
+
# Build a list of custom substitutions, and recognize some flags too.
foreach (@args)
{
if ($arg eq "NO_GTYPE")
{
- $no_gtype = "NO_GTYPE";
+ $gtype_func = "NO_GTYPE";
}
- elsif ($arg =~ /^(get_type_func=)(\s*)$/)
+ elsif ($arg =~ /^gtype_func\s+(\w+)/)
{
- my $part1 = $1;
- my $part2 = $2;
+ $gtype_func = $1;
}
elsif ($arg =~ /^s#([^#]+)#([^#]*)#$/)
{
$newin = string_unquote(string_trim($1));
}
}
- return ($cpp_type, $c_type, $domain, \@subst_in, \@subst_out, $no_gtype,
+ return ($cpp_type, $c_type, $domain, \@subst_in, \@subst_out, $gtype_func,
$argDeprecated, $deprecation_docs, $newin);
}
my $comment = $self->extract_preceding_documentation();
# get the arguments
- my ($cpp_type, $c_type, undef, $ref_subst_in, $ref_subst_out, $no_gtype,
+ my ($cpp_type, $c_type, undef, $ref_subst_in, $ref_subst_out, $gtype_func,
$argDeprecated, $deprecation_docs, $newin) = $self->on_wrap_any_enum(0);
$$self{objOutputter}->output_wrap_enum(
$$self{filename}, $$self{line_num}, $cpp_type, $c_type,
- $comment, $ref_subst_in, $ref_subst_out, $no_gtype,
+ $comment, $ref_subst_in, $ref_subst_out, $gtype_func,
$argDeprecated, $deprecation_docs, $newin);
}
my $class_docs = $self->extract_preceding_documentation();
# get the arguments
- my ($cpp_type, $c_type, $domain, $ref_subst_in, $ref_subst_out, $no_gtype,
+ my ($cpp_type, $c_type, $domain, $ref_subst_in, $ref_subst_out, $gtype_func,
$argDeprecated, $deprecation_docs, $newin) = $self->on_wrap_any_enum(1);
$$self{objOutputter}->output_wrap_gerror(
$$self{filename}, $$self{line_num}, $cpp_type, $c_type, $domain,
- $class_docs, $ref_subst_in, $ref_subst_out, $no_gtype,
+ $class_docs, $ref_subst_in, $ref_subst_out, $gtype_func,
$argDeprecated, $deprecation_docs, $newin);
}