glib2:rebuild
This commit is contained in:
+87
@@ -0,0 +1,87 @@
|
||||
From f67ff1f40f7b888b222c0cff12baa1034ffef49f Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Griffis <tingping@tingping.se>
|
||||
Date: Tue, 15 Nov 2016 08:34:31 -0500
|
||||
Subject: [PATCH] glib-compile-resources: Add --generate-phony-targets flag
|
||||
|
||||
This includes phony targets for each dependency in the the generated
|
||||
dependency file which allows building with `ninja` which doesn't like
|
||||
the phony targets[1] but also allows silencing `make` errors similar to
|
||||
gcc's -MP option.
|
||||
|
||||
[1] - https://github.com/ninja-build/ninja/issues/1184
|
||||
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=774368
|
||||
---
|
||||
docs/reference/gio/glib-compile-resources.xml | 9 +++++++++
|
||||
gio/glib-compile-resources.c | 20 ++++++++++++++------
|
||||
2 files changed, 23 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/docs/reference/gio/glib-compile-resources.xml b/docs/reference/gio/glib-compile-resources.xml
|
||||
index f5a1e62..1ab0a44 100644
|
||||
--- a/docs/reference/gio/glib-compile-resources.xml
|
||||
+++ b/docs/reference/gio/glib-compile-resources.xml
|
||||
@@ -181,6 +181,15 @@ as a side-effect of generating sources.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
+<varlistentry>
|
||||
+<term><option>--generate-phony-targets</option></term>
|
||||
+<listitem><para>
|
||||
+When creating a dependency file with <option>--dependency-file</option>
|
||||
+include phony targets in the same style as gcc -MP. This would typically
|
||||
+be used with <literal>make</literal>.
|
||||
+</para></listitem>
|
||||
+</varlistentry>
|
||||
+
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
diff --git a/gio/glib-compile-resources.c b/gio/glib-compile-resources.c
|
||||
index 3d13b12..de95a33 100644
|
||||
--- a/gio/glib-compile-resources.c
|
||||
+++ b/gio/glib-compile-resources.c
|
||||
@@ -612,6 +612,7 @@ main (int argc, char **argv)
|
||||
gboolean manual_register = FALSE;
|
||||
gboolean internal = FALSE;
|
||||
gboolean generate_dependencies = FALSE;
|
||||
+ gboolean generate_phony_targets = FALSE;
|
||||
char *dependency_file = NULL;
|
||||
char *c_name = NULL;
|
||||
char *c_name_no_underscores;
|
||||
@@ -626,6 +627,7 @@ main (int argc, char **argv)
|
||||
{ "generate-source", 0, 0, G_OPTION_ARG_NONE, &generate_source, N_("Generate sourcecode used to link in the resource file into your code"), NULL },
|
||||
{ "generate-dependencies", 0, 0, G_OPTION_ARG_NONE, &generate_dependencies, N_("Generate dependency list"), NULL },
|
||||
{ "dependency-file", 0, 0, G_OPTION_ARG_FILENAME, &dependency_file, N_("name of the dependency file to generate"), N_("FILE") },
|
||||
+ { "generate-phony-targets", 0, 0, G_OPTION_ARG_NONE, &generate_phony_targets, N_("Include phony targets in the generated dependency file"), NULL },
|
||||
{ "manual-register", 0, 0, G_OPTION_ARG_NONE, &manual_register, N_("Don't automatically create and register resource"), NULL },
|
||||
{ "internal", 0, 0, G_OPTION_ARG_NONE, &internal, N_("Don’t export functions; declare them G_GNUC_INTERNAL"), NULL },
|
||||
{ "c-name", 0, 0, G_OPTION_ARG_STRING, &c_name, N_("C identifier name used for the generated source code"), NULL },
|
||||
@@ -774,13 +776,19 @@ main (int argc, char **argv)
|
||||
|
||||
g_string_append (dep_string, "\n\n");
|
||||
|
||||
- /* One rule for every resource: resourceN: */
|
||||
- g_hash_table_iter_init (&iter, files);
|
||||
- while (g_hash_table_iter_next (&iter, &key, &data))
|
||||
+ /* Optionally include phony targets as it silences `make` but
|
||||
+ * isn't supported on `ninja` at the moment. See also: `gcc -MP`
|
||||
+ */
|
||||
+ if (generate_phony_targets)
|
||||
{
|
||||
- file_data = data;
|
||||
- if (!g_str_equal (file_data->filename, srcfile))
|
||||
- g_string_append_printf (dep_string, "%s:\n\n", file_data->filename);
|
||||
+ /* One rule for every resource: resourceN: */
|
||||
+ g_hash_table_iter_init (&iter, files);
|
||||
+ while (g_hash_table_iter_next (&iter, &key, &data))
|
||||
+ {
|
||||
+ file_data = data;
|
||||
+ if (!g_str_equal (file_data->filename, srcfile))
|
||||
+ g_string_append_printf (dep_string, "%s:\n\n", file_data->filename);
|
||||
+ }
|
||||
}
|
||||
|
||||
if (g_str_equal (dependency_file, "-"))
|
||||
--
|
||||
2.10.2
|
||||
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
From fb7b792bfa224d6699492a6e33f4be9123a6c690 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Griffis <tingping@tingping.se>
|
||||
Date: Tue, 15 Nov 2016 12:21:46 -0500
|
||||
Subject: [PATCH] glib-compile-resources: Escape file names in dependency file
|
||||
|
||||
---
|
||||
gio/glib-compile-resources.c | 62 +++++++++++++++++++++++++++++++++++++++++---
|
||||
1 file changed, 59 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/gio/glib-compile-resources.c b/gio/glib-compile-resources.c
|
||||
index ee73b88..7ecb34e 100644
|
||||
--- a/gio/glib-compile-resources.c
|
||||
+++ b/gio/glib-compile-resources.c
|
||||
@@ -596,6 +596,51 @@ extension_in_set (const char *str,
|
||||
return rv;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * We must escape any characters that `make` finds significant.
|
||||
+ * This is largely a duplicate of the logic in gcc's `mkdeps.c:munge()`.
|
||||
+ */
|
||||
+static char *
|
||||
+escape_makefile_string (const char *string)
|
||||
+{
|
||||
+ GString *str;
|
||||
+ const char *p, *q;
|
||||
+
|
||||
+ str = g_string_sized_new (strlen (string));
|
||||
+ for (p = string; *p != '\0'; ++p)
|
||||
+ {
|
||||
+ switch (*p)
|
||||
+ {
|
||||
+ case ' ':
|
||||
+ case '\t':
|
||||
+ /* GNU make uses a weird quoting scheme for white space.
|
||||
+ A space or tab preceded by 2N+1 backslashes represents
|
||||
+ N backslashes followed by space; a space or tab
|
||||
+ preceded by 2N backslashes represents N backslashes at
|
||||
+ the end of a file name; and backslashes in other
|
||||
+ contexts should not be doubled. */
|
||||
+ for (q = p - 1; string <= q && *q == '\\'; q--)
|
||||
+ g_string_append_c (str, '\\');
|
||||
+ g_string_append_c (str, '\\');
|
||||
+ break;
|
||||
+
|
||||
+ case '$':
|
||||
+ g_string_append_c (str, '$');
|
||||
+ break;
|
||||
+
|
||||
+ case '#':
|
||||
+ g_string_append_c (str, '\\');
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ g_string_append_c (str, *p);
|
||||
+ }
|
||||
+
|
||||
+ return g_string_free (str, FALSE);
|
||||
+}
|
||||
+
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
@@ -760,18 +805,25 @@ main (int argc, char **argv)
|
||||
GHashTableIter iter;
|
||||
gpointer key, data;
|
||||
FileData *file_data;
|
||||
+ char *escaped;
|
||||
|
||||
g_hash_table_iter_init (&iter, files);
|
||||
|
||||
dep_string = g_string_new (NULL);
|
||||
- g_string_printf (dep_string, "%s:", srcfile);
|
||||
+ escaped = escape_makefile_string (srcfile);
|
||||
+ g_string_printf (dep_string, "%s:", escaped);
|
||||
+ g_free (escaped);
|
||||
|
||||
/* First rule: foo.xml: resource1 resource2.. */
|
||||
while (g_hash_table_iter_next (&iter, &key, &data))
|
||||
{
|
||||
file_data = data;
|
||||
if (!g_str_equal (file_data->filename, srcfile))
|
||||
- g_string_append_printf (dep_string, " %s", file_data->filename);
|
||||
+ {
|
||||
+ escaped = escape_makefile_string (file_data->filename);
|
||||
+ g_string_append_printf (dep_string, " %s", escaped);
|
||||
+ g_free (escaped);
|
||||
+ }
|
||||
}
|
||||
|
||||
g_string_append (dep_string, "\n");
|
||||
@@ -789,7 +841,11 @@ main (int argc, char **argv)
|
||||
{
|
||||
file_data = data;
|
||||
if (!g_str_equal (file_data->filename, srcfile))
|
||||
- g_string_append_printf (dep_string, "%s:\n\n", file_data->filename);
|
||||
+ {
|
||||
+ escaped = escape_makefile_string (file_data->filename);
|
||||
+ g_string_append_printf (dep_string, "%s:\n\n", escaped);
|
||||
+ g_free (escaped);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.10.2
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
</BuildDependencies>
|
||||
<Patches>
|
||||
<Patch level="1">revert-warn-glib-compile-schemas.patch</Patch>
|
||||
<Patch level="1">0001-glib-compile-resources-Add-generate-phony-targets-fl.patch</Patch>
|
||||
<Patch>0001-glib-compile-resources-Escape-file-names-in-dependen.patch</Patch>
|
||||
</Patches>
|
||||
</Source>
|
||||
|
||||
@@ -130,6 +132,13 @@
|
||||
</Package>
|
||||
|
||||
<History>
|
||||
<Update release="4">
|
||||
<Date>2018-02-25</Date>
|
||||
<Version>2.50.2</Version>
|
||||
<Comment>Rebuild.</Comment>
|
||||
<Name>Mustafa Cinasal</Name>
|
||||
<Email>muscnsl@gmail.com</Email>
|
||||
</Update>
|
||||
<Update release="3">
|
||||
<Date>2017-01-08</Date>
|
||||
<Version>2.50.2</Version>
|
||||
|
||||
Reference in New Issue
Block a user