$ git diff --patch-with-stat --summary d7a286f5a337332266606fa31c82004a1c9ca403..0c321d875fde1b01080bd6bbc31d12956d0a8782
.abf.yml | 2 +-
glib2.0.spec | 10 ++++++++--
madvise.patch | 32 ++++++++++++++++++++++++++++++++
memory.patch | 19 +++++++++++++++++++
4 files changed, 60 insertions(+), 3 deletions(-)
create mode 100644 madvise.patch
create mode 100644 memory.patch
diff --git a/.abf.yml b/.abf.yml
index 3274166..9725d66 100644
--- a/.abf.yml
+++ b/.abf.yml
@@ -1,2 +1,2 @@
sources:
- glib-2.54.1.tar.xz: 3be679369c7134e05b188285154b00940370b109
+ glib-2.54.2.tar.xz: 85b5d649fc3d18f8d8197bd971dfbebd94b5f96d
diff --git a/glib2.0.spec b/glib2.0.spec
index f298417..f3fb27d 100644
--- a/glib2.0.spec
+++ b/glib2.0.spec
@@ -12,6 +12,9 @@
%bcond_with bootstrap
%bcond_with crosscompile
+# (tpg) optimize it a bit
+%global optflags %optflags -O3
+
# Note that this is NOT a relocatable package
%define api 2.0
%define major 0
@@ -31,7 +34,7 @@
Summary: GIMP Toolkit and GIMP Drawing Kit support library
Name: glib%{api}
Epoch: 1
-Version: 2.54.1
+Version: 2.54.2
Release: 1
Group: System/Libraries
License: LGPLv2+
@@ -42,6 +45,10 @@ Source2: glib20.csh
Patch0: glib-2.34.1-no-warnings.patch
# cb - this fix seems to cause perl-glib to fail
#Patch2: glib-2.46.0-revert_quark_optim.patch
+# (tpg) ClearLinux patches
+Patch10: memory.patch
+Patch11: madvise.patch
+
BuildRequires: gettext
BuildRequires: libtool >= 1.4.2-2
BuildRequires: locales-en
@@ -52,7 +59,6 @@ BuildRequires: chrpath
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(libffi)
BuildRequires: pkgconfig(libpcre) >= 8.11
-Requires: pkgconfig(shared-mime-info) >= 0.70
BuildRequires: pkgconfig(zlib)
BuildRequires: pkgconfig(mount)
%if !%{with bootstrap}
diff --git a/madvise.patch b/madvise.patch
new file mode 100644
index 0000000..03fa14f
--- /dev/null
+++ b/madvise.patch
@@ -0,0 +1,32 @@
+diff -Naur glib-2.54.1/glib/gmem.c glib-2.54.1.tpg/glib/gmem.c
+--- glib-2.54.1/glib/gmem.c 2017-07-13 23:03:39.000000000 +0000
++++ glib-2.54.1.tpg/glib/gmem.c 2017-10-27 17:45:31.065701527 +0000
+@@ -33,6 +33,8 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <signal.h>
++#include <sys/mman.h>
++#include <malloc.h>
+
+ #include "gslice.h"
+ #include "gbacktrace.h"
+@@ -238,10 +240,16 @@
+ {
+ gpointer mem;
+
+- if (G_LIKELY (n_bytes))
+- mem = malloc (n_bytes);
+- else
++ if (G_LIKELY (n_bytes)) {
++ if (n_bytes > 64 * 1024) {
++ mem = memalign(4096, n_bytes);
++ madvise(mem, n_bytes, MADV_MERGEABLE);
++ } else {
++ mem = malloc (n_bytes);
++ }
++ } else {
+ mem = NULL;
++ }
+
+ TRACE (GLIB_MEM_ALLOC((void*) mem, (unsigned int) n_bytes, 0, 1));
+
diff --git a/memory.patch b/memory.patch
new file mode 100644
index 0000000..f4ce807
--- /dev/null
+++ b/memory.patch
@@ -0,0 +1,19 @@
+diff -Naur glib-2.54.1/glib/gmain.c glib-2.54.1.tpg/glib/gmain.c
+--- glib-2.54.1/glib/gmain.c 2017-10-02 14:58:06.000000000 +0000
++++ glib-2.54.1.tpg/glib/gmain.c 2017-10-27 17:42:47.597790352 +0000
+@@ -54,6 +54,7 @@
+ #endif
+ #endif
+
++#include <malloc.h>
+ #include <signal.h>
+ #include <sys/types.h>
+ #include <time.h>
+@@ -4184,6 +4185,7 @@
+ poll_func = context->poll_func;
+
+ UNLOCK_CONTEXT (context);
++ malloc_trim(0);
+ ret = (*poll_func) (fds, n_fds, timeout);
+ errsv = errno;
+ if (ret < 0 && errsv != EINTR)