mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-27 14:36:16 +01:00
Avoid non-portable <glob.h> API
And thus we can build gschema-compile on all platforms, and run it in tests.
This commit is contained in:
parent
c279b5b999
commit
a96360ad68
@ -495,11 +495,7 @@ gioenumtypes.c: $(gio_headers) gioenumtypes.c.template
|
|||||||
gio-2.0.lib: libgio-2.0.la gio.def
|
gio-2.0.lib: libgio-2.0.la gio.def
|
||||||
lib -machine:@LIB_EXE_MACHINE_FLAG@ -name:libgio-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:gio.def -out:$@
|
lib -machine:@LIB_EXE_MACHINE_FLAG@ -name:libgio-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:gio.def -out:$@
|
||||||
|
|
||||||
bin_PROGRAMS = gio-querymodules
|
bin_PROGRAMS = gio-querymodules gschema-compile
|
||||||
|
|
||||||
if OS_UNIX
|
|
||||||
bin_PROGRAMS += gschema-compile
|
|
||||||
endif
|
|
||||||
|
|
||||||
gio_querymodules_SOURCES = gio-querymodules.c
|
gio_querymodules_SOURCES = gio-querymodules.c
|
||||||
gio_querymodules_LDADD = \
|
gio_querymodules_LDADD = \
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <glob.h>
|
|
||||||
|
|
||||||
#include "gvdb/gvdb-builder.h"
|
#include "gvdb/gvdb-builder.h"
|
||||||
|
|
||||||
@ -471,8 +470,9 @@ main (int argc, char **argv)
|
|||||||
gboolean byteswap = G_BYTE_ORDER != G_LITTLE_ENDIAN;
|
gboolean byteswap = G_BYTE_ORDER != G_LITTLE_ENDIAN;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GHashTable *table;
|
GHashTable *table;
|
||||||
glob_t matched;
|
GDir *dir;
|
||||||
gint status;
|
const gchar *file;
|
||||||
|
GPtrArray *files;
|
||||||
gchar *srcdir;
|
gchar *srcdir;
|
||||||
gchar *targetdir = NULL;
|
gchar *targetdir = NULL;
|
||||||
gchar *target;
|
gchar *target;
|
||||||
@ -509,31 +509,31 @@ main (int argc, char **argv)
|
|||||||
else
|
else
|
||||||
target = "gschemas.compiled";
|
target = "gschemas.compiled";
|
||||||
|
|
||||||
if (chdir (srcdir))
|
dir = g_dir_open (srcdir, 0, &error);
|
||||||
|
if (dir == NULL)
|
||||||
{
|
{
|
||||||
perror ("chdir");
|
fprintf (stderr, "%s\n", error->message);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = glob ("*.gschema.xml", 0, NULL, &matched);
|
files = g_ptr_array_new ();
|
||||||
|
while ((file = g_dir_read_name (dir)) != NULL)
|
||||||
if (status == GLOB_ABORTED)
|
|
||||||
{
|
{
|
||||||
perror ("glob");
|
if (g_str_has_suffix (file, ".gschema.xml"))
|
||||||
return 1;
|
{
|
||||||
|
g_ptr_array_add (files, g_strdup (file));
|
||||||
}
|
}
|
||||||
else if (status == GLOB_NOMATCH)
|
}
|
||||||
|
|
||||||
|
if (files->len == 0)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "no schema files found\n");
|
fprintf (stderr, "no schema files found\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (status != 0)
|
|
||||||
{
|
|
||||||
fprintf (stderr, "unknown glob error\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(table = parse_gschema_files (matched.gl_pathv, byteswap, &error)) ||
|
g_ptr_array_add (files, NULL);
|
||||||
|
|
||||||
|
if (!(table = parse_gschema_files ((gchar **) files->pdata, byteswap, &error)) ||
|
||||||
!gvdb_table_write_contents (table, target, byteswap, &error))
|
!gvdb_table_write_contents (table, target, byteswap, &error))
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s\n", error->message);
|
fprintf (stderr, "%s\n", error->message);
|
||||||
|
@ -148,11 +148,7 @@ gsettings_LDADD = $(progs_ldadd)
|
|||||||
|
|
||||||
EXTRA_DIST += org.gtk.test.gschema org.gtk.test.gschema.xml de.po
|
EXTRA_DIST += org.gtk.test.gschema org.gtk.test.gschema.xml de.po
|
||||||
|
|
||||||
MISC_STUFF = test.mo
|
MISC_STUFF = gschemas.compiled test.mo
|
||||||
|
|
||||||
if OS_UNIX
|
|
||||||
MISC_STUFF += gschemas.compiled
|
|
||||||
endif
|
|
||||||
|
|
||||||
test.mo: de.po
|
test.mo: de.po
|
||||||
$(MSGFMT) -o test.mo $(srcdir)/de.po; \
|
$(MSGFMT) -o test.mo $(srcdir)/de.po; \
|
||||||
|
Loading…
Reference in New Issue
Block a user