Sync from SUSE:SLFO:Main glib2 revision 70e7a700275748dc36937490dec781ea

This commit is contained in:
Adrian Schröter 2024-05-03 12:54:01 +02:00
commit e48dba8eb3
17 changed files with 10067 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,19 @@
Quoting the "Vendor overrides" section from [1]:
Default values are defined in the schemas that get installed by an application.
Sometimes, it is necessary for a vendor or distributor to adjust these
defaults. Since patching the XML source for the schema is inconvenient and
error-prone, glib-compile-schemas reads so-called 'vendor override' files.
These are keyfiles in the same directory as the XML schema sources which can
override default values. The schema id serves as the group name in the key
file, and the values are expected in serialized GVariant form, as in the
following example:
[org.gtk.Example]
key1='string'
key2=1.5
glib-compile-schemas expects schema files to have the extension
.gschema.override
[1] http://developer.gnome.org/gio/stable/GSettings.html

3
_multibuild Normal file
View File

@ -0,0 +1,3 @@
<multibuild>
<package>doc</package>
</multibuild>

19
baselibs.conf Normal file
View File

@ -0,0 +1,19 @@
glib2-devel
requires -glib2-<targettype>
requires "glib2-tools-<targettype> = <version>"
requires "libgio-2_0-0-<targettype> = <version>"
requires "libgmodule-2_0-0-<targettype> = <version>"
requires "libgobject-2_0-0-<targettype> = <version>"
requires "libgthread-2_0-0-<targettype> = <version>"
+^/usr/lib.*/glib-2.0/include/glibconfig.h
+^/usr/lib.*/pkgconfig/glib-2.0.pc
glib2-tools
+/usr/bin/gio-querymodules(-64)?
libglib-2_0-0
obsoletes "glib2-<targettype> <= <version>"
provides "glib2-<targettype> = <version>"
libgmodule-2_0-0
libgio-2_0-0
libgthread-2_0-0
libgobject-2_0-0

BIN
glib-2.76.2.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,142 @@
Index: glib-2.75.4/glib/gkeyfile.c
===================================================================
--- glib-2.75.4.orig/glib/gkeyfile.c
+++ glib-2.75.4/glib/gkeyfile.c
@@ -519,6 +519,7 @@ struct _GKeyFile
gboolean checked_locales; /* TRUE if @locales has been initialised */
gchar **locales; /* (nullable) */
+ gchar *gettext_domain;
gint ref_count; /* (atomic) */
};
@@ -645,6 +646,7 @@ g_key_file_init (GKeyFile *key_file)
key_file->parse_buffer = NULL;
key_file->list_separator = ';';
key_file->flags = 0;
+ key_file->gettext_domain = NULL;
}
static void
@@ -665,6 +667,12 @@ g_key_file_clear (GKeyFile *key_file)
key_file->parse_buffer = NULL;
}
+ if (key_file->gettext_domain)
+ {
+ g_free (key_file->gettext_domain);
+ key_file->gettext_domain = NULL;
+ }
+
tmp = key_file->groups;
while (tmp != NULL)
{
@@ -885,6 +893,11 @@ g_key_file_load_from_fd (GKeyFile
return FALSE;
}
+ key_file->gettext_domain = g_key_file_get_string (key_file,
+ G_KEY_FILE_DESKTOP_GROUP,
+ G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN,
+ NULL);
+
return TRUE;
}
@@ -997,6 +1010,11 @@ g_key_file_load_from_data (GKeyFile
return FALSE;
}
+ key_file->gettext_domain = g_key_file_get_string (key_file,
+ G_KEY_FILE_DESKTOP_GROUP,
+ G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN,
+ NULL);
+
return TRUE;
}
@@ -2246,6 +2264,8 @@ g_key_file_get_locale_string (GKeyFile
GError *key_file_error;
gchar **languages;
gboolean free_languages = FALSE;
+ gboolean try_gettext = FALSE;
+ const gchar *msg_locale;
gint i;
g_return_val_if_fail (key_file != NULL, NULL);
@@ -2267,6 +2287,23 @@ g_key_file_get_locale_string (GKeyFile
free_languages = FALSE;
}
+ /* we're only interested in gettext translation if we don't have a
+ * translation in the .desktop file itself and if the key is one of the keys
+ * we know we want to translate: Name, GenericName, Comment. Blindly doing
+ * this for all keys can give strange result for the icons, since the Icon is
+ * a locale string in the spec, eg. We also only get translation in the mo
+ * file if the requested locale is the LC_MESSAGES one. Ideally, we should do
+ * more and change LC_MESSAGES to use the requested locale, but there's no
+ * guarantee it's installed on the system and it might have some
+ * side-effects. Since this is a corner case, let's ignore it. */
+
+ msg_locale = setlocale (LC_MESSAGES, NULL);
+ try_gettext = msg_locale && key_file->gettext_domain &&
+ strcmp (group_name, G_KEY_FILE_DESKTOP_GROUP) == 0 &&
+ (strcmp (key, G_KEY_FILE_DESKTOP_KEY_NAME) == 0 ||
+ strcmp (key, G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME) == 0 ||
+ strcmp (key, G_KEY_FILE_DESKTOP_KEY_COMMENT) == 0);
+
for (i = 0; languages[i]; i++)
{
candidate_key = g_strdup_printf ("%s[%s]", key, languages[i]);
@@ -2280,6 +2317,39 @@ g_key_file_get_locale_string (GKeyFile
break;
}
+ /* Fallback to gettext */
+ if (try_gettext && !translated_value)
+ {
+ gchar *orig_value = g_key_file_get_string (key_file, group_name, key, NULL);
+
+ if (orig_value)
+ {
+ gboolean codeset_set;
+ const gchar *translated;
+ gboolean has_gettext;
+
+ codeset_set = bind_textdomain_codeset (key_file->gettext_domain, "UTF-8") != NULL;
+ translated = NULL;
+
+ translated = g_dgettext (key_file->gettext_domain,
+ orig_value);
+ has_gettext = translated != orig_value;
+
+ g_free (orig_value);
+
+ if (has_gettext)
+ {
+ if (codeset_set)
+ translated_value = g_strdup (translated);
+ else
+ translated_value = g_locale_to_utf8 (translated,
+ -1, NULL, NULL, NULL);
+ }
+ else
+ translated_value = NULL;
+ }
+ }
+
/* Fallback to untranslated key
*/
if (!translated_value)
Index: glib-2.75.4/glib/gkeyfile.h
===================================================================
--- glib-2.75.4.orig/glib/gkeyfile.h
+++ glib-2.75.4/glib/gkeyfile.h
@@ -322,6 +322,7 @@ gboolean g_key_file_remove_group
#define G_KEY_FILE_DESKTOP_KEY_URL "URL"
#define G_KEY_FILE_DESKTOP_KEY_DBUS_ACTIVATABLE "DBusActivatable"
#define G_KEY_FILE_DESKTOP_KEY_ACTIONS "Actions"
+#define G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN "X-GNOME-Gettext-Domain"
#define G_KEY_FILE_DESKTOP_TYPE_APPLICATION "Application"
#define G_KEY_FILE_DESKTOP_TYPE_LINK "Link"

View File

@ -0,0 +1,171 @@
Index: glib-2.75.4/glib/gkeyfile.c
===================================================================
--- glib-2.75.4.orig/glib/gkeyfile.c
+++ glib-2.75.4/glib/gkeyfile.c
@@ -520,6 +520,7 @@ struct _GKeyFile
gboolean checked_locales; /* TRUE if @locales has been initialised */
gchar **locales; /* (nullable) */
gchar *gettext_domain;
+ gchar *file_basename;
gint ref_count; /* (atomic) */
};
@@ -647,6 +648,7 @@ g_key_file_init (GKeyFile *key_file)
key_file->list_separator = ';';
key_file->flags = 0;
key_file->gettext_domain = NULL;
+ key_file->file_basename = NULL;
}
static void
@@ -673,6 +675,12 @@ g_key_file_clear (GKeyFile *key_file)
key_file->gettext_domain = NULL;
}
+ if (key_file->file_basename)
+ {
+ g_free (key_file->file_basename);
+ key_file->file_basename = NULL;
+ }
+
tmp = key_file->groups;
while (tmp != NULL)
{
@@ -817,6 +825,39 @@ find_file_in_data_dirs (const gchar *f
return fd;
}
+static int _g_key_file_default_textdomain_codeset_bound = 0;
+#define _G_KEY_FILE_DEFAULT_DOMAIN "desktop_translations"
+
+static char *
+_g_key_file_get_default_gettext_domain (void)
+{
+ if (!_g_key_file_default_textdomain_codeset_bound)
+ {
+ const char *codeset;
+
+ _g_key_file_default_textdomain_codeset_bound = 1;
+
+ codeset = bind_textdomain_codeset (_G_KEY_FILE_DEFAULT_DOMAIN, "UTF-8");
+
+ if (codeset)
+ _g_key_file_default_textdomain_codeset_bound |= 1 << 1;
+ }
+
+ return g_strdup (_G_KEY_FILE_DEFAULT_DOMAIN);
+}
+
+static inline gboolean
+_g_key_file_is_default_gettext_domain (const char *domain)
+{
+ return (domain && strcmp (domain, _G_KEY_FILE_DEFAULT_DOMAIN) == 0);
+}
+
+static inline gboolean
+_g_key_file_default_gettext_domain_is_bound (void)
+{
+ return _g_key_file_default_textdomain_codeset_bound & (1 << 1);
+}
+
static gboolean
g_key_file_load_from_fd (GKeyFile *key_file,
gint fd,
@@ -898,6 +939,9 @@ g_key_file_load_from_fd (GKeyFile
G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN,
NULL);
+ if (!key_file->gettext_domain)
+ key_file->gettext_domain = _g_key_file_get_default_gettext_domain ();
+
return TRUE;
}
@@ -954,6 +998,8 @@ g_key_file_load_from_file (GKeyFile
return FALSE;
}
+ key_file->file_basename = g_path_get_basename (file);
+
return TRUE;
}
@@ -1015,6 +1061,9 @@ g_key_file_load_from_data (GKeyFile
G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN,
NULL);
+ if (!key_file->gettext_domain)
+ key_file->gettext_domain = _g_key_file_get_default_gettext_domain ();
+
return TRUE;
}
@@ -1119,6 +1168,9 @@ g_key_file_load_from_dirs (GKeyFile
}
}
+ if (found_file)
+ key_file->file_basename = g_path_get_basename (output_path);
+
if (found_file && full_path)
*full_path = output_path;
else
@@ -2326,14 +2378,40 @@ g_key_file_get_locale_string (GKeyFile
{
gboolean codeset_set;
const gchar *translated;
- gboolean has_gettext;
+ gboolean has_gettext = FALSE;
- codeset_set = bind_textdomain_codeset (key_file->gettext_domain, "UTF-8") != NULL;
+ if (_g_key_file_is_default_gettext_domain (key_file->gettext_domain))
+ codeset_set = _g_key_file_default_gettext_domain_is_bound ();
+ else
+ codeset_set = bind_textdomain_codeset (key_file->gettext_domain, "UTF-8") != NULL;
translated = NULL;
- translated = g_dgettext (key_file->gettext_domain,
- orig_value);
- has_gettext = translated != orig_value;
+ /* first try to translate with the context */
+ if (key_file->file_basename)
+ {
+ gchar *context;
+ gchar *context_value;
+
+ context = g_strdup_printf ("%s(%s)", key,
+ key_file->file_basename);
+ context_value = g_strdup_printf ("%s%s%s",
+ context, ": ", orig_value);
+
+ translated = g_dgettext (key_file->gettext_domain,
+ context_value);
+ has_gettext = translated != context_value;
+
+ g_free (context_value);
+ g_free (context);
+ }
+
+ /* no translation with the context: try without context */
+ if (!has_gettext)
+ {
+ translated = g_dgettext (key_file->gettext_domain,
+ orig_value);
+ has_gettext = translated != orig_value;
+ }
g_free (orig_value);
Index: glib-2.75.4/glib/gkeyfile.h
===================================================================
--- glib-2.75.4.orig/glib/gkeyfile.h
+++ glib-2.75.4/glib/gkeyfile.h
@@ -322,7 +322,7 @@ gboolean g_key_file_remove_group
#define G_KEY_FILE_DESKTOP_KEY_URL "URL"
#define G_KEY_FILE_DESKTOP_KEY_DBUS_ACTIVATABLE "DBusActivatable"
#define G_KEY_FILE_DESKTOP_KEY_ACTIONS "Actions"
-#define G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN "X-GNOME-Gettext-Domain"
+#define G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN "X-SUSE-Gettext-Domain"
#define G_KEY_FILE_DESKTOP_TYPE_APPLICATION "Application"
#define G_KEY_FILE_DESKTOP_TYPE_LINK "Link"

View File

@ -0,0 +1,44 @@
Index: glib-2.70.0/gio/gdbus-2.0/codegen/codegen.py
===================================================================
--- glib-2.70.0.orig/gio/gdbus-2.0/codegen/codegen.py
+++ glib-2.70.0/gio/gdbus-2.0/codegen/codegen.py
@@ -95,8 +95,7 @@ class HeaderCodeGenerator:
# ----------------------------------------------------------------------------------------------------
def generate_header_preamble(self):
- basenames = ", ".join(self.input_files_basenames)
- self.outfile.write(LICENSE_STR.format(config.VERSION, basenames))
+ self.outfile.write(LICENSE_STR)
self.outfile.write("\n")
if self.use_pragma:
@@ -1040,8 +1039,7 @@ class InterfaceInfoHeaderCodeGenerator:
# ----------------------------------------------------------------------------------------------------
def generate_header_preamble(self):
- basenames = ", ".join(self.input_files_basenames)
- self.outfile.write(LICENSE_STR.format(config.VERSION, basenames))
+ self.outfile.write(LICENSE_STR)
self.outfile.write("\n")
if self.use_pragma:
@@ -1112,8 +1110,7 @@ class InterfaceInfoBodyCodeGenerator:
# ----------------------------------------------------------------------------------------------------
def generate_body_preamble(self):
- basenames = ", ".join(self.input_files_basenames)
- self.outfile.write(LICENSE_STR.format(config.VERSION, basenames))
+ self.outfile.write(LICENSE_STR)
if self.symbol_decoration_define is not None:
self.outfile.write("\n")
@@ -1466,8 +1463,7 @@ class CodeGenerator:
# ----------------------------------------------------------------------------------------------------
def generate_body_preamble(self):
- basenames = ", ".join(self.input_files_basenames)
- self.outfile.write(LICENSE_STR.format(config.VERSION, basenames))
+ self.outfile.write(LICENSE_STR)
if self.symbol_decoration_define is not None:
self.outfile.write("\n")
self.outfile.write("#define %s\n" % self.symbol_decoration_define)

17
glib2-rpmlintrc Normal file
View File

@ -0,0 +1,17 @@
# Adding gio-branding for the following filter
addFilter(".*shlib-fixed-dependency.*[glib2|gio\-branding].*")
# Filter for non-conffile-in-etc warning for the following files
# under /etc/profile.d/ and /etc/rpm/ directories, respectively:
# zzz-glib2.csh and zzz-glib2.sh, and macros.glib2
addFilter("glib2.*non-conffile-in-etc.*[zzz\-glib2.*|macros\.glib2]")
# Filter for env-script-intepreter for the following files under
# /usr/bin directory: gdbus-codegen, glib-genmarshal and glib-mkenums
addFilter(".*env-script-interpreter.*/usr/bin/[gdbus\-codegen|glib\-.*].*")
# allow empty files and certificates in tests
#addFilter(".*: W: zero-length /usr/libexec/installed-tests/glib/.*")
#addFilter(".*: W: pem-certificate /usr/libexec/installed-tests/.*")
# disable bogus warnings, as instructed by upstream
#addFilter(".*: W: shared-lib-without-dependency-information .*")
# the maintainers prefer to keep the following internal SUSE naming conflicts
#addFilter(".*: W: no-dependency-on glib2.*")
#addFilter(".*: W: suse-branding-.*")

View File

@ -0,0 +1,20 @@
Index: glib-2.75.3/gio/glib-compile-schemas.c
===================================================================
--- glib-2.75.3.orig/gio/glib-compile-schemas.c
+++ glib-2.75.3/gio/glib-compile-schemas.c
@@ -1231,6 +1231,7 @@ parse_state_start_schema (ParseState *s
return;
}
+/*
if (path && (g_str_has_prefix (path, "/apps/") ||
g_str_has_prefix (path, "/desktop/") ||
g_str_has_prefix (path, "/system/")))
@@ -1243,6 +1244,7 @@ parse_state_start_schema (ParseState *s
g_printerr ("%s\n", message);
g_free (message);
}
+*/
state->schema_state = schema_state_new (path, gettext_domain,
extends, extends_name, list_of);

View File

@ -0,0 +1,46 @@
# GNOME Default Applications Source
# /etc/gnome-defaults.conf
#
# WARNING: This is a dumb file, which provides only upstream GNOME
# packages as preferred defaults. You most probably don't want this
# package!
# You probably want to install distribution glib2-branding and prefer
# distribution wise GNOME defaults.
#
# After any change of this file run
# suse-update-mime-defaults
#
# This list is a source for defaults.list.
#
# If application in this list is installed, it is used as default in GNOME.
# It works in following way:
# 1. Read this file.
# 2. Collect all available desktop files.
# 3. Go through all declared MIME types and search for default application
# for defaults.list in following order:
# 3.1 Installed application listed here for certain MIME type.
# 3.2 Installed application listed here as preferred default.
# 3.3 Installed application listed here as default.
# 3.4 Installed application with GNOME in Categories.
# 3.5 Installed application with GTK in Categories.
# 3.6 Installed application.
# If there are more applications in the same order, it uses pseudo-randomly
# one of them (last in aplhabetical order).
#
# Syntax:
# Use xxx as default for all MIME types it declares (see 3.3):
# xxx.desktop
# Use xxx as preferred default for all MIME types it declares (see 3.2):
# !xxx.desktop
# Use xxx as default for mime/type (see 3.1):
# mime/type=xxx.desktop
# Upstream GNOME default applications
eog.desktop
evince.desktop
gedit.desktop
file-roller.desktop
epiphany.desktop
nautilus.desktop
# evince supports multi-page tiff, but most people will prefer eog:
image/tiff=eog.desktop

7890
glib2.changes Normal file

File diff suppressed because it is too large Load Diff

468
glib2.csh Normal file
View File

@ -0,0 +1,468 @@
# GLib filename encoding guesser.
# Author: Stanislav Brabec <sbrabec@suse.cz>
# Additions are welcome.
# This script must be executed after setting LANG variable.
# Try filenames which are invalid in UTF-8 as locale specific.
# For selected locales, G_FILENAME_ENCODING takes precedence.
setenv G_BROKEN_FILENAMES 1
# In West Europe there was used both ISO-8859-15 and ISO-8859-1.
# There is no chance to recognize it, so we must guess.
#set west_europe_legacy_encoding=ISO-8859-1
set west_europe_legacy_encoding=ISO-8859-15
# In Russia, "official" encoding is ISO-8859-5, but most GNOME users
# preferred KOI8-R. We must guess.
#set russian_legacy_encoding=ISO-8859-5
set russian_legacy_encoding=KOI8-R
# In former Yugoslavia sr_YU have covered two different alphabets -
# one Latin and on Cyrillic. No chance to guess.
set sr_YU_legacy_encoding=ISO-8859-2,CP1250
#set sr_YU_legacy_encoding=ISO-8859-5
# Japanese uses two legacy encodings. Guess sometimes fails, sometimes not.
# Defining preferred encoding increases chance for success.
set japanese_legacy_encoding=EUC-JP
#set japanese_legacy_encoding=SHIFT_JIS
if (! ${?LANG} ) goto skip
switch ( $LANG )
case aa_DJ*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case af_ZA*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case an_ES*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-15,CP1252
breaksw
case ar_AE*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-6
breaksw
case ar_BH*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-6
breaksw
case ar_DZ*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-6
breaksw
case ar_EG*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-6
breaksw
case ar_IQ*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-6
breaksw
case ar_JO*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-6
breaksw
case ar_KW*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-6
breaksw
case ar_LB*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-6
breaksw
case ar_LY*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-6
breaksw
case ar_MA*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-6
breaksw
case ar_OM*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-6
breaksw
case ar_QA*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-6
breaksw
case ar_SA*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-6
breaksw
case ar_SD*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-6
breaksw
case ar_SY*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-6
breaksw
case ar_TN*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-6
breaksw
case ar_YE*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-6
breaksw
case be_BY*:
setenv G_FILENAME_ENCODING @locale,UTF-8,CP1251
breaksw
case bg_BG*:
setenv G_FILENAME_ENCODING @locale,UTF-8,CP1251
breaksw
case br_FR*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case bs_BA*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-2,CP1250
breaksw
case ca_ES*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case cs_CZ*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-2,CP1250
breaksw
case cy_GB*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-14,CP1252
breaksw
case da_DK*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case de_AT*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case de_BE*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case de_DE*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case de_CH*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case de_LU*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case el_GR*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-7
breaksw
case en_AU*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case en_BE*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case en_BW*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case en_CA*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case en_DK*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case en_GB*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case en_HK*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case en_IE*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case en_NZ*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case en_PH*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case en_SG*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case en_US*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case en_ZA*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case en_ZW*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case es_AR*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case es_BO*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case es_CL*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case es_CO*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case es_CR*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case es_DO*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case es_EC*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case es_ES*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case es_GT*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case es_HN*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case es_MX*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case es_NI*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case es_PA*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case es_PE*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case es_PR*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case es_PY*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case es_SV*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case es_US*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case es_UY*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case es_VE*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case et_EE*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case eu_ES*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case fa_IR*:
setenv G_FILENAME_ENCODING @locale,UTF-8,CP1256
breaksw
case fi_FI*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case fo_FO*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case fr_BE*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case fr_CA*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case fr_FR*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case fr_CH*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case fr_LU*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case ga_IE*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case gd_GB*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-15,CP1252
breaksw
case gl_ES*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case gv_GB*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case he_IL*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-8
breaksw
case hr_HR*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-2,CP1250
breaksw
case hu_HU*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-2,CP1250
breaksw
case hy_AM*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ARMSCII-8
breaksw
case id_ID*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case is_IS*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case it_CH*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case it_IT*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case iw_IL*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-8
breaksw
case ja_JP*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$japanese_legacy_encoding,EUC-JP,SHIFT_JIS,ISO-8859-1
breaksw
case ka_GE*:
setenv G_FILENAME_ENCODING @locale,UTF-8,GEORGIAN-PS
breaksw
case kl_GL*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case km_KH*:
setenv G_FILENAME_ENCODING @locale,UTF-8,GB18030
breaksw
case ko_KR*:
setenv G_FILENAME_ENCODING @locale,UTF-8,EUC-KR,ISO-8859-1
breaksw
case kw_GB*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case lg_UG*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-10,CP1252
breaksw
case lt_LT*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-13,CP1252
breaksw
case lv_LV*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-13,CP1252
breaksw
case mi_NZ*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-13,CP1252
breaksw
case mk_MK*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-5,CP1251
breaksw
case ms_MY*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case mt_MT*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-3
breaksw
case nb_NO*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case nl_BE*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case nl_NL*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case nn_NO*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case no_NO*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case oc_FR*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case om_KE*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case pl_PL*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-2,CP1250
breaksw
case pt_BR*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case pt_PT*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case ro_RO*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-2,CP1250
breaksw
case ru_RU*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$russian_legacy_encoding,CP1251
breaksw
case ru_UA*:
setenv G_FILENAME_ENCODING @locale,UTF-8,KOI8-U
breaksw
case sh_YU*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-2,CP1250
breaksw
case sk_SK*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-2,CP1250
breaksw
case sl_SI*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-2,CP1250
breaksw
case so_DJ*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case so_KE*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case so_SO*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case sq_AL*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case sr_YU*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$sr_YU_legacy_encoding
breaksw
case st_ZA*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case sv_FI*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case sv_SE*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case tg_TJ*:
setenv G_FILENAME_ENCODING @locale,UTF-8,KOI8-T
breaksw
case th_TH*:
setenv G_FILENAME_ENCODING @locale,UTF-8,TIS-620,ISO-8859-1
breaksw
case tl_PH*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case tr_TR*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-9
breaksw
case uk_UA*:
setenv G_FILENAME_ENCODING @locale,UTF-8,KOI8-U
breaksw
case uz_UZ*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case vi_VN*:
setenv G_FILENAME_ENCODING @locale,UTF-8,TCVN5712-1,ISO-8859-1
breaksw
case wa_BE*:
setenv G_FILENAME_ENCODING @locale,UTF-8,$west_europe_legacy_encoding,CP1252
breaksw
case xh_ZA*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
case yi_US*:
setenv G_FILENAME_ENCODING @locale,UTF-8,CP1255
breaksw
case zh_CN*:
setenv G_FILENAME_ENCODING @locale,UTF-8,GB2312,GB18030,GBK,ISO-8859-1
breaksw
case zh_HK*:
setenv G_FILENAME_ENCODING @locale,UTF-8,BIG5-HKSCS,ISO-8859-1
breaksw
case zh_SG*:
setenv G_FILENAME_ENCODING @locale,UTF-8,GB2312,GB18030,GBK,ISO-8859-1
breaksw
case zh_TW*:
setenv G_FILENAME_ENCODING @locale,UTF-8,BIG5,EUC-TW,ISO-8859-1
breaksw
case zu_ZA*:
setenv G_FILENAME_ENCODING @locale,UTF-8,ISO-8859-1,CP1252
breaksw
endsw
skip:
unset west_europe_legacy_encoding
unset russian_legacy_encoding
unset sr_YU_legacy_encoding

465
glib2.sh Normal file
View File

@ -0,0 +1,465 @@
# GLib filename encoding guesser.
# Author: Stanislav Brabec <sbrabec@suse.cz>
# Additions are welcome.
# This script must be executed after setting LANG variable.
# Try filenames which are invalid in UTF-8 as locale specific.
# For selected locales, G_FILENAME_ENCODING takes precedence.
export G_BROKEN_FILENAMES=1
# In West Europe there was used both ISO-8859-15 and ISO-8859-1.
# There is no chance to recognize it, so we must guess.
#west_europe_legacy_encoding=ISO-8859-1
west_europe_legacy_encoding=ISO-8859-15
# In Russia, "official" encoding is ISO-8859-5, but most GNOME users
# preferred KOI8-R. We must guess.
#russian_legacy_encoding=ISO-8859-5
russian_legacy_encoding=KOI8-R
# In former Yugoslavia sr_YU have covered two different alphabets -
# one Latin and on Cyrillic. No chance to guess.
sr_YU_legacy_encoding=ISO-8859-2,CP1250
#sr_YU_legacy_encoding=ISO-8859-5
# Japanese uses two legacy encodings. Guess sometimes fails, sometimes not.
# Defining preferred encoding increases chance for success.
japanese_legacy_encoding=EUC-JP
#japanese_legacy_encoding=SHIFT_JIS
case $LANG in
aa_DJ* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
af_ZA* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
an_ES* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-15,CP1252
;;
ar_AE* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
;;
ar_BH* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
;;
ar_DZ* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
;;
ar_EG* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
;;
ar_IQ* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
;;
ar_JO* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
;;
ar_KW* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
;;
ar_LB* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
;;
ar_LY* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
;;
ar_MA* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
;;
ar_OM* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
;;
ar_QA* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
;;
ar_SA* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
;;
ar_SD* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
;;
ar_SY* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
;;
ar_TN* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
;;
ar_YE* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
;;
be_BY* )
G_FILENAME_ENCODING=@locale,UTF-8,CP1251
;;
bg_BG* )
G_FILENAME_ENCODING=@locale,UTF-8,CP1251
;;
br_FR* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
bs_BA* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-2,CP1250
;;
ca_ES* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
cs_CZ* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-2,CP1250
;;
cy_GB* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-14,CP1252
;;
da_DK* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
de_AT* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
de_BE* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
de_DE* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
de_CH* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
de_LU* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
el_GR* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-7
;;
en_AU* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
en_BE* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
en_BW* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
en_CA* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
en_DK* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
en_GB* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
en_HK* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
en_IE* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
en_NZ* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
en_PH* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
en_SG* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
en_US* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
en_ZA* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
en_ZW* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
es_AR* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
es_BO* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
es_CL* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
es_CO* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
es_CR* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
es_DO* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
es_EC* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
es_ES* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
es_GT* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
es_HN* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
es_MX* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
es_NI* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
es_PA* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
es_PE* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
es_PR* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
es_PY* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
es_SV* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
es_US* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
es_UY* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
es_VE* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
et_EE* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
eu_ES* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
fa_IR* )
G_FILENAME_ENCODING=@locale,UTF-8,CP1256
;;
fi_FI* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
fo_FO* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
fr_BE* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
fr_CA* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
fr_FR* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
fr_CH* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
fr_LU* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
ga_IE* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
gd_GB* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-15,CP1252
;;
gl_ES* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
gv_GB* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
he_IL* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-8
;;
hr_HR* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-2,CP1250
;;
hu_HU* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-2,CP1250
;;
hy_AM* )
G_FILENAME_ENCODING=@locale,UTF-8,ARMSCII-8
;;
id_ID* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
is_IS* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
it_CH* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
it_IT* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
iw_IL* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-8
;;
ja_JP* )
G_FILENAME_ENCODING=@locale,UTF-8,$japanese_legacy_encoding,EUC-JP,SHIFT_JIS,ISO-8859-1
;;
ka_GE* )
G_FILENAME_ENCODING=@locale,UTF-8,GEORGIAN-PS
;;
kl_GL* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
km_KH* )
G_FILENAME_ENCODING=@locale,UTF-8,GB18030
;;
ko_KR* )
G_FILENAME_ENCODING=@locale,UTF-8,EUC-KR,ISO-8859-1
;;
kw_GB* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
lg_UG* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-10,CP1252
;;
lt_LT* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-13,CP1252
;;
lv_LV* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-13,CP1252
;;
mi_NZ* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-13,CP1252
;;
mk_MK* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-5,CP1251
;;
ms_MY* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
mt_MT* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-3
;;
nb_NO* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
nl_BE* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
nl_NL* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
nn_NO* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
no_NO* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
oc_FR* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
om_KE* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
pl_PL* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-2,CP1250
;;
pt_BR* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
pt_PT* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
ro_RO* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-2,CP1250
;;
ru_RU* )
G_FILENAME_ENCODING=@locale,UTF-8,$russian_legacy_encoding,CP1251
;;
ru_UA* )
G_FILENAME_ENCODING=@locale,UTF-8,KOI8-U
;;
sh_YU* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-2,CP1250
;;
sk_SK* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-2,CP1250
;;
sl_SI* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-2,CP1250
;;
so_DJ* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
so_KE* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
so_SO* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
sq_AL* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
sr_YU* )
G_FILENAME_ENCODING=@locale,UTF-8,$sr_YU_legacy_encoding
;;
st_ZA* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
sv_FI* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
sv_SE* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
tg_TJ* )
G_FILENAME_ENCODING=@locale,UTF-8,KOI8-T
;;
th_TH* )
G_FILENAME_ENCODING=@locale,UTF-8,TIS-620,ISO-8859-1
;;
tl_PH* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
tr_TR* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-9
;;
uk_UA* )
G_FILENAME_ENCODING=@locale,UTF-8,KOI8-U
;;
uz_UZ* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
vi_VN* )
G_FILENAME_ENCODING=@locale,UTF-8,TCVN5712-1,ISO-8859-1
;;
wa_BE* )
G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
;;
xh_ZA* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
yi_US* )
G_FILENAME_ENCODING=@locale,UTF-8,CP1255
;;
zh_CN* )
G_FILENAME_ENCODING=@locale,UTF-8,GB2312,GB18030,GBK,ISO-8859-1
;;
zh_HK* )
G_FILENAME_ENCODING=@locale,UTF-8,BIG5-HKSCS,ISO-8859-1
;;
zh_SG* )
G_FILENAME_ENCODING=@locale,UTF-8,GB2312,GB18030,GBK,ISO-8859-1
;;
zh_TW* )
G_FILENAME_ENCODING=@locale,UTF-8,BIG5,EUC-TW,ISO-8859-1
;;
zu_ZA* )
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
;;
esac
export G_FILENAME_ENCODING
unset west_europe_legacy_encoding
unset russian_legacy_encoding
unset sr_YU_legacy_encoding

517
glib2.spec Normal file
View File

@ -0,0 +1,517 @@
#
# spec file
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "doc"
%global psuffix -doc
%else
%global psuffix %{nil}
%endif
%define libver 2_0-0
%define libgio libgio-%{libver}
%define libglib libglib-%{libver}
%define libgmodule libgmodule-%{libver}
%define libgobject libgobject-%{libver}
%define libgthread libgthread-%{libver}
%bcond_without systemtap
Name: glib2%{psuffix}
Version: 2.76.2
Release: 0
Summary: General-Purpose Utility Library
License: LGPL-2.1-or-later
Group: Development/Libraries/C and C++
URL: https://wiki.gnome.org/Projects/GLib
Source0: https://download.gnome.org/sources/glib/2.76/glib-%{version}.tar.xz
Source1: glib2.sh
Source2: glib2.csh
# Not upstream file. Only proposes upstream packages:
Source4: glib2-upstream-gnome_defaults.conf
# Some documentation for people writing branding packages, shipped in the branding-upstream package
Source5: README.Gsettings-overrides
Source6: macros.glib2
# zsh completion from https://github.com/jmatsuzawa/zsh-comp-gsettings
Source8: gsettings.zsh
Source98: glib2-rpmlintrc
Source99: baselibs.conf
# PATCH-FEATURE-UPSTREAM glib2-bgo569829-gettext-gkeyfile.patch fate300461 bgo569829 vuntz@novell.com -- Look for translation of desktop entry strings via gettext, part that we share with Ubuntu and try to push upstream
Patch0: glib2-bgo569829-gettext-gkeyfile.patch
# PATCH-FEATURE-OPENSUSE glib2-fate300461-gettext-gkeyfile-suse.patch fate300461 vuntz@novell.com -- Look for translation of desktop entry strings via gettext, part that deals with the openSUSE specific infrastructure (with desktop_translations)
Patch1: glib2-fate300461-gettext-gkeyfile-suse.patch
# PATCH-FIX-OPENSUSE glib2-suppress-schema-deprecated-path-warning.patch rh#814053 badshah400@gmail.com -- Suppress the deprecated path warning since it fills up screen unnecessarily during package installations/upgrade.
Patch2: glib2-suppress-schema-deprecated-path-warning.patch
# PATCH-FIX-OPENSUSE glib2-gdbus-codegen-version.patch olaf@aepfle.de -- Remove version string from files generated by gdbus-codegen
Patch4: glib2-gdbus-codegen-version.patch
BuildRequires: docbook-xsl-stylesheets
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: libselinux-devel
BuildRequires: m4
BuildRequires: meson >= 0.60.0
BuildRequires: pkgconfig
BuildRequires: python3-base >= 3.5
# gdbus-codegen is run during the build, so we need python3-xml
BuildRequires: python3-xml
BuildRequires: xsltproc
# Needed for gresource
BuildRequires: pkgconfig(libelf) >= 0.8.12
BuildRequires: pkgconfig(libffi) >= 3.0.0
BuildRequires: pkgconfig(libpcre2-8) >= 10.32
BuildRequires: pkgconfig(mount) >= 2.28
BuildRequires: pkgconfig(zlib)
%if "%{flavor}" == "doc"
# Split-provides
Provides: glib2-devel:%{_datadir}/gtk-doc/html/gobject/index.html
%endif
%if "%{flavor}" == "doc"
BuildRequires: glib2-devel
BuildRequires: gtk-doc >= 1.32
%endif
%if %{with systemtap}
BuildRequires: systemtap-dtrace
BuildRequires: systemtap-headers
%endif
%description
GLib is a general-purpose utility library, which provides many useful
data types, macros, type conversions, string utilities, file utilities,
a main loop abstraction, and so on.
%if %{with doc}
This package provides the documentation for the GLib library.
%endif
%package tools
Summary: Tools from glib2, a general-purpose utility library
# ensure libgio-2_0-0 is updated before glib2-tools' ensures glib-compile-schema to
# be functional when the file trigger fires (boo#1178713)
Group: Development/Libraries/C and C++
Requires(post): %{libgio} = %{version}
%description tools
GLib is a general-purpose utility library, which provides many useful
data types, macros, type conversions, string utilities, file utilities,
a main loop abstraction, and so on.
%package -n gio-branding-upstream
Summary: Upstream definitions of default settings and applications
Group: System/Libraries
Requires: %{libgio} = %{version}
Supplements: (%{libgio} and branding-upstream)
Conflicts: gio-branding
Provides: %{name}-branding-upstream = %{version}
Obsoletes: %{name}-branding-upstream < %{version}
Provides: gio-branding = %{version}
BuildArch: noarch
#BRAND: The /etc/gnome_defaults.conf allows to define arbitrary
#BRAND: applications as preferred defaults.
#BRAND: A /usr/share/glib-2.0/schemas/$NAME.gschema.override file can
#BRAND: be used to override the default value for GSettings keys. See
#BRAND: README.Gsettings-overrides for more details. The branding
#BRAND: package should then have proper Requires for features changed
#BRAND: with such an override file.
# NOTE: gnome_defaults is not an upstream feature, but a SuSE
# enhancement, but to conform branding conventions, the package is named
# as gio-branding-upstream.
%description -n gio-branding-upstream
This package provides upstream defaults for settings stored with
GSettings and applications used by the MIME system.
%package devel
Summary: Development files for glib, a general-purpose utility library
# Now require the subpackages too
Group: Development/Libraries/C and C++
Requires: %{libgio} = %{version}
Requires: %{libglib} = %{version}
Requires: %{libgmodule} = %{version}
Requires: %{libgobject} = %{version}
Requires: %{libgthread} = %{version}
Requires: glib2-tools = %{version}
Requires: glibc-devel
Requires: pkgconfig
# Required by gdbus-codegen
Requires: python3-xml
#
%description devel
GLib is a general-purpose utility library, which provides many useful
data types, macros, type conversions, string utilities, file utilities,
a main loop abstraction, and so on.
This package contains the development files for GLib.
%package devel-static
Summary: Static libraries for glib, a general-purpose utility library
Group: Development/Libraries/C and C++
Requires: %{name}-devel = %{version}
%description devel-static
GLib is a general-purpose utility library, which provides many useful
data types, macros, type conversions, string utilities, file utilities,
a main loop abstraction, and so on.
This package contains static versions of the GLib libraries.
%package -n %{libglib}
Summary: General-Purpose Utility Library
Group: System/Libraries
Provides: %{name} = %{version}
Obsoletes: %{name} < %{version}
#
%description -n %{libglib}
GLib is a general-purpose utility library, which provides many useful
data types, macros, type conversions, string utilities, file utilities,
a main loop abstraction, and so on.
%package -n %{libgmodule}
Summary: General-Purpose Utility Library -- Library for Modules
Group: System/Libraries
%description -n %{libgmodule}
GLib is a general-purpose utility library, which provides many useful
data types, macros, type conversions, string utilities, file utilities,
a main loop abstraction, and so on.
The libgmodule library provides a portable way to dynamically load
object files (commonly known as 'plug-ins').
%package -n %{libgio}
Summary: A virtual file system library API
Group: System/Libraries
# The tools are useful for people having libgio
# bnc#555605: shared-mime-info is required by libgio to properly detect mime types, but not during build
#!BuildIgnore: shared-mime-info
Requires: %{name}-tools
# bnc#678518: libgio interacts with others by means of dbus-launch
Requires: dbus-launch
Requires: gio-branding = %{version}
Requires: shared-mime-info
# Needed for branding packages
Provides: gio = %{version}
# Temporarily disable this, pending further discussion
# Recommends: gvfs
%description -n %{libgio}
GLib is a general-purpose utility library, which provides many useful
data types, macros, type conversions, string utilities, file utilities,
a main loop abstraction, and so on.
GIO provides a modern, easy-to-use VFS API.
%package -n %{libgthread}
Summary: Portable API from glib wrapping system threads
Group: System/Libraries
%description -n %{libgthread}
GLib is a general-purpose utility library, which provides many useful
data types, macros, type conversions, string utilities, file utilities,
a main loop abstraction, and so on.
The libgthread library provides a portable way to write multi-threaded
software.
%package -n %{libgobject}
Summary: Object-Oriented Framework for C
Group: System/Libraries
%description -n %{libgobject}
GLib is a general-purpose utility library, which provides many useful
data types, macros, type conversions, string utilities, file utilities,
a main loop abstraction, and so on.
The GObject library provides an object-oriented framework for C.
%package tests-devel
Summary: Tests for the glib2 package
Group: Development/Libraries/C and C++
Requires: %{name}-devel = %{version}
Requires: %{name}-tests = %{version}-%{release}
Provides: %{name}-tests = %{version}-%{release}
Obsoletes: %{name}-tests < %{version}-%{release}
%description tests-devel
The glib2-tests-devel package contains tests that can be used to verify
the functionality of the installed glib2 package.
%lang_package
%prep
%setup -q -n glib-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch4 -p1
cp -a %{SOURCE1} %{SOURCE2} %{SOURCE5} .
cp -a %{SOURCE4} gnome_defaults.conf
# replace /usr/bin/env shebangs
# /usr/bin/env @PYTHON@ -> /usr/bin/python3
grep "%{_bindir}/env @PYTHON@" . -rl | xargs sed -i "s|%{_bindir}/env @PYTHON@|%{_bindir}/python3|g"
sed -i "s/1.32.1/1.32/" docs/reference/meson.build
%build
%if %{with systemtap}
%global _lto_cflags %{nil}
%else
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
%endif
%meson \
--default-library=both \
-Dselinux=enabled \
-Dman=true \
%if "%{flavor}" == "doc"
-Dgtk_doc=true \
%endif
%if %{with systemtap}
-Dsystemtap=true \
-Ddtrace=true \
%else
-Dsystemtap=false \
-Ddtrace=false \
%endif
-Dinstalled_tests=true \
%{nil}
%meson_build
%install
%meson_install
%if "%{flavor}" == "doc"
find %{buildroot}/%{_prefix} -not -path "*%{_datadir}/gtk-doc/*" -delete || :
%else
%find_lang glib20 %{?no_lang_C}
mkdir -p %{buildroot}%{_sysconfdir}/profile.d
install -D -m0644 glib2.sh %{buildroot}%{_sysconfdir}/profile.d/zzz-glib2.sh
install -D -m0644 glib2.csh %{buildroot}%{_sysconfdir}/profile.d/zzz-glib2.csh
install -D -m0644 gnome_defaults.conf %{buildroot}%{_sysconfdir}/gnome_defaults.conf
# default apps magic
mkdir -p %{buildroot}%{_localstatedir}/cache/gio-2.0 %{buildroot}%{_datadir}/applications
>> %{buildroot}%{_localstatedir}/cache/gio-2.0/gnome-mimeapps.list
>> %{buildroot}%{_localstatedir}/cache/gio-2.0/xfce-mimeapps.list
>> %{buildroot}%{_localstatedir}/cache/gio-2.0/lxde-mimeapps.list
>> %{buildroot}%{_localstatedir}/cache/gio-2.0/pantheon-mimeapps.list
>> %{buildroot}%{_localstatedir}/cache/gio-2.0/budgie-mimeapps.list
>> %{buildroot}%{_localstatedir}/cache/gio-2.0/mate-mimeapps.list
ln -s %{_localstatedir}/cache/gio-2.0/gnome-mimeapps.list %{buildroot}%{_datadir}/applications/gnome-mimeapps.list
# gio-querymodules magic
%if "%{_lib}" == "lib64"
mv -T %{buildroot}%{_bindir}/gio-querymodules %{buildroot}%{_bindir}/gio-querymodules-64
%endif
mkdir -p %{buildroot}%{_libdir}/gio/modules
>> %{buildroot}%{_libdir}/gio/modules/giomodule.cache
# gsettings magic
>> %{buildroot}%{_datadir}/glib-2.0/schemas/gschemas.compiled
# Install rpm macros
mkdir -p %{buildroot}%{_rpmmacrodir}
cp -t%{buildroot}%{_rpmmacrodir} %{SOURCE6}
# Install zsh completion for gsettings
mkdir -p %{buildroot}%{_datadir}/zsh/site-functions/
cp -T %{SOURCE8} %{buildroot}%{_datadir}/zsh/site-functions/_gsettings
mkdir -p %{buildroot}%{_datadir}/gtk-doc/html
%fdupes %{buildroot}/%{_prefix}
# Too many users complain about schemas compiled with wrong permissions
# when in fact the system just honours their umask setting
# subshell restores umask for paranoia mode
%define compile_schemas \
(umask 022 && %{_bindir}/glib-compile-schemas %{_datadir}/glib-2.0/schemas)
%filetriggerin -n glib2-tools -- %{_datadir}/glib-2.0/schemas
%{compile_schemas}
%filetriggerpostun -n glib2-tools -- %{_datadir}/glib-2.0/schemas
%{compile_schemas}
%post -n %{libglib} -p /sbin/ldconfig
%post -n %{libgobject} -p /sbin/ldconfig
%post -n %{libgthread} -p /sbin/ldconfig
%post -n %{libgio}
%{ldconfig}
for ENV in gnome xfce lxde pantheon mate
do mimeapps="%{_localstatedir}/cache/gio-2.0/$ENV-mimeapps.list" &&
2>/dev/null <"${mimeapps}" || cat >"${mimeapps}" <<EOF
# Dummy file. Install desktop-file-utils to get better defaults.
[Default Applications]
EOF
done
%endif
%check
### FIXME ### Figure out how to run the "stable tests" only ref info from upstream.
#%%meson_test
%post -n libgmodule-2_0-0 -p /sbin/ldconfig
%postun -n %{libglib} -p %{ldconfig}
%postun -n %{libgobject} -p %{ldconfig}
%postun -n %{libgthread} -p %{ldconfig}
%postun -n %{libgio} -p %{ldconfig}
%postun -n %{libgmodule} -p %{ldconfig}
%if "%{flavor}" == "doc"
%files
%{_datadir}/gtk-doc/html/gio
%{_datadir}/gtk-doc/html/glib
%{_datadir}/gtk-doc/html/gobject
%else
%files tools
%license LICENSES/LGPL-2.1-or-later.txt
%doc README.md
%{_bindir}/gapplication
%{_bindir}/gdbus
%{_bindir}/gio
%{_bindir}/gio-querymodules*
%{_bindir}/glib-compile-schemas
%{_bindir}/gresource
%{_bindir}/gsettings
%{_libexecdir}/gio-launch-desktop
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/gapplication
%{_datadir}/bash-completion/completions/gdbus
%{_datadir}/bash-completion/completions/gio
%{_datadir}/bash-completion/completions/gresource
%{_datadir}/bash-completion/completions/gsettings
%dir %{_datadir}/zsh
%dir %{_datadir}/zsh/site-functions
%{_datadir}/zsh/site-functions/_gsettings
%{_mandir}/man1/gapplication.1%{?ext_man}
%{_mandir}/man1/gdbus.1%{?ext_man}
%{_mandir}/man1/gio.1%{?ext_man}
%{_mandir}/man1/gio-querymodules.1%{?ext_man}
%{_mandir}/man1/glib-compile-schemas.1%{?ext_man}
%{_mandir}/man1/gresource.1%{?ext_man}
%{_mandir}/man1/gsettings.1%{?ext_man}
# We put those files here, but they don't really belong here. They just don't
# have a better home... The zzz-glib2 scripts could arguably be in
# libglib-2_0-0 but that would break the shared library policy.
%{_sysconfdir}/profile.d/zzz-glib2.*
%files -n gio-branding-upstream
%license LICENSES/LGPL-2.1-or-later.txt
%doc README.Gsettings-overrides
%config (noreplace) %{_sysconfdir}/gnome_defaults.conf
%files -n %{libglib}
%license LICENSES/LGPL-2.1-or-later.txt
%doc NEWS
%{_libdir}/libglib*.so.*
%files -n %{libgmodule}
%license LICENSES/LGPL-2.1-or-later.txt
%{_libdir}/libgmodule*.so.*
%files -n %{libgobject}
%license LICENSES/LGPL-2.1-or-later.txt
%{_libdir}/libgobject*.so.*
%files -n %{libgthread}
%license LICENSES/LGPL-2.1-or-later.txt
%{_libdir}/libgthread*.so.*
%files -n %{libgio}
%license LICENSES/LGPL-2.1-or-later.txt
%{_libdir}/libgio*.so.*
%dir %{_libdir}/gio
%dir %{_libdir}/gio/modules
%ghost %{_libdir}/gio/modules/giomodule.cache
%dir %{_datadir}/glib-2.0/
%dir %{_datadir}/glib-2.0/schemas/
%ghost %{_datadir}/glib-2.0/schemas/gschemas.compiled
%{_datadir}/applications/gnome-mimeapps.list
%dir %{_localstatedir}/cache/gio-2.0
%ghost %{_localstatedir}/cache/gio-2.0/gnome-mimeapps.list
%ghost %{_localstatedir}/cache/gio-2.0/xfce-mimeapps.list
%ghost %{_localstatedir}/cache/gio-2.0/lxde-mimeapps.list
%ghost %{_localstatedir}/cache/gio-2.0/pantheon-mimeapps.list
%ghost %{_localstatedir}/cache/gio-2.0/budgie-mimeapps.list
%ghost %{_localstatedir}/cache/gio-2.0/mate-mimeapps.list
%files devel
%license LICENSES/LGPL-2.1-or-later.txt
%{_bindir}/gdbus-codegen
%{_bindir}/glib-compile-resources
%{_bindir}/glib-genmarshal
%{_bindir}/glib-gettextize
%{_bindir}/glib-mkenums
%{_bindir}/gobject-query
%{_bindir}/gtester
%{_bindir}/gtester-report
%{_mandir}/man?/gdbus-codegen*%{ext_man}
%{_mandir}/man?/glib-compile-resources*%{ext_man}
%{_mandir}/man?/glib-genmarshal*%{ext_man}
%{_mandir}/man?/glib-gettextize*%{ext_man}
%{_mandir}/man?/glib-mkenums*%{ext_man}
%{_mandir}/man?/gobject-query*%{ext_man}
%{_mandir}/man?/gtester*%{ext_man}
%dir %{_datadir}/aclocal
%{_datadir}/aclocal/glib-2.0.m4
%{_datadir}/aclocal/glib-gettext.m4
%{_datadir}/aclocal/gsettings.m4
%dir %{_datadir}/gettext/its/
%{_datadir}/gettext/its/gschema*
%dir %{_datadir}/glib-2.0/
%{_datadir}/glib-2.0/gdb/
%{_datadir}/glib-2.0/gettext/
%{_datadir}/glib-2.0/codegen/
%{_datadir}/glib-2.0/schemas/gschema.dtd
%{_datadir}/glib-2.0/valgrind/
%{_includedir}/glib-2.0
%{_includedir}/gio-unix-2.0
%{_libdir}/lib*.so
%dir %{_libdir}/glib-2.0/
%{_libdir}/glib-2.0/include/
%{_libdir}/pkgconfig/*.pc
%{_datadir}/gdb/auto-load/%{_libdir}/*-gdb.py
%if %{with systemtap}
%dir %{_datadir}/systemtap
%dir %{_datadir}/systemtap/tapset
%dir %{_datadir}/systemtap/tapset/*
%{_datadir}/systemtap/tapset/*/libgio-*.so.*.stp
%{_datadir}/systemtap/tapset/*/libglib-*.so.*.stp
%{_datadir}/systemtap/tapset/*/libgobject-*.so.*.stp
%endif
%{_rpmmacrodir}/macros.glib2
# Own these directories to avoid build requirement on gdb
# only for directories ownership
%dir %{_datadir}/gdb
%dir %{_datadir}/gdb/auto-load
%dir %{_datadir}/gdb/auto-load%{_prefix}
%dir %{_datadir}/gdb/auto-load%{_libdir}
# Own these directories to not avoid breakages throughout the project
%dir %{_datadir}/gtk-doc
%dir %{_datadir}/gtk-doc/html
%files devel-static
%license LICENSES/LGPL-2.1-or-later.txt
%{_libdir}/lib*.a
%files lang -f glib20.lang
%license LICENSES/LGPL-2.1-or-later.txt
%files tests-devel
%license LICENSES/LGPL-2.1-or-later.txt
%{_libexecdir}/installed-tests
%attr(0755 - -) %{_libexecdir}/installed-tests/glib/taptestrunner.py
%attr(0755 - -) %{_libexecdir}/installed-tests/glib/x-content/unix-software/autorun.sh
%{_datadir}/installed-tests
%endif
%changelog

151
gsettings.zsh Normal file
View File

@ -0,0 +1,151 @@
#compdef gsettings
_gsettings() {
_arguments : \
'--schemadir[A directory to search for additional schemas]:additional schema:_path_files -/' \
':gsettings command:_gsettings_commands' \
'*: :_gsettings_rest_args'
}
(( $+functions[_gsettings_commands] )) || _gsettings_commands() {
local -a command_list
command_list=(
'help:show the help'
'list-schemas:list installed schemas'
'list-relocatable-schemas:list relocatable schemas'
'list-keys:list keys in a schema'
'list-children:list children of a schema'
'list-recursively:list keys and values, recursively'
'range:queries the range of a key'
'get:get the value of a key'
'set:set the value of a key'
'reset:reset the value of a key'
'reset-recursively:reset all values in a given schema'
'writable:check if a key is writable'
'monitor:watch for changes'
)
_describe -t commands 'gsettings commands' command_list
}
(( $+functions[_gsettings_rest_args] )) || _gsettings_rest_args() {
local CMD_IDX=2
local SCHEMA_IDX=3
local KEY_IDX=4
local VALUE_IDX=5
local offset=0
local opt_schemadir schemadir cmd schema key
if [[ $#words -ge 4 && "${(Q)words[2]}" == --schemadir ]]; then
opt_schemadir=--schemadir
schemadir="${(Q)words[3]}"
offset=2
fi
cmd="${(Q)words[CMD_IDX+offset]}"
case $((CURRENT-offset)) in
$SCHEMA_IDX)
case "$cmd" in
help)
_gsettings_help_targets
;;
list-keys|list-children|list-recursively|range|get|set|reset| \
reset-recursively|writable|monitor)
_gsettings_schemas "$opt_schemadir" "$schemadir"
;;
esac
;;
$KEY_IDX)
case "$cmd" in
get|set|range|reset|writable|monitor)
schema="${(Q)words[SCHEMA_IDX+offset]}"
_gsettings_keys "$opt_schemadir" "$schemadir" "$schema"
;;
esac
;;
$VALUE_IDX)
case "$cmd" in
set)
schema="${(Q)words[SCHEMA_IDX+offset]}"
key="${(Q)words[KEY_IDX+offset]}"
_gsettings_values "$opt_schemadir" "$schemadir" "$schema" "$key"
;;
esac
;;
esac
}
(( $+functions[_gsettings_help_targets] )) || _gsettings_help_targets() {
local -a target_list
target_list=(
'help:show the help'
'list-schemas:list installed schemas'
'list-relocatable-schemas:list relocatable schemas'
'list-keys:list keys in a schema'
'list-children:list children of a schema'
'list-recursively:list keys and values, recursively'
'range:queries the range of a key'
'get:get the value of a key'
'set:set the value of a key'
'reset:reset the value of a key'
'reset-recursively:reset all values in a given schema'
'writable:check if a key is writable'
'monitor:watch for changes'
)
_describe -t help-target 'help targets' target_list
}
(( $+functions[_gsettings_schemas] )) || _gsettings_schemas() {
local -a schema_list
schema_list=(
${(@f)"$(gsettings $1 $2 list-schemas 2>/dev/null)"}
${(@f)"$(gsettings $1 $2 list-relocatable-schemas 2>/dev/null)"}
)
if [[ $#schema_list == 0 ]]; then
schema_list=(
${(@f)"$(gsettings list-schemas 2>/dev/null)"}
${(@f)"$(gsettings list-relocatable-schemas 2>/dev/null)"}
)
fi
_describe -t schemas 'schemas' schema_list -V
}
(( $+functions[_gsettings_keys] )) || _gsettings_keys() {
local -a key_list
key_list=(${(@f)"$(gsettings $1 $2 list-keys $3 2>/dev/null)"})
if [[ $#key_list == 0 ]]; then
key_list=(${(@f)"$(gsettings list-keys $3 2>/dev/null)"})
fi
_describe -t keys 'keys' key_list -V
}
# Complete possible values including bool and enum
(( $+functions[_gsettings_values] )) || _gsettings_values() {
local -a range
range=(${(@f)"$(gsettings $1 $2 range $3 $4 2>/dev/null)"})
if [[ $#range == 0 ]]; then
range=(${(@f)"$(gsettings range $3 $4 2>/dev/null)"})
fi
case "$range[1]" in
'type b')
_gsettings_complete_bool
;;
'enum')
_gsettings_complete_enum $range[2,-1]
;;
esac
}
(( $+functions[_gsettings_complete_bool] )) || _gsettings_complete_bool() {
local -a bool_list
bool_list=('true' 'false')
_describe -t val-bool 'possible values (bool)' bool_list -V
}
(( $+functions[_gsettings_complete_enum] )) || _gsettings_complete_enum() {
local -a enum_list
enum_list=(${(@Q)"${@}"})
_describe -t val-enum 'possible values' enum_list -V
}
_gsettings

69
macros.glib2 Normal file
View File

@ -0,0 +1,69 @@
# RPM macros for packages installing a GSettings schema or GIO module
#
###
#
# When a package installs a GSettings schemas, it should use all
# three macros:
#
# - %glib2_gsettings_schema_requires in the preamble
# - %glib2_gsettings_schema_post in %post
# - %glib2_gsettings_schema_postun in %postun
#
###
#
# When a package installs a GIO module, it should use all
# three macros:
#
# - %glib2_gio_module_requires in the preamble
# - %glib2_gio_module_post in %post
# - %glib2_gio_module_postun in %postun
#
# Note that %glib2_gio_module_post and %glib2_gio_module_postun can
# optionally take the path to the directory where modules live. This
# is useful for applications using the GIO module system on their own,
# since they will install modules in their own directory. If no
# argument is passed, the path for the modules for GIO itself is used.
#
###
%glib2_gsettings_schema_requires \
%nil
%glib2_gsettings_schema_post \
%nil
%glib2_gsettings_schema_postun \
%nil
%glib2_gio_module_requires \
Requires(post): glib2-tools \
Requires(postun): glib2-tools
# On install, update the cache
%glib2_gio_module_post() \
%if "x%1" != "x%%1" \
GIO_MODULES_DIR="%1" \
%else \
GIO_MODULES_DIR="%{_libdir}/gio/modules" \
%endif \
%if "%{_lib}" == "lib64" \
%{_bindir}/gio-querymodules-64 "${GIO_MODULES_DIR}" \
%else \
%{_bindir}/gio-querymodules "${GIO_MODULES_DIR}" \
%endif
# On uninstall, update the cache. Note: we ignore upgrades (already
# handled in %post of the new package).
%glib2_gio_module_postun() \
if [ $1 -eq 0 ]; then \
%if "x%1" != "x%%1" \
GIO_MODULES_DIR="%1" \
%else \
GIO_MODULES_DIR="%{_libdir}/gio/modules" \
%endif \
%if "%_lib" == "lib64" \
%{_bindir}/gio-querymodules-64 "${GIO_MODULES_DIR}" \
%else \
%{_bindir}/gio-querymodules "${GIO_MODULES_DIR}" \
%endif \
fi