diff options
author | rene <rene@FreeBSD.org> | 2012-03-27 05:11:55 +0800 |
---|---|---|
committer | rene <rene@FreeBSD.org> | 2012-03-27 05:11:55 +0800 |
commit | 10d6b15cb80c5f83a989ccec80059f243f912782 (patch) | |
tree | b33ee197401f61dcd2f8e24d3b7f081e8f36ed0e /www/midori | |
parent | 38b770ddbf27c2c7867f1838c52b453aa290d4f8 (diff) | |
download | freebsd-ports-gnome-10d6b15cb80c5f83a989ccec80059f243f912782.tar.gz freebsd-ports-gnome-10d6b15cb80c5f83a989ccec80059f243f912782.tar.zst freebsd-ports-gnome-10d6b15cb80c5f83a989ccec80059f243f912782.zip |
Implement the low memory profile when RAM is lower than 352 MB.
PR: ports/166422
Submitted by: Olivier Duchateau
Feature safe: yes
Diffstat (limited to 'www/midori')
-rw-r--r-- | www/midori/Makefile | 1 | ||||
-rw-r--r-- | www/midori/files/patch-midori_midori-websettings.c | 50 |
2 files changed, 51 insertions, 0 deletions
diff --git a/www/midori/Makefile b/www/midori/Makefile index 900e812af31b..e255491bcca4 100644 --- a/www/midori/Makefile +++ b/www/midori/Makefile @@ -8,6 +8,7 @@ PORTNAME= midori PORTVERSION= 0.4.4 +PORTREVISION= 1 CATEGORIES= www xfce MASTER_SITES= ${MASTER_SITE_XFCE} MASTER_SITE_SUBDIR= src/apps/${PORTNAME}/${PORTVERSION:R} diff --git a/www/midori/files/patch-midori_midori-websettings.c b/www/midori/files/patch-midori_midori-websettings.c new file mode 100644 index 000000000000..929ef643251a --- /dev/null +++ b/www/midori/files/patch-midori_midori-websettings.c @@ -0,0 +1,50 @@ +--- midori/midori-websettings.c.orig 2012-03-08 23:34:45.000000000 +0100 ++++ midori/midori-websettings.c 2012-03-23 15:48:54.000000000 +0100 +@@ -27,6 +27,11 @@ + #include <sys/utsname.h> + #endif + ++#if defined(__FreeBSD__) ++#include <sys/types.h> ++#include <sys/sysctl.h> ++#endif ++ + struct _MidoriWebSettings + { + WebKitWebSettings parent_instance; +@@ -347,16 +352,26 @@ + static gboolean + midori_web_settings_low_memory_profile () + { +- gchar* contents; +- const gchar* total; +- if (!g_file_get_contents ("/proc/meminfo", &contents, NULL, NULL)) +- return FALSE; +- if (contents && (total = strstr (contents, "MemTotal:")) && *total) +- { +- const gchar* value = katze_skip_whitespace (total + 9); +- gdouble mem_total = g_ascii_strtoll (value, NULL, 0); +- return mem_total / 1024.0 < 352 + 1; +- } ++ #ifdef __FreeBSD__ ++ size_t size; ++ int mem_total; ++ size = sizeof mem_total; ++ ++ sysctlbyname("hw.realmem", &mem_total, &size, NULL, 0); ++ ++ return mem_total / 1048576 < 352; ++ #else ++ gchar* contents; ++ const gchar* total; ++ if (!g_file_get_contents ("/proc/meminfo", &contents, NULL, NULL)) ++ return FALSE; ++ if (contents && (total = strstr (contents, "MemTotal:")) && *total) ++ { ++ const gchar* value = katze_skip_whitespace (total + 9); ++ gdouble mem_total = g_ascii_strtoll (value, NULL, 0); ++ return mem_total / 1024.0 < 352 + 1; ++ } ++ #endif + return FALSE; + } |