diff options
author | Samuli Suominen <ssuominen@gentoo.org> | 2009-08-22 12:16:57 +0000 |
---|---|---|
committer | Samuli Suominen <ssuominen@gentoo.org> | 2009-08-22 12:16:57 +0000 |
commit | b9f6cbfea39329f0bf9fdb9b74bc958ef586ee3e (patch) | |
tree | 9d1756d630c6f5376ca330ae22024b7d7c0e3a94 /media-libs/jpeg | |
parent | Remove realtime-lsm as per bug #199011. (diff) | |
download | gentoo-2-b9f6cbfea39329f0bf9fdb9b74bc958ef586ee3e.tar.gz gentoo-2-b9f6cbfea39329f0bf9fdb9b74bc958ef586ee3e.tar.bz2 gentoo-2-b9f6cbfea39329f0bf9fdb9b74bc958ef586ee3e.zip |
Backport maxmem sysconf() patch from jpeg-6b patchset.
(Portage version: 2.2_rc38/cvs/Linux x86_64)
Diffstat (limited to 'media-libs/jpeg')
-rw-r--r-- | media-libs/jpeg/ChangeLog | 6 | ||||
-rw-r--r-- | media-libs/jpeg/files/jpeg-7-maxmem_sysconf.patch | 50 | ||||
-rw-r--r-- | media-libs/jpeg/jpeg-7.ebuild | 7 |
3 files changed, 59 insertions, 4 deletions
diff --git a/media-libs/jpeg/ChangeLog b/media-libs/jpeg/ChangeLog index b60bfcf78092..ef6d1d0d51b6 100644 --- a/media-libs/jpeg/ChangeLog +++ b/media-libs/jpeg/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for media-libs/jpeg # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/media-libs/jpeg/ChangeLog,v 1.71 2009/08/22 10:29:58 ssuominen Exp $ +# $Header: /var/cvsroot/gentoo-x86/media-libs/jpeg/ChangeLog,v 1.72 2009/08/22 12:16:57 ssuominen Exp $ + + 22 Aug 2009; Samuli Suominen <ssuominen@gentoo.org> jpeg-7.ebuild, + +files/jpeg-7-maxmem_sysconf.patch: + Backport maxmem sysconf() patch from jpeg-6b patchset. *jpeg-7 (22 Aug 2009) diff --git a/media-libs/jpeg/files/jpeg-7-maxmem_sysconf.patch b/media-libs/jpeg/files/jpeg-7-maxmem_sysconf.patch new file mode 100644 index 000000000000..95c207b09d36 --- /dev/null +++ b/media-libs/jpeg/files/jpeg-7-maxmem_sysconf.patch @@ -0,0 +1,50 @@ +# Make a reasonable guess about memory limits using sysconf(). +# includes 5% slop factor as suggested in documentation. + +diff -ur jpeg-7.orig/jmemansi.c jpeg-7/jmemansi.c +--- jpeg-7.orig/jmemansi.c 1996-01-06 19:29:46.000000000 +0200 ++++ jpeg-7/jmemansi.c 2009-08-22 14:47:35.000000000 +0300 +@@ -12,6 +12,15 @@ + * is shoved onto the user. + */ + ++#include <unistd.h> ++ ++#ifdef __FreeBSD__ ++# include <sys/types.h> ++# include <sys/sysctl.h> ++# include <sys/vmmeter.h> ++# include <vm/vm_param.h> ++#endif ++ + #define JPEG_INTERNALS + #include "jinclude.h" + #include "jpeglib.h" +@@ -157,7 +166,26 @@ + GLOBAL(long) + jpeg_mem_init (j_common_ptr cinfo) + { +- return DEFAULT_MAX_MEM; /* default for max_memory_to_use */ ++#ifdef _SC_AVPHYS_PAGES ++ long phys_size; ++ ++ if ((phys_size = sysconf(_SC_AVPHYS_PAGES)) == -1) ++ return DEFAULT_MAX_MEM; /* default for max_memory_to_use */ ++ if ((phys_size *= sysconf(_SC_PAGESIZE)) < 0) ++ return DEFAULT_MAX_MEM; ++ return (long) (phys_size * 0.95); ++#elif defined(HAVE_SYSCTL) && defined(HW_PHYSMEM) ++ /* This works on *bsd and darwin. */ ++ unsigned int physmem; ++ size_t len = sizeof physmem; ++ static int mib[2] = { CTL_HW, HW_PHYSMEM }; ++ ++ if (sysctl (mib, ARRAY_SIZE (mib), &physmem, &len, NULL, 0) == 0 ++ && len == sizeof (physmem)) ++ return (long) (physmem * 0.95); ++#endif ++ ++ return DEFAULT_MAX_MEM; + } + + GLOBAL(void) diff --git a/media-libs/jpeg/jpeg-7.ebuild b/media-libs/jpeg/jpeg-7.ebuild index 3331ff5e0849..f5f904c4078f 100644 --- a/media-libs/jpeg/jpeg-7.ebuild +++ b/media-libs/jpeg/jpeg-7.ebuild @@ -1,14 +1,14 @@ # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/media-libs/jpeg/jpeg-7.ebuild,v 1.2 2009/08/22 10:31:33 ssuominen Exp $ +# $Header: /var/cvsroot/gentoo-x86/media-libs/jpeg/jpeg-7.ebuild,v 1.3 2009/08/22 12:16:57 ssuominen Exp $ EAPI=2 -inherit libtool toolchain-funcs +inherit eutils libtool toolchain-funcs DESCRIPTION="Library to load, handle and manipulate images in the JPEG format" HOMEPAGE="http://www.ijg.org/" SRC_URI="http://www.ijg.org/files/${PN}src.v${PV}.tar.gz - http://dev.gentoo.org/~ssuominen/${P}-extra.tar.bz2" + mirror://gentoo/${P}-extra.tar.bz2" LICENSE="as-is" SLOT="0" @@ -20,6 +20,7 @@ DEPEND="${RDEPEND} sys-devel/libtool" src_prepare() { + epatch "${FILESDIR}"/${P}-maxmem_sysconf.patch elibtoolize } |