From 8ade1af707442e3de0d945bff29aa7f58a091f53 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 1 Jan 2018 13:48:46 +0000 Subject: [PATCH] docs: Update the "building GLib" section The content has slowly gone out of sync with the implementation, and some of it is also showing its age. --- docs/reference/glib/building.xml | 189 ++++++++++++++++--------------- 1 file changed, 99 insertions(+), 90 deletions(-) diff --git a/docs/reference/glib/building.xml b/docs/reference/glib/building.xml index ce630814f..1652add67 100644 --- a/docs/reference/glib/building.xml +++ b/docs/reference/glib/building.xml @@ -43,7 +43,7 @@ The GTK+ documentation contains - further details + further details about the build process and ways to influence it. @@ -52,26 +52,23 @@ Before you can compile the GLib library, you need to have various other tools and libraries installed on your system. - Beyond a C compiler (which must implement C90, but does not need - to implement C99), the two tools needed during the build process - (as differentiated from the tools used in when creating GLib - mentioned above such as autoconf) are - pkg-config and GNU make. + If you are building from a release archive, you will need + a compliant C toolchain, + GNU Make, and pkg-config; + if you are building directly from a Git repository clone + of GLib, you will also need the GNU Autotools mentioned + above. - pkg-config + pkg-config is a tool for tracking the compilation flags needed for libraries that are used by the GLib library. (For each library, a small .pc text file is installed in a standard location that contains the compilation flags needed for that library along with version number - information.) The version of pkg-config - needed to build GLib is mirrored in the - dependencies directory - on the GTK+ FTP - site. + information). @@ -107,7 +104,7 @@ If your system has an iconv() implementation but you want to use libiconv instead, you can pass the - --with-libiconv option to configure. This forces + option to configure. This forces libiconv to be used. @@ -151,20 +148,21 @@ GRegex uses the PCRE library - for regular expression matching. The default is to use the internal - version of PCRE that is patched to use GLib for memory management - and Unicode handling. If you prefer to use the system-supplied PCRE - library you can pass the option - to, but it is not recommended. + for regular expression matching. The default is to use the system + version of PCRE, to reduce the chances of security fixes going out + of sync. GLib additionally provides an internal copy of PCRE in case + the system version is too old, or does not support UTF-8; the internal + copy is patched to use GLib for memory management and to share the + same Unicode tables. The optional extended attribute support in GIO requires the - getxattr() family of functions that may be provided by glibc or - by the standalone libattr library. To build GLib without extended - attribute support, use the - option. + getxattr() family of functions that may be + provided by the C library or by the standalone libattr library. To + build GLib without extended attribute support, use the + option. @@ -187,7 +185,9 @@ The optional support for SystemTap can be disabled with the - configure option. + configure option. Additionally, you can control the location + where GLib installs the SystemTap probes, using the + configure option. @@ -203,15 +203,16 @@ - <systemitem>--enable-debug</systemitem> + <option>--enable-debug</option> Turns on various amounts of debugging support. Setting this to 'no' - disables g_assert(), g_return_if_fail(), g_return_val_if_fail() and - all cast checks between different object types. Setting it to 'minimum' disables only cast checks. Setting it to 'yes' enables - runtime debugging. - The default is 'minimum'. - Note that 'no' is fast, but dangerous as it tends to destabilize + disables g_assert(), g_return_if_fail(), + g_return_val_if_fail() and all cast checks + between different object types. Setting it to 'minimum' disables + only cast checks. Setting it to 'yes' enables runtime debugging. + The default is 'minimum' for stable releases, and 'yes' for development + snapshots. Note that 'no' is fast, but dangerous as it tends to destabilize even mostly bug-free software by changing the effect of many bugs from simple warnings into fatal crashes. Thus should not @@ -220,26 +221,26 @@ - <systemitem>--disable-gc-friendly</systemitem> and - <systemitem>--enable-gc-friendly</systemitem> + <option>--disable-gc-friendly</option> and + <option>--enable-gc-friendly</option> - By default, and with --disable-gc-friendly - as well, Glib does not clear the memory for certain objects before - they are freed. For example, Glib may decide to recycle GList nodes + By default, and with + as well, GLib does not clear the memory for certain objects before + they are freed. For example, GLib may decide to recycle GList nodes by putting them in a free list. However, memory profiling and debugging tools like Valgrind work better if an application does not keep dangling pointers to freed memory (even though these pointers are no longer dereferenced), or invalid pointers inside uninitialized memory. - The --enable-gc-friendly option makes Glib + The option makes GLib clear memory in these situations: - When shrinking a GArray, Glib will clear the memory no longer + When shrinking a GArray, GLib will clear the memory no longer available in the array: shrink an array from 10 bytes to 7, and the last 3 bytes will be cleared. This includes removals of single and multiple elements. @@ -247,7 +248,7 @@ - When growing a GArray, Glib will clear the new chunk of memory. + When growing a GArray, GLib will clear the new chunk of memory. Grow an array from 7 bytes to 10 bytes, and the last 3 bytes will be cleared. @@ -259,14 +260,14 @@ - When freeing a node from a GHashTable, Glib will first clear + When freeing a node from a GHashTable, GLib will first clear the node, which used to have pointers to the key and the value stored at that node. - When destroying or removing a GTree node, Glib will clear the node, + When destroying or removing a GTree node, GLib will clear the node, which used to have pointers to the node's value, and the left and right subnodes. @@ -275,13 +276,13 @@ Since clearing the memory has a cost, - --disable-gc-friendly is the default. + is the default. - <systemitem>--disable-mem-pools</systemitem> and - <systemitem>--enable-mem-pools</systemitem> + <option>--disable-mem-pools</option> and + <option>--enable-mem-pools</option> Many small chunks of memory are often allocated via collective pools @@ -321,7 +322,7 @@ - <systemitem>--with-threads</systemitem> + <option>--with-threads</option> Specify a thread implementation to use. Available options are @@ -331,7 +332,7 @@ - <systemitem>--with-pcre</systemitem> + <option>--with-pcre</option> Specify whether to use the internal or the system-supplied @@ -346,30 +347,34 @@ 'system' means that GRegex will be compiled to use - the system-supplied PCRE library. + the system-supplied PCRE library; this is the default + setting. - Using the internal PCRE is the preferred solution: + Using the internal PCRE is the preferred solution if: - System-supplied PCRE has a separated copy of the big tables - used for Unicode handling. + your system has strict resource constraints; the system-supplied + PCRE has a separated copy of the tables used for Unicode + handling, whereas the internal copy shares the Unicode tables + used by GLib. - Some systems have PCRE libraries compiled without some needed - features, such as UTF-8 and Unicode support. + your system has PCRE built without some needed features, + such as UTF-8 and Unicode support. - PCRE uses some global variables for memory management and - other features. In the rare case of a program using both - GRegex and PCRE (maybe indirectly through a library), - this variables could lead to problems when they are modified. + you are planning to use both GRegex and PCRE API at the same + time, either directly or indirectly through a dependency; PCRE + uses some global variables for memory management and + other features, and if both GLib and PCRE try to access them + at the same time, this could lead to undefined behavior. @@ -377,31 +382,34 @@ - <systemitem>--disable-included-printf</systemitem> and - <systemitem>--enable-included-printf</systemitem> + <option>--disable-included-printf</option> and + <option>--enable-included-printf</option> By default the configure script will try to auto-detect whether the C library provides a suitable set - of printf() functions. In detail, configure - checks that the semantics of snprintf() are as specified by C99 + of printf() functions. In detail, + configure checks that the semantics of + snprintf() are as specified by C99 and that positional parameters as specified in the Single Unix Specification are supported. If this not the case, GLib will - include an implementation of the printf() family. + include an implementation of the printf() + family. These options can be used to explicitly control whether - an implementation of the printf() family should be included or not. + an implementation of the printf() family + should be included or not. - <systemitem>--disable-Bsymbolic</systemitem> and - <systemitem>--enable-Bsymbolic</systemitem> + <option>--disable-Bsymbolic</option> and + <option>--enable-Bsymbolic</option> - By default, GLib uses the -Bsymbolic-functions linker - flag to avoid intra-library PLT jumps. A side-effect + By default, GLib uses the + linker flag to avoid intra-library PLT jumps. A side-effect of this is that it is no longer possible to override internal uses of GLib functions with LD_PRELOAD. Therefore, it may make @@ -412,8 +420,8 @@ - <systemitem>--disable-gtk-doc</systemitem> and - <systemitem>--enable-gtk-doc</systemitem> + <option>--disable-gtk-doc</option> and + <option>--enable-gtk-doc</option> By default the configure script will try @@ -430,8 +438,8 @@ - <systemitem>--disable-man</systemitem> and - <systemitem>--enable-man</systemitem> + <option>--disable-man</option> and + <option>--enable-man</option> By default the configure script will try @@ -446,23 +454,24 @@ - <systemitem>--disable-xattr</systemitem> and - <systemitem>--enable-xattr</systemitem> + <option>--disable-xattr</option> and + <option>--enable-xattr</option> By default the configure script will try - to auto-detect whether the getxattr() family of functions - is available. If it is, then extended attribute support - will be included in GIO. These options can be used to - explicitly control whether extended attribute support - should be included or not. getxattr() and friends can - be provided by glibc or by the standalone libattr library. + to auto-detect whether the getxattr() + family of functions is available. If it is, then extended + attribute support will be included in GIO. These options can + be used to explicitly control whether extended attribute + support should be included or not. getxattr() + and friends can be provided by glibc or by the standalone + libattr library. - <systemitem>--disable-selinux</systemitem> and - <systemitem>--enable-selinux</systemitem> + <option>--disable-selinux</option> and + <option>--enable-selinux</option> By default the configure script will @@ -474,8 +483,8 @@ - <systemitem>--disable-dtrace</systemitem> and - <systemitem>--enable-dtrace</systemitem> + <option>--disable-dtrace</option> and + <option>--enable-dtrace</option> By default the configure script will @@ -484,8 +493,8 @@ - <systemitem>--disable-systemtap</systemitem> and - <systemitem>--enable-systemtap</systemitem> + <option>--disable-systemtap</option> and + <option>--enable-systemtap</option> This option requires DTrace support. If it is available, then @@ -495,8 +504,8 @@ - <systemitem>--enable-coverage</systemitem> and - <systemitem>--disable-coverage</systemitem> + <option>--enable-coverage</option> and + <option>--disable-coverage</option> Enable the generation of coverage reports for the GLib tests. @@ -508,7 +517,7 @@ - <systemitem>--with-runtime-libdir=RELPATH</systemitem> + <option>--with-runtime-libdir=RELPATH</option> Allows specifying a relative path to where to install the runtime @@ -516,21 +525,21 @@ GLib applications). This can be used in operating system setups where programs using GLib needs to run before e.g. /usr is mounted. - For example, if LIBDIR is /usr/lib and + For example, if LIBDIR is /usr/lib and ../../lib is passed to - --with-runtime-libdir then the + then the runtime libraries are installed into /lib rather than /usr/lib. - <systemitem>--with-python</systemitem> + <option>--with-python=PATH</option> Allows specifying the Python interpreter to use, either as an absolute path, - or as a program name. GLib can be built with Python 2 (at least version 2.5) - or Python 3. + or as a program name. GLib can be built with Python 2 (at least version 2.7) + or, preferably, with Python 3.