Subject: [alpine-aports] [PATCH] testing/spacefm: update to 1.0.3

From: Stuart Cardall <[email-masked]>
Date: Fri, 28 Aug 2015 22:45:56 +0000

---
 testing/spacefm/APKBUILD              | 36 +++++++++++----
 testing/spacefm/fix-malloc_trim.patch | 84 +++++++++++++++++++++++++++++++++++
 2 files changed, 111 insertions(+), 9 deletions(-)
 create mode 100644 testing/spacefm/fix-malloc_trim.patch

diff --git a/testing/spacefm/APKBUILD b/testing/spacefm/APKBUILD
index 04f991f..9b6d261 100644
--- a/testing/spacefm/APKBUILD
+++ b/testing/spacefm/APKBUILD
@@ -2,19 +2,34 @@
 # Contributor: Bartłomiej Piotrowski <[email-masked]>
 
 pkgname=spacefm
-pkgver=1.0.1
+pkgver=1.0.3
 pkgrel=0
 pkgdesc='Multi-panel tabbed file manager (GTK2 version)'
 arch=all
 url='http://ignorantguru.github.com/spacefm/'
 license='GPL3'
 depends='bash'
-makedepends='intltool gettext-dev gtk+2.0-dev gtk+3.0-dev udev-dev ffmpegthumbnailer-dev linux-headers'
+makedepends='intltool gettext-dev gtk+2.0-dev gtk+3.0-dev eudev-dev ffmpegthumbnailer-dev linux-headers'
 subpackages="$pkgname-lang $pkgname-doc $pkgname-gtk3 $pkgname-gtk3-lang:lang3 $pkgname-gtk3-doc:doc3"
-source="saveas-https://github.com/IgnorantGuru/spacefm/archive/$pkgver.tar.gz/$pkgname-$pkgver.tar.gz"
+source="saveas-https://github.com/IgnorantGuru/spacefm/archive/$pkgver.tar.gz/$pkgname-$pkgver.tar.gz
+	fix-malloc_trim.patch
+	"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+
+prepare() {
+        local i
+        cd "$_builddir"
+
+        for i in $source; do
+                case $i in
+                *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+                esac
+        done
+}
 
 build() {
-	cd "$srcdir"/$pkgname-$pkgver
+        cd "$_builddir"
 	./configure --prefix=/usr \
 		--with-gtk2\
 		-disable-pixmaps || return 1
@@ -22,7 +37,7 @@ build() {
 }
 
 gtk3() {
-	cd "$srcdir"/$pkgname-$pkgver
+        cd "$_builddir"
 	pkgdesc="Multi-panel tabbed file manager (GTK3 version)"
 	replaces="spacefm"
 	mkdir "$subpkgdir"
@@ -47,10 +62,13 @@ doc3() {
 }
 
 package() {
-	cd "$srcdir"/$pkgname-$pkgver
+        cd "$_builddir"
 	make -j1 DESTDIR="$pkgdir" install || return 1
 }
 
-md5sums="3665b0cf08dcbebefcc832afc19d613e  spacefm-1.0.1.tar.gz"
-sha256sums="7f1b0289939e0301cf412518fc4eb35219871faff172ff249d95e4cfa732fa56  spacefm-1.0.1.tar.gz"
-sha512sums="30753bce422629ba87805f61ec0ce0ea6c24ecd10c18b261a956e86796de136aca82f292d463173c65871addad1823764c6126dec2e87b158f3c1160f3c6567e  spacefm-1.0.1.tar.gz"
+md5sums="000e26dc414443f934e3838610cb6174  spacefm-1.0.3.tar.gz
+0d71d0941ef9d443dd7ccf62eff51a13  fix-malloc_trim.patch"
+sha256sums="a6d2db6517d80d9dac65da45412704e3122c65a59f0f4dbd593cea5c4bfa7b6a  spacefm-1.0.3.tar.gz
+e2d0d0768ba3ced33c132eb2830af6cb493cf8fb465830cd16bc6c8964c6670a  fix-malloc_trim.patch"
+sha512sums="3b5b0c5fba9eeb2de92147f6653dc7dc792a4201f9a5abd27d2fe62333d31b4731e56ab9658ea7026c030a82cc95fc97269eebe394cfd0c78183c41d5d5d6264  spacefm-1.0.3.tar.gz
+5317e57ac833479d28112fb9ef3af5aa892117d4bdce23df78624f0740c13c4ce85fd0bceb9dabd078d008b07e4605fbb1a4817b0fab5f71baa1a4fbda92c90c  fix-malloc_trim.patch"
diff --git a/testing/spacefm/fix-malloc_trim.patch b/testing/spacefm/fix-malloc_trim.patch
new file mode 100644
index 0000000..85a3b66
--- /dev/null
+++ b/testing/spacefm/fix-malloc_trim.patch
@@ -0,0 +1,84 @@
+diff -urp spacefm-1.0.3/src/main-window.c spacefm-1.0.3.new/src/main-window.c
+--- spacefm-1.0.3/src/main-window.c	2015-08-26 14:24:08.000000000 +0000
++++ spacefm-1.0.3.new/src/main-window.c	2015-08-28 17:11:43.091757948 +0000
+@@ -1216,7 +1216,9 @@ void main_window_toggle_thumbnails_all_w
+     /* Ensuring free space at the end of the heap is freed to the OS,
+      * mainly to deal with the possibility thousands of large thumbnails
+      * have been freed but the memory not actually released by SpaceFM */
+-    malloc_trim(0);
++    #if defined (__GLIBC__)
++        malloc_trim(0);
++    #endif
+ }
+ 
+ void focus_panel( GtkMenuItem* item, gpointer mw, int p )
+diff -urp spacefm-1.0.3/src/ptk/ptk-file-browser.c spacefm-1.0.3.new/src/ptk/ptk-file-browser.c
+--- spacefm-1.0.3/src/ptk/ptk-file-browser.c	2015-08-26 14:24:08.000000000 +0000
++++ spacefm-1.0.3.new/src/ptk/ptk-file-browser.c	2015-08-28 17:16:58.495770877 +0000
+@@ -1513,7 +1513,9 @@ void ptk_file_browser_finalize( GObject
+      * mainly to deal with the possibility that killing the browser results in
+      * thousands of large thumbnails being freed, but the memory not actually
+      * released by SpaceFM */
+-    malloc_trim(0);
++    #if defined (__GLIBC__)
++        malloc_trim(0);
++    #endif
+ }
+ 
+ void ptk_file_browser_get_property ( GObject *obj,
+@@ -2703,11 +2705,13 @@ void on_dir_file_listed( VFSDir* dir,
+     ptk_file_browser_update_model( file_browser );
+     file_browser->busy = FALSE;
+ 
+-   /* Ensuring free space at the end of the heap is freed to the OS,
+-   * mainly to deal with the possibility that changing the directory results in
+-   * thousands of large thumbnails being freed, but the memory not actually
+-   * released by SpaceFM */
+-   malloc_trim(0);
++    /* Ensuring free space at the end of the heap is freed to the OS,
++     * mainly to deal with the possibility that changing the directory results in
++     * thousands of large thumbnails being freed, but the memory not actually
++     * released by SpaceFM */
++    #if defined (__GLIBC__)
++        malloc_trim(0);
++    #endif
+ 
+     g_signal_emit( file_browser, signals[ AFTER_CHDIR_SIGNAL ], 0 );
+     //g_signal_emit( file_browser, signals[ CONTENT_CHANGE_SIGNAL ], 0 );
+@@ -4556,7 +4560,9 @@ void ptk_file_browser_refresh( GtkWidget
+     /* Ensuring free space at the end of the heap is freed to the OS,
+      * mainly to deal with the possibility thousands of large thumbnails
+      * have been freed but the memory not actually released by SpaceFM */
+-    malloc_trim(0);
++    #if defined (__GLIBC__)
++        malloc_trim(0);
++    #endif
+ 
+     // begin load dir
+     file_browser->busy = TRUE;
+diff -urp spacefm-1.0.3/src/vfs/vfs-dir.c spacefm-1.0.3.new/src/vfs/vfs-dir.c
+--- spacefm-1.0.3/src/vfs/vfs-dir.c	2015-08-26 14:24:08.000000000 +0000
++++ spacefm-1.0.3.new/src/vfs/vfs-dir.c	2015-08-28 17:10:12.543754236 +0000
+@@ -21,7 +21,11 @@
+ #include <string.h>
+ 
+ #include <fcntl.h>  /* for open() */
++
++#if defined (__GLIBC__)
+ #include <malloc.h> /* for malloc_trim */
++#endif
++
+ #include <unistd.h> /* for read */
+ #include "vfs-volume.h"
+ 
+@@ -1193,7 +1197,9 @@ void vfs_dir_unload_thumbnails( VFSDir*
+     /* Ensuring free space at the end of the heap is freed to the OS,
+      * mainly to deal with the possibility thousands of large thumbnails
+      * have been freed but the memory not actually released by SpaceFM */
+-    malloc_trim(0);
++    #if defined (__GLIBC__)
++	malloc_trim(0);
++    #endif
+ }
+ 
+ //sfm added mime change timer
-- 
2.5.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---