Skip to content

Commit

Permalink
port 51082,4,5 from trunk
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/branches/R-2-10-branch@51086 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
ripley committed Feb 1, 2010
1 parent e62995a commit a142402
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 30 deletions.
8 changes: 4 additions & 4 deletions doc/manual/R-admin.texi
Expand Up @@ -991,10 +991,10 @@ You need @code{libpng} and @code{jpeg} sources (available, e.g., from
Working in the directory @file{@var{R_HOME}/src/gnuwin32/bitmap},
install the @code{libpng} and @code{jpeg} sources in sub-directories.
The @code{jpeg} sub-directory for version 7 is named @file{jpeg-7}; if
you use a different version (e.g.@: @file{jpeg-6b}), edit
@file{src/gnuwin32/MkRules} and change the definition of @code{JPEGDIR}:
the names of the @file{libpng} and @file{libtiff} directories can also
be set there.
you use a different version (e.g.@: @file{jpeg-6b} or @file{jpeg-8}),
edit @file{src/gnuwin32/MkRules} and change the definition of
@code{JPEGDIR}: the names of the @file{libpng} and @file{libtiff}
directories can also be set there.

Example:

Expand Down
22 changes: 12 additions & 10 deletions src/gnuwin32/MkRules
@@ -1,6 +1,6 @@
#-*- Makefile -*-
## This file contains tabs: make sure your editor leaves them unchanged.
## As from R 2.9.0 it is only used when building R itself.
## As from R 2.9.0 it is only used when building R itself (and not packages)

## ===== configuration macros for building R ===============

Expand All @@ -23,21 +23,24 @@ ATLAS_PATH=/R/ATLAS/lib/WinNT_P4SSE2
# Support for the ACML and Goto BLASes has been withdrawn: see R-admin.html

# Where does Tcl/Tk live? Spaces allowed.
# If you alter this you cannot build the installer and will need to set
# MY_TCLTK to use the package.
TCL_HOME = $(RHOME)/Tcl
TCL_VERSION = 85

# Define to use svnversion to set SVN-REVISION (slow, and requires a clean
# checkout with no modifications).
# USE_SVNVERSION = YES

# We normally link against DLLs, but this macro forces the use of import libs
# Needed if using other compilers, including Mingw64
# We normally link directly against DLLs,
# but this macro forces the use of import libs
# Needed if using other compilers, including _some_ versions of Mingw64
# USE_IMPLIBS = YES

# Some of the Mingw64 compilers are in fact cross-compilers and have prefixes
# Some of the 64-bit compilers are in fact cross-compilers and have prefixes
BINPREF=

# 32- or 64-bit Windows? For experiments with Mingw64.
# 32- or 64-bit Windows? For MinGW-w64.
WIN=32
ifeq ($(strip $(WIN)),64)
USE_IMPLIBS = YES
Expand All @@ -58,7 +61,7 @@ ICU_PATH=/sources/icu

## ====== configuration macros for building installer ===========

# location where Inno Setup 5.[123].x was installed. Spaces allowed.
# location where Inno Setup 5.3.x was installed. Spaces allowed.
ISDIR=C:/packages/Inno

## ====== configuration macros for building MSI installer ===========
Expand All @@ -70,14 +73,13 @@ WIXDIR=C:/packages/WiX

## c99 would force __STRICT_ANSI__ disabling strdup etc, and also alloca
C99FLAG=-std=gnu99
## for mingw-runtime <= 3.11
# C99FLAG=-std=gnu99 -fgnu89-inline

ifeq ($(strip $(BUILD)),GCC4)
F77=$(BINPREF)gfortran$(GCC4_SUFF)
FLIBS=-lgfortran
## for mingw-runtime <= 3.11
# C99FLAG=-std=gnu99 -fgnu89-inline
## earlier Rtools needs -sjlj
## an alternative is -dw2, which currently fails building R.
## earlier Rtools needs -sjlj; the alternative is -dw2, which fails building R.
GCC4_SUFF=
endif

Expand Down
7 changes: 2 additions & 5 deletions src/gnuwin32/bitmap/Makefile
@@ -1,6 +1,6 @@
## These can be overridden in MkRules

## must be jpeg-6b or jpeg-7
## must be jpeg-6b or jpeg-7 or jpeg-8
JPEGDIR = jpeg-7
PNGDIR = libpng
TIFFDIR = libtiff
Expand All @@ -23,16 +23,13 @@ buildzlib:
## Neither the makefile.{mingw,std} build pnggccrd.c but it is needed if
## the compiler defines __MMX__ , which the win64 gcc does.
## So we need to explicitly disable it.
## prefix=foo shuts up a warning
buildpng:
@$(MAKE) CC='$(CC)' \
CFLAGS="-O3 -I../../../extra/zlib -DPNG_NO_MMX_CODE" \
RANLIB=$(RANLIB) ZLIBLIB=../../../extra/zlib -C $(PNGDIR) \
-f scripts/makefile.std libpng.a

# jconfig.h and Makefile obtained running 'CC="gcc -mno-cygwin" ./configure'
# under CYGWIN. They are here since the configure script doesn't run
# (I suspect) using the reduced set of tools we distribute.
## 2006-01-15 checked under current tools
buildjpeg: $(JPEGDIR)/jconfig.h Makefile.jpeg
$(MAKE) CC='$(CC)' AR='$(AR) rc' RANLIB=$(RANLIB) JPEGDIR=$(JPEGDIR) -C $(JPEGDIR) \
-f ../Makefile.jpeg libjpeg.a
Expand Down
28 changes: 18 additions & 10 deletions src/gnuwin32/bitmap/Makefile.jpeg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/gnuwin32/bitmap/Makefile.tiff
@@ -1,4 +1,5 @@
#-*- Makefile -*-
## may be overridden in MkRules
JPEGDIR = jpeg-7
include ../../MkRules

Expand Down
11 changes: 10 additions & 1 deletion src/gnuwin32/bitmap/rbitmap.c
Expand Up @@ -65,7 +65,11 @@
static void my_png_error(png_structp png_ptr, png_const_charp msg)
{
R_ShowMessage((char *) msg);
#if PNG_LIBPNG_VER < 10400
longjmp(png_ptr->jmpbuf,1);
#else
longjmp(png_jmpbuf(png_ptr),1);
#endif
}

static void my_png_warning(png_structp png_ptr, png_const_charp msg)
Expand Down Expand Up @@ -115,7 +119,12 @@ int R_SaveAsPng(void *d, int width, int height,
/* Set error handling. REQUIRED if you aren't supplying your own
* error handling functions in the png_create_write_struct() call.
*/
if (setjmp(png_ptr->jmpbuf)) {
#if PNG_LIBPNG_VER < 10400
if (setjmp(png_ptr->jmpbuf))
#else
if (setjmp(png_jmpbuf(png_ptr)))
#endif
{
/* If we get here, we had a problem writing the file */
free(scanline);
png_destroy_write_struct(&png_ptr, &info_ptr);
Expand Down

0 comments on commit a142402

Please sign in to comment.