mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
build: Drop the internal_pcre option in favour of the subproject
This should maintain equivalent functionality, apart from that now you have to pass `--force-fallback-for libpcre` to `meson configure` in order to use the subproject; rather than specifying `-Dinternal_pcre=true` to use the internal copy. This also fixes #642, as the wrapdb copy of libpcre is version 8.37. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Helps: #962 Fixes: #642
This commit is contained in:
parent
1d952150e6
commit
9fbd7f3dc1
@ -270,7 +270,7 @@ cross-android_api21_arm64:
|
||||
# FIXME: add --werror
|
||||
# We use -Diconv=auto to test that we successfully detect that iconv is not
|
||||
# provided by android api 21, and detect the external iconv instead.
|
||||
- meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_android_arm64_21.txt -Diconv=auto -Dinternal_pcre=true _build
|
||||
- meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_android_arm64_21.txt -Diconv=auto _build
|
||||
- ninja -C _build
|
||||
|
||||
cross-android_api28_arm64:
|
||||
@ -278,7 +278,7 @@ cross-android_api28_arm64:
|
||||
image: $ANDROID_IMAGE
|
||||
script:
|
||||
# FIXME: add --werror
|
||||
- meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_android_arm64_28.txt -Dinternal_pcre=true _build
|
||||
- meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_android_arm64_28.txt _build
|
||||
- ninja -C _build
|
||||
|
||||
cross-mingw64:
|
||||
|
@ -153,12 +153,9 @@
|
||||
<listitem>
|
||||
<para>
|
||||
GRegex uses the <ulink url="http://www.pcre.org/">PCRE library</ulink>
|
||||
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.
|
||||
for regular expression matching. The system version of PCRE is used,
|
||||
unless not available (which is the case on Android), in which case a
|
||||
fallback subproject is used.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
@ -235,45 +232,6 @@
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
<formalpara>
|
||||
<title><option>-Dinternal_pcre=true</option></title>
|
||||
|
||||
<para>
|
||||
Normally, GLib will be configured to use the system-supplied PCRE
|
||||
library if it is suitable, falling back to an internal version
|
||||
otherwise. If this option is specified, the internal version will always
|
||||
be used.
|
||||
</para>
|
||||
<para>
|
||||
Using the internal PCRE is the preferred solution if:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
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.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
your system has PCRE built without some needed features,
|
||||
such as UTF-8 and Unicode support.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
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.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
<formalpara>
|
||||
<title><option>-Dbsymbolic_functions=false</option> and
|
||||
<option>-Dbsymbolic_functions=true</option></title>
|
||||
|
@ -22,11 +22,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef USE_SYSTEM_PCRE
|
||||
#include <pcre.h>
|
||||
#else
|
||||
#include "pcre/pcre.h"
|
||||
#endif
|
||||
|
||||
#include "gtypes.h"
|
||||
#include "gregex.h"
|
||||
|
@ -357,13 +357,8 @@ if use_pcre_static_flag
|
||||
pcre_static_args = ['-DPCRE_STATIC']
|
||||
endif
|
||||
|
||||
if use_system_pcre
|
||||
pcre_deps = [pcre]
|
||||
pcre_objects = []
|
||||
else
|
||||
pcre_deps = []
|
||||
pcre_objects = [libpcre.extract_all_objects()]
|
||||
endif
|
||||
pcre_deps = [pcre]
|
||||
pcre_objects = []
|
||||
|
||||
glib_c_args = ['-DG_LOG_DOMAIN="GLib"', '-DGLIB_COMPILATION'] + pcre_static_args + glib_hidden_visibility_args
|
||||
libglib = library('glib-2.0',
|
||||
|
@ -25,11 +25,7 @@
|
||||
#include <locale.h>
|
||||
#include "glib.h"
|
||||
|
||||
#ifdef USE_SYSTEM_PCRE
|
||||
#include <pcre.h>
|
||||
#else
|
||||
#include "glib/pcre/pcre.h"
|
||||
#endif
|
||||
|
||||
/* U+20AC EURO SIGN (symbol, currency) */
|
||||
#define EURO "\xe2\x82\xac"
|
||||
|
63
meson.build
63
meson.build
@ -1979,46 +1979,37 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
if get_option('internal_pcre')
|
||||
pcre = []
|
||||
use_system_pcre = false
|
||||
else
|
||||
pcre = dependency('libpcre', version: '>= 8.31', required : false) # Should check for Unicode support, too. FIXME
|
||||
if not pcre.found()
|
||||
if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl'
|
||||
# MSVC: Search for the PCRE library by the configuration, which corresponds
|
||||
# to the output of CMake builds of PCRE. Note that debugoptimized
|
||||
# is really a Release build with .PDB files.
|
||||
if vs_crt == 'debug'
|
||||
pcre = cc.find_library('pcred', required : false)
|
||||
else
|
||||
pcre = cc.find_library('pcre', required : false)
|
||||
endif
|
||||
pcre = dependency('libpcre', version: '>= 8.31', required : false) # Should check for Unicode support, too. FIXME
|
||||
if not pcre.found()
|
||||
if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl'
|
||||
# MSVC: Search for the PCRE library by the configuration, which corresponds
|
||||
# to the output of CMake builds of PCRE. Note that debugoptimized
|
||||
# is really a Release build with .PDB files.
|
||||
if vs_crt == 'debug'
|
||||
pcre = cc.find_library('pcred', required : false)
|
||||
else
|
||||
pcre = cc.find_library('pcre', required : false)
|
||||
endif
|
||||
endif
|
||||
use_system_pcre = pcre.found()
|
||||
endif
|
||||
glib_conf.set('USE_SYSTEM_PCRE', use_system_pcre)
|
||||
|
||||
use_pcre_static_flag = false
|
||||
|
||||
if host_system == 'windows'
|
||||
if not use_system_pcre
|
||||
use_pcre_static_flag = true
|
||||
else
|
||||
pcre_static = cc.links('''#define PCRE_STATIC
|
||||
#include <pcre.h>
|
||||
int main() {
|
||||
void *p = NULL;
|
||||
pcre_free(p);
|
||||
return 0;
|
||||
}''',
|
||||
dependencies: pcre,
|
||||
name : 'Windows system PCRE is a static build')
|
||||
if pcre_static
|
||||
use_pcre_static_flag = true
|
||||
endif
|
||||
endif
|
||||
# Try again with the fallback
|
||||
if not pcre.found()
|
||||
pcre = dependency('libpcre', required : true, fallback : ['libpcre', 'pcre_dep'])
|
||||
use_pcre_static_flag = true
|
||||
elif host_system == 'windows'
|
||||
pcre_static = cc.links('''#define PCRE_STATIC
|
||||
#include <pcre.h>
|
||||
int main() {
|
||||
void *p = NULL;
|
||||
pcre_free(p);
|
||||
return 0;
|
||||
}''',
|
||||
dependencies: pcre,
|
||||
name : 'Windows system PCRE is a static build')
|
||||
use_pcre_static_flag = pcre_static
|
||||
else
|
||||
use_pcre_static_flag = false
|
||||
endif
|
||||
|
||||
libm = cc.find_library('m', required : false)
|
||||
|
@ -34,11 +34,6 @@ option('libmount',
|
||||
value : 'auto',
|
||||
description : 'build with libmount support')
|
||||
|
||||
option('internal_pcre',
|
||||
type : 'boolean',
|
||||
value : false,
|
||||
description : 'whether to use internal PCRE')
|
||||
|
||||
option('man',
|
||||
type : 'boolean',
|
||||
value : false,
|
||||
|
Loading…
Reference in New Issue
Block a user