From 5e6b672d8489ec7da26063488f9a42c3f17eb6ed Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Thu, 31 Jan 2019 18:27:11 +0000
Subject: glib2: update to 2.58.3

---
 abs/core/glib2/PKGBUILD                            | 101 +++++++++++----------
 abs/core/glib2/gio-querymodules.hook               |  11 +++
 abs/core/glib2/glib-compile-schemas.hook           |  12 +++
 abs/core/glib2/memleak.patch                       |  25 -----
 abs/core/glib2/noisy-glib-compile-schemas.diff     |  24 +++++
 .../glib2/revert-warn-glib-compile-schemas.patch   |  33 -------
 6 files changed, 100 insertions(+), 106 deletions(-)
 create mode 100644 abs/core/glib2/gio-querymodules.hook
 create mode 100644 abs/core/glib2/glib-compile-schemas.hook
 delete mode 100644 abs/core/glib2/memleak.patch
 create mode 100644 abs/core/glib2/noisy-glib-compile-schemas.diff
 delete mode 100644 abs/core/glib2/revert-warn-glib-compile-schemas.patch

diff --git a/abs/core/glib2/PKGBUILD b/abs/core/glib2/PKGBUILD
index 3498bde..d0e380b 100644
--- a/abs/core/glib2/PKGBUILD
+++ b/abs/core/glib2/PKGBUILD
@@ -1,69 +1,74 @@
-# $Id$
+# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
 # Maintainer: Jan de Groot <jgc@archlinux.org>
 
 pkgbase=glib2
 pkgname=(glib2 glib2-docs)
-pkgver=2.46.2
-pkgrel=2
-pkgdesc="Common C routines used by GTK+ and other libs"
-url="http://www.gtk.org/"
-arch=(i686 x86_64)
-makedepends=('pkg-config' 'python2' 'libxslt' 'docbook-xml' 'pcre' 'libffi' 'libelf')
-source=(http://ftp.gnome.org/pub/GNOME/sources/glib/${pkgver:0:4}/glib-$pkgver.tar.xz
-        revert-warn-glib-compile-schemas.patch memleak.patch)
-sha256sums=('5031722e37036719c1a09163cc6cf7c326e4c4f1f1e074b433c156862bd733db'
-            '049240975cd2f1c88fbe7deb28af14d4ec7d2640495f7ca8980d873bb710cc97'
-            '8337eeba4a32133d41575c8338fca32ac6a867e6e4a4e021355fcdeb606420a6')
+pkgver=2.58.3
+pkgrel=1
+pkgdesc="Low level core library"
+url="https://wiki.gnome.org/Projects/GLib"
+license=(LGPL2.1)
+arch=(x86_64)
+depends=(pcre libffi libutil-linux zlib)
+makedepends=(gettext gtk-doc shared-mime-info python libelf git util-linux meson dbus)
+checkdepends=(desktop-file-utils)
+optdepends=('python: gdbus-codegen, glib-genmarshal, glib-mkenums, gtester-report'
+            'libelf: gresource inspection tool')
+options=(!emptydirs)
+_commit=f2d1128ffae0de87680e411fb62ccfccafed6b1c  # tags/2.58.3^0
+source=("git+https://gitlab.gnome.org/GNOME/glib.git#commit=$_commit"
+        noisy-glib-compile-schemas.diff
+        glib-compile-schemas.hook gio-querymodules.hook)
+sha256sums=('SKIP'
+            '81a4df0b638730cffb7fa263c04841f7ca6b9c9578ee5045db6f30ff0c3fc531'
+            'e1123a5d85d2445faac33f6dae1085fdd620d83279a4e130a83fe38db52b62b3'
+            '5ba204a2686304b1454d401a39a9d27d09dd25e4529664e3fd565be3d439f8b6')
+
+pkgver() {
+  cd glib
+  git describe --tags | sed 's/-/+/g'
+}
 
 prepare() {
-  cd glib-$pkgver
-  patch -Rp1 -i ../revert-warn-glib-compile-schemas.patch
-  patch -Np1 -i ../memleak.patch
+  cd glib
+
+  # Suppress noise from glib-compile-schemas.hook
+  patch -Np1 -i ../noisy-glib-compile-schemas.diff
 }
-  
+
 build() {
-  cd glib-$pkgver
-  PYTHON=/usr/bin/python2 ./configure --prefix=/usr --libdir=/usr/lib \
-      --sysconfdir=/etc \
-      --with-pcre=system \
-      --disable-fam
-  make
+  arch-meson glib build \
+    -D selinux=false \
+    -D man=true \
+    -D gtk_doc=true
+  ninja -C build
 }
 
 check() {
-  cd glib-$pkgver
-  #make -k check || :
+  meson test -C build
 }
 
 package_glib2() {
-  depends=('pcre' 'libffi')
-  optdepends=('python2: for gdbus-codegen and gtester-report'
-              'libelf: gresource inspection tool')
-  options=('!docs' '!emptydirs')
-  license=('LGPL')
+  DESTDIR="$pkgdir" meson install -C build
+  install -Dt "$pkgdir/usr/share/libalpm/hooks" -m644 *.hook
 
-  cd glib-$pkgver
-  make completiondir=/usr/share/bash-completion/completions DESTDIR="$pkgdir" install
+  python -m compileall -d /usr/share/glib-2.0/codegen "$pkgdir/usr/share/glib-2.0/codegen"
+  python -O -m compileall -d /usr/share/glib-2.0/codegen "$pkgdir/usr/share/glib-2.0/codegen"
 
-  for _i in "$pkgdir/usr/share/bash-completion/completions/"*; do
-      chmod -x "$_i"
-  done
-
-  # Our gdb does not ship the required python modules, so remove it
-  rm -rf "$pkgdir/usr/share/gdb/"
+  # Split docs
+  mv "$pkgdir/usr/share/gtk-doc" "$srcdir"
 }
 
 package_glib2-docs() {
-  pkgdesc="Documentation for glib2"
-  conflicts=('gobject2-docs')
-  replaces=('gobject2-docs')
-  license=('custom')
-  options=('docs' '!emptydirs')
-  
-  cd glib-$pkgver/docs
-  make DESTDIR="${pkgdir}" install
-  install -m755 -d "${pkgdir}/usr/share/licenses/glib2-docs"
-  install -m644 reference/COPYING "${pkgdir}/usr/share/licenses/glib2-docs/"
+  pkgdesc="Documentation for GLib"
+  depends=()
+  optdepends=()
+  license+=(custom)
+
+  mkdir -p "$pkgdir/usr/share"
+  mv gtk-doc "$pkgdir/usr/share"
 
-  rm -rf "${pkgdir}/usr/share/man"
+  install -Dt "$pkgdir/usr/share/licenses/glib2-docs" -m644 glib/docs/reference/COPYING
 }
+
+# vim:set sw=2 et:
diff --git a/abs/core/glib2/gio-querymodules.hook b/abs/core/glib2/gio-querymodules.hook
new file mode 100644
index 0000000..1932333
--- /dev/null
+++ b/abs/core/glib2/gio-querymodules.hook
@@ -0,0 +1,11 @@
+[Trigger]
+Type = File
+Operation = Install
+Operation = Upgrade
+Operation = Remove
+Target = usr/lib/gio/modules/*.so
+
+[Action]
+Description = Updating GIO module cache...
+When = PostTransaction
+Exec = /usr/bin/gio-querymodules /usr/lib/gio/modules
diff --git a/abs/core/glib2/glib-compile-schemas.hook b/abs/core/glib2/glib-compile-schemas.hook
new file mode 100644
index 0000000..04dc59b
--- /dev/null
+++ b/abs/core/glib2/glib-compile-schemas.hook
@@ -0,0 +1,12 @@
+[Trigger]
+Type = File
+Operation = Install
+Operation = Upgrade
+Operation = Remove
+Target = usr/share/glib-2.0/schemas/*.gschema.xml
+Target = usr/share/glib-2.0/schemas/*.gschema.override
+
+[Action]
+Description = Compiling GSettings XML schema files...
+When = PostTransaction
+Exec = /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas
diff --git a/abs/core/glib2/memleak.patch b/abs/core/glib2/memleak.patch
deleted file mode 100644
index 2b927a1..0000000
--- a/abs/core/glib2/memleak.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From db641e32920ee8b553ab6f2d318aafa156e4390c Mon Sep 17 00:00:00 2001
-From: Evangelos Foutras <evangelos@foutrelis.com>
-Date: Wed, 25 Nov 2015 23:29:18 +0200
-Subject: GDBusProxy: Fix a memory leak during initialization
-
-https://bugzilla.gnome.org/show_bug.cgi?id=758641
----
- gio/gdbusproxy.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/gio/gdbusproxy.c b/gio/gdbusproxy.c
-index 52a22fb..7b1140f 100644
---- a/gio/gdbusproxy.c
-+++ b/gio/gdbusproxy.c
-@@ -1720,6 +1720,7 @@ async_initable_init_second_finish (GAsyncInitable  *initable,
-   if (result != NULL)
-     {
-       process_get_all_reply (proxy, result);
-+      g_variant_unref (result);
-     }
- 
-   proxy->priv->initialized = TRUE;
--- 
-cgit v0.11.2
-
diff --git a/abs/core/glib2/noisy-glib-compile-schemas.diff b/abs/core/glib2/noisy-glib-compile-schemas.diff
new file mode 100644
index 0000000..f5f2d94
--- /dev/null
+++ b/abs/core/glib2/noisy-glib-compile-schemas.diff
@@ -0,0 +1,24 @@
+diff --git i/gio/glib-compile-schemas.c w/gio/glib-compile-schemas.c
+index b8de0907248f6860..130f89b1728f7932 100644
+--- i/gio/glib-compile-schemas.c
++++ w/gio/glib-compile-schemas.c
+@@ -1219,19 +1219,6 @@ parse_state_start_schema (ParseState  *state,
+       return;
+     }
+ 
+-  if (path && (g_str_has_prefix (path, "/apps/") ||
+-               g_str_has_prefix (path, "/desktop/") ||
+-               g_str_has_prefix (path, "/system/")))
+-    {
+-      gchar *message = NULL;
+-      message = g_strdup_printf (_("Warning: Schema “%s” has path “%s”.  "
+-                                   "Paths starting with "
+-                                   "“/apps/”, “/desktop/” or “/system/” are deprecated."),
+-                                 id, path);
+-      g_printerr ("%s\n", message);
+-      g_free (message);
+-    }
+-
+   state->schema_state = schema_state_new (path, gettext_domain,
+                                           extends, extends_name, list_of);
+ 
diff --git a/abs/core/glib2/revert-warn-glib-compile-schemas.patch b/abs/core/glib2/revert-warn-glib-compile-schemas.patch
deleted file mode 100644
index 75b0510..0000000
--- a/abs/core/glib2/revert-warn-glib-compile-schemas.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 6560b37450cd19c4a7c7b690e279fe97b7bfdcaa Mon Sep 17 00:00:00 2001
-From: Ryan Lortie <desrt@desrt.ca>
-Date: Thu, 12 Apr 2012 23:55:34 +0000
-Subject: glib-compile-schemas: warn about bad dconf paths
-
-For quite some time the recommended usage of GSettings and dconf has
-been to use paths like /org/gnome/example/.  Use of /apps/ has spilled
-over from GConf and is continuing to make its way into a number of
-applications as they port.
-
-glib-compile-schemas will now warn about these types of paths being
-used.  This generates a lot of noise, but hopefully it will reduce the
-number of ported applications making this mistake.
----
-diff --git a/gio/glib-compile-schemas.c b/gio/glib-compile-schemas.c
-index cf02389..27d0181 100644
---- a/gio/glib-compile-schemas.c
-+++ b/gio/glib-compile-schemas.c
-@@ -1204,6 +1204,12 @@ parse_state_start_schema (ParseState  *state,
-       return;
-     }
- 
-+  if (path && (g_str_has_prefix (path, "/apps/") ||
-+               g_str_has_prefix (path, "/desktop/") ||
-+               g_str_has_prefix (path, "/system/")))
-+    g_printerr ("warning: Schema '%s' has path '%s'.  Paths starting with "
-+                "'/apps/', '/desktop/' or '/system/' are deprecated.\n", id, path);
-+
-   state->schema_state = schema_state_new (path, gettext_domain,
-                                           extends, extends_name, list_of);
- 
---
-cgit v0.9.0.2
-- 
cgit v0.12

