reintroduce jpeg files invalidly removed in 01aa38

During the original generation of 01aa38, jpeg was removed.  This
broke things, thus was removed from that patch- unfortunately the files
still were removed.

Restore them from 01aa38^.

resolved breakage in http://build.chromium.org/p/chromiumos/builders/chromiumos%20sdk/builds/719/steps/BuildBoard/logs/stdio

BUGS=None
TEST=emerge jpeg

Change-Id: I63305227db2c6aa915d4ea369a8e05a49fd05359
Reviewed-on: https://gerrit.chromium.org/gerrit/13505
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
This commit is contained in:
Brian Harring 2011-12-27 16:12:50 -08:00
parent fd8203e71f
commit 5f65a7d179
2 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,37 @@
CC = @CC@
EXEEXT = @EXEEXT@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
datarootdir = @datarootdir@
mandir = @mandir@
man1dir = $(mandir)/man1
MKDIR_P = @MKDIR_P@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
SCRIPTS = exifautotran
PROGRAMS = jpegexiforient$(EXEEXT)
all: $(SCRIPTS) $(PROGRAMS)
jpegexiforient$(EXEEXT): jpegexiforient.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $<
clean:
rm -f $(PROGRAMS) *.o
install: all
$(MKDIR_P) $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir)
$(INSTALL_PROGRAM) $(PROGRAMS) $(DESTDIR)$(bindir)
$(INSTALL_SCRIPT) $(SCRIPTS) $(DESTDIR)$(bindir)
$(INSTALL_DATA) *.1 $(DESTDIR)$(man1dir)
.PHONY: all clean install

View File

@ -0,0 +1,49 @@
# Make a reasonable guess about memory limits using sysconf().
# includes 5% slop factor as suggested in documentation.
--- jpeg-7/jmemansi.c
+++ jpeg-7/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)