]> git.pld-linux.org Git - packages/libjpeg.git/commitdiff
- rel 2; automatic adjusting of maxmem, from gentoo auto/aidath/libjpeg-7-2 auto/th/libjpeg-7-2 auto/ti/libjpeg-7-2
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Tue, 18 Aug 2009 13:07:04 +0000 (13:07 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    libjpeg-maxmem-sysconf.patch -> 1.1
    libjpeg.spec -> 1.70

libjpeg-maxmem-sysconf.patch [new file with mode: 0644]
libjpeg.spec

diff --git a/libjpeg-maxmem-sysconf.patch b/libjpeg-maxmem-sysconf.patch
new file mode 100644 (file)
index 0000000..b1c8d72
--- /dev/null
@@ -0,0 +1,49 @@
+# Make a reasonable guess about memory limits using sysconf().
+# includes 5% slop factor as suggested in documentation.
+
+--- jpeg-6b/jmemansi.c
++++ jpeg-6b/jmemansi.c
+@@ -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)
index 5c87b56e90420a3b5a05fda9abc1b9b7d03068b6..e6edc67d0518008f25a6a2ded9c1e0266ec29185 100644 (file)
@@ -9,13 +9,14 @@ Summary(tr.UTF-8):    JPEG resimlerini işleme kitaplığı
 Summary(uk.UTF-8):     Бібліотека для обробки різноманітних JPEG-файлів
 Name:          libjpeg
 Version:       7
-Release:       1
+Release:       2
 License:       distributable
 Group:         Libraries
 Source0:       http://www.ijg.org/files/jpegsrc.v%{version}.tar.gz
 # Source0-md5: 382ef33b339c299b56baf1296cda9785
 Source1:       http://www.mif.pg.gda.pl/homepages/ankry/man-PLD/%{name}-non-english-man-pages.tar.bz2
 # Source1-md5: d6342c015a489de275ada637a77dc2b0
+Patch0:                %{name}-maxmem-sysconf.patch
 URL:           http://www.ijg.org/
 BuildRequires: libtool
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -165,6 +166,7 @@ tekstowe dołączone do pliku JPEG, a wrjpgcom wstawia takie komentarze.
 
 %prep
 %setup -q -n jpeg-%{version}
+%patch0 -p1
 
 %build
 %configure \
This page took 0.097016 seconds and 4 git commands to generate.