1+ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+ From: Kleis Auke Wolthuizen <github@kleisauke.nl>
3+ Date: Wed, 13 Jul 2022 09:44:36 +0200
4+ Subject: [PATCH 1/1] Remove GRegex pre-emptively
5+
6+ Unused by libvips or any of the libraries it relies on.
7+
8+ Upstream-Status: Inappropriate [disable feature]
9+ Upstream may still depend on GRegex.
10+
111diff --git a/gio/gsettingsschema.c b/gio/gsettingsschema.c
212index 1111111..2222222 100644
313--- a/gio/gsettingsschema.c
414+++ b/gio/gsettingsschema.c
5- @@ -553,58 +553,7 @@ start_element (GMarkupParseContext *context,
15+ @@ -553,62 +553,7 @@ start_element (GMarkupParseContext *context,
616 static gchar *
717 normalise_whitespace (const gchar *orig)
818 {
@@ -32,10 +42,14 @@ index 1111111..2222222 100644
3242- {
3343- GRegex *s;
3444-
35- - cleanup[0] = g_regex_new ("^\\s+", 0, 0, 0);
36- - cleanup[1] = g_regex_new ("\\s+$", 0, 0, 0);
37- - cleanup[2] = g_regex_new ("\\s+", 0, 0, 0);
38- - s = g_regex_new ("\\n\\s*\\n+", 0, 0, 0);
45+ - cleanup[0] = g_regex_new ("^\\s+", G_REGEX_DEFAULT,
46+ - G_REGEX_MATCH_DEFAULT, NULL);
47+ - cleanup[1] = g_regex_new ("\\s+$", G_REGEX_DEFAULT,
48+ - G_REGEX_MATCH_DEFAULT, NULL);
49+ - cleanup[2] = g_regex_new ("\\s+", G_REGEX_DEFAULT,
50+ - G_REGEX_MATCH_DEFAULT, NULL);
51+ - s = g_regex_new ("\\n\\s*\\n+", G_REGEX_DEFAULT,
52+ - G_REGEX_MATCH_DEFAULT, NULL);
3953-
4054- g_once_init_leave (&splitter, s);
4155- }
@@ -76,7 +90,7 @@ index 1111111..2222222 100644
7690 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSequence, g_sequence_free)
7791 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSList, g_slist_free)
7892diff --git a/glib/glib.h b/glib/glib.h
79- index e72c09da5..d639e645e 100644
93+ index 1111111..2222222 100644
8094--- a/glib/glib.h
8195+++ b/glib/glib.h
8296@@ -74,7 +74,6 @@
@@ -99,11 +113,43 @@ index 1111111..2222222 100644
99113 'gscanner.h',
100114 'gsequence.h',
101115 'gshell.h',
116+ @@ -272,7 +271,6 @@ glib_sources = files(
117+ 'grcbox.c',
118+ 'grefcount.c',
119+ 'grefstring.c',
120+ - 'gregex.c',
121+ 'gscanner.c',
122+ 'gsequence.c',
123+ 'gshell.c',
124+ @@ -357,13 +355,7 @@ else
125+ glib_dtrace_hdr = []
126+ endif
127+
128+ - pcre2_static_args = []
129+ -
130+ - if use_pcre2_static_flag
131+ - pcre2_static_args = ['-DPCRE2_STATIC']
132+ - endif
133+ -
134+ - glib_c_args = ['-DG_LOG_DOMAIN="GLib"', '-DGLIB_COMPILATION'] + pcre2_static_args + glib_hidden_visibility_args
135+ + glib_c_args = ['-DG_LOG_DOMAIN="GLib"', '-DGLIB_COMPILATION'] + glib_hidden_visibility_args
136+ libglib = library('glib-2.0',
137+ glib_dtrace_obj, glib_dtrace_hdr,
138+ sources : [deprecated_sources, glib_sources],
139+ @@ -375,7 +367,7 @@ libglib = library('glib-2.0',
140+ link_args : [noseh_link_args, glib_link_flags, win32_ldflags],
141+ include_directories : configinc,
142+ link_with: [charset_lib, gnulib_lib],
143+ - dependencies : [pcre2, thread_dep, librt] + libintl_deps + libiconv + platform_deps + [gnulib_libm_dependency, libm] + [libsysprof_capture_dep],
144+ + dependencies : [thread_dep, librt] + libintl_deps + libiconv + platform_deps + [gnulib_libm_dependency, libm] + [libsysprof_capture_dep],
145+ c_args : glib_c_args,
146+ objc_args : glib_c_args,
147+ )
102148diff --git a/gobject/gboxed.c b/gobject/gboxed.c
103149index 1111111..2222222 100644
104150--- a/gobject/gboxed.c
105151+++ b/gobject/gboxed.c
106- @@ -148 ,9 +148 ,6 @@ G_DEFINE_BOXED_TYPE (GByteArray, g_byte_array, g_byte_array_ref, g_byte_array_un
152+ @@ -150 ,9 +150 ,6 @@ G_DEFINE_BOXED_TYPE (GByteArray, g_byte_array, g_byte_array_ref, g_byte_array_un
107153 G_DEFINE_BOXED_TYPE (GBytes, g_bytes, g_bytes_ref, g_bytes_unref)
108154 G_DEFINE_BOXED_TYPE (GTree, g_tree, g_tree_ref, g_tree_unref)
109155
@@ -113,3 +159,68 @@ index 1111111..2222222 100644
113159 #define g_variant_type_get_type g_variant_type_get_gtype
114160 G_DEFINE_BOXED_TYPE (GVariantType, g_variant_type, g_variant_type_copy, g_variant_type_free)
115161 #undef g_variant_type_get_type
162+ diff --git a/gobject/glib-types.h b/gobject/glib-types.h
163+ index 1111111..2222222 100644
164+ --- a/gobject/glib-types.h
165+ +++ b/gobject/glib-types.h
166+ @@ -87,15 +87,6 @@ typedef gsize GType;
167+ */
168+ #define G_TYPE_HASH_TABLE (g_hash_table_get_type ())
169+
170+ - /**
171+ - * G_TYPE_REGEX:
172+ - *
173+ - * The #GType for a boxed type holding a #GRegex reference.
174+ - *
175+ - * Since: 2.14
176+ - */
177+ - #define G_TYPE_REGEX (g_regex_get_type ())
178+ -
179+ /**
180+ * G_TYPE_MATCH_INFO:
181+ *
182+ diff --git a/meson.build b/meson.build
183+ index 1111111..2222222 100644
184+ --- a/meson.build
185+ +++ b/meson.build
186+ @@ -2018,40 +2018,6 @@ else
187+ libiconv = dependency('iconv')
188+ endif
189+
190+ - pcre2 = dependency('libpcre2-8', version: '>= 10.32', required : false)
191+ - if not pcre2.found()
192+ - if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl'
193+ - # MSVC: Search for the PCRE2 library by the configuration, which corresponds
194+ - # to the output of CMake builds of PCRE2. Note that debugoptimized
195+ - # is really a Release build with .PDB files.
196+ - if vs_crt == 'debug'
197+ - pcre2 = cc.find_library('pcre2d-8', required : false)
198+ - else
199+ - pcre2 = cc.find_library('pcre2-8', required : false)
200+ - endif
201+ - endif
202+ - endif
203+ -
204+ - # Try again with the fallback
205+ - if not pcre2.found()
206+ - pcre2 = dependency('libpcre2-8', required : true, fallback : ['pcre2', 'libpcre2_8'])
207+ - use_pcre2_static_flag = true
208+ - elif host_system == 'windows'
209+ - pcre2_static = cc.links('''#define PCRE2_STATIC
210+ - #define PCRE2_CODE_UNIT_WIDTH 8
211+ - #include <pcre2.h>
212+ - int main() {
213+ - void *p = NULL;
214+ - pcre2_code_free(p);
215+ - return 0;
216+ - }''',
217+ - dependencies: pcre2,
218+ - name : 'Windows system PCRE2 is a static build')
219+ - use_pcre2_static_flag = pcre2_static
220+ - else
221+ - use_pcre2_static_flag = false
222+ - endif
223+ -
224+ # Import the gvdb sources as a subproject to avoid having the copylib in-tree
225+ subproject('gvdb')
226+ gvdb_dep = dependency('gvdb')
0 commit comments