From 91e3606954f8c78c1733b2bf2a8e2a52e897a743 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Wed, 24 Feb 2010 17:02:43 +0000 Subject: MinGW build for dvipng git-svn-id: svn://tug.org/texlive/trunk@17184 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dvipng/ChangeLog | 5 + Build/source/texk/dvipng/configure | 45 ++++-- Build/source/texk/dvipng/configure.ac | 4 + .../texk/dvipng/dvipng-1.12-PATCHES/ChangeLog | 7 + .../dvipng/dvipng-1.12-PATCHES/patch-06-mathptmx | 11 ++ .../dvipng-1.12-PATCHES/patch-10-mmap-for-WIN32 | 119 +++++++++++++++ .../patch-11-win32-fork-and-pipe | 165 +++++++++++++++++++++ Build/source/texk/dvipng/dvipng-1.12/ChangeLog | 12 ++ Build/source/texk/dvipng/dvipng-1.12/dvipng.h | 6 +- Build/source/texk/dvipng/dvipng-1.12/font.c | 12 +- Build/source/texk/dvipng/dvipng-1.12/misc.c | 14 +- Build/source/texk/dvipng/dvipng-1.12/special.c | 78 +++++++++- Build/source/texk/dvipng/help/Makefile.am | 10 +- Build/source/texk/dvipng/help/Makefile.in | 16 +- .../patch-50-reorg-alphabets | 2 +- 15 files changed, 459 insertions(+), 47 deletions(-) create mode 100644 Build/source/texk/dvipng/dvipng-1.12-PATCHES/patch-10-mmap-for-WIN32 create mode 100644 Build/source/texk/dvipng/dvipng-1.12-PATCHES/patch-11-win32-fork-and-pipe diff --git a/Build/source/texk/dvipng/ChangeLog b/Build/source/texk/dvipng/ChangeLog index fe937349f88..ff1e5a6fb3b 100644 --- a/Build/source/texk/dvipng/ChangeLog +++ b/Build/source/texk/dvipng/ChangeLog @@ -1,3 +1,8 @@ +2010-02-24 Peter Breitenlohner + + * configure.ac, help/Makefile.am: Do not even try to rebuild + doc/dvipng.help when cross compiling. + 2010-02-02 Peter Breitenlohner * configure.ac: Fix 'on demand' build. diff --git a/Build/source/texk/dvipng/configure b/Build/source/texk/dvipng/configure index bc9393b0e16..804d459b4fa 100755 --- a/Build/source/texk/dvipng/configure +++ b/Build/source/texk/dvipng/configure @@ -787,6 +787,8 @@ POW_LIB LIBOBJS ALLOCA GS +cross_FALSE +cross_TRUE WARNING_CFLAGS CPP OTOOL64 @@ -4747,13 +4749,13 @@ if test "${lt_cv_nm_interface+set}" = set; then : else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:4750: $ac_compile\"" >&5) + (eval echo "\"\$as_me:4752: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:4753: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:4755: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:4756: output\"" >&5) + (eval echo "\"\$as_me:4758: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -5956,7 +5958,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5959 "configure"' > conftest.$ac_ext + echo '#line 5961 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7886,11 +7888,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7889: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7891: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7893: \$? = $ac_status" >&5 + echo "$as_me:7895: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8225,11 +8227,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8228: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8230: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8232: \$? = $ac_status" >&5 + echo "$as_me:8234: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8330,11 +8332,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8333: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8335: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8337: \$? = $ac_status" >&5 + echo "$as_me:8339: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8385,11 +8387,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8388: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8390: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8392: \$? = $ac_status" >&5 + echo "$as_me:8394: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10752,7 +10754,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10755 "configure" +#line 10757 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10848,7 +10850,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10851 "configure" +#line 10853 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11961,6 +11963,17 @@ fi + + + if test "x$cross_compiling" = xyes; then + cross_TRUE= + cross_FALSE='#' +else + cross_TRUE='#' + cross_FALSE= +fi + + if test "x$enable_debug" != xno; then enable_debug=yes @@ -15722,6 +15735,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${cross_TRUE}" && test -z "${cross_FALSE}"; then + as_fn_error "conditional \"cross\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${have_t1_TRUE}" && test -z "${have_t1_FALSE}"; then as_fn_error "conditional \"have_t1\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/Build/source/texk/dvipng/configure.ac b/Build/source/texk/dvipng/configure.ac index 99cbf09632f..8d6db35beac 100644 --- a/Build/source/texk/dvipng/configure.ac +++ b/Build/source/texk/dvipng/configure.ac @@ -25,6 +25,10 @@ KPSE_COMMON([dvipng]) # Configure options for dvipng also shown at the TeX Live top-level. m4_include([ac/dvipng.ac]) +AC_CANONICAL_HOST + +AM_CONDITIONAL([cross], [test "x$cross_compiling" = xyes]) + if test "x$enable_debug" != xno; then enable_debug=yes AC_DEFINE([DEBUG], 1, [Define as 1 to get the debug (-d) option.]) diff --git a/Build/source/texk/dvipng/dvipng-1.12-PATCHES/ChangeLog b/Build/source/texk/dvipng/dvipng-1.12-PATCHES/ChangeLog index 486dad3f1ae..f076d87063a 100644 --- a/Build/source/texk/dvipng/dvipng-1.12-PATCHES/ChangeLog +++ b/Build/source/texk/dvipng/dvipng-1.12-PATCHES/ChangeLog @@ -1,3 +1,10 @@ +2010-02-24 Peter Breitenlohner + + * patch-10-mmap-for-WIN32 (new): Former MIKTEX code for mmap + from Fabrice Popineau (?) now used for all WIN32 variants. + * patch-11-win32-fork-and-pipe (new): WIN32 specific replacement + for fork and pipe, using code from Akira Kakuto. + 2010-02-21 Peter Breitenlohner * patch-07-always-undef (new): Always undefine min/max before diff --git a/Build/source/texk/dvipng/dvipng-1.12-PATCHES/patch-06-mathptmx b/Build/source/texk/dvipng/dvipng-1.12-PATCHES/patch-06-mathptmx index a4256949735..a14aa360cad 100644 --- a/Build/source/texk/dvipng/dvipng-1.12-PATCHES/patch-06-mathptmx +++ b/Build/source/texk/dvipng/dvipng-1.12-PATCHES/patch-06-mathptmx @@ -1,3 +1,14 @@ +diff -ur dvipng-1.12.orig/ChangeLog dvipng-1.12/ChangeLog +--- dvipng-1.12.orig/ChangeLog 2009-03-18 20:02:23.000000000 +0100 ++++ dvipng-1.12/ChangeLog 2010-02-21 19:15:27.000000000 +0100 +@@ -1,3 +1,7 @@ ++2010-01-29 Karl Berry ++ ++ * test_dvipng.tex: Do not use \usepackage{mathptmx}. ++ + 2009-02-23 Jan-Ake Larsson + + * Release 1.12 diff -ur dvipng-1.12.orig/test_dvipng.tex dvipng-1.12/test_dvipng.tex --- dvipng-1.12.orig/test_dvipng.tex 2008-02-08 14:45:23.000000000 +0100 +++ dvipng-1.12/test_dvipng.tex 2010-01-29 01:21:38.000000000 +0100 diff --git a/Build/source/texk/dvipng/dvipng-1.12-PATCHES/patch-10-mmap-for-WIN32 b/Build/source/texk/dvipng/dvipng-1.12-PATCHES/patch-10-mmap-for-WIN32 new file mode 100644 index 00000000000..b55484bd288 --- /dev/null +++ b/Build/source/texk/dvipng/dvipng-1.12-PATCHES/patch-10-mmap-for-WIN32 @@ -0,0 +1,119 @@ + In these cases the MIKTEX code is generic for WIN32. + +diff -ur dvipng-1.12.orig/dvipng.h dvipng-1.12/dvipng.h +--- dvipng-1.12.orig/dvipng.h 2010-02-20 18:20:53.000000000 +0100 ++++ dvipng-1.12/dvipng.h 2010-02-24 15:15:02.318707946 +0100 +@@ -208,12 +208,12 @@ + /********************************************************/ + + struct filemmap { +-#ifdef MIKTEX ++#ifdef WIN32 + HANDLE hFile; + HANDLE hMap; +-#else /* MIKTEX */ ++#else /* WIN32 */ + int fd; +-#endif /* MIKTEX */ ++#endif /* WIN32 */ + char* data; + size_t size; + }; +diff -ur dvipng-1.12.orig/font.c dvipng-1.12/font.c +--- dvipng-1.12.orig/font.c 2009-06-09 12:40:10.000000000 +0200 ++++ dvipng-1.12/font.c 2010-02-24 15:15:03.130693002 +0100 +@@ -161,9 +161,9 @@ + tfontptr->next = hfontptr; + hfontptr = tfontptr; + tfontnump->fontp = tfontptr; +-#ifndef MIKTEX ++#ifndef WIN32 + tfontptr->fmmap.fd = 0; +-#else /* MIKTEX */ ++#else /* WIN32 */ + tfontptr->fmmap.hFile = INVALID_HANDLE_VALUE; + #endif + tfontptr->c = c; /* checksum */ +@@ -268,9 +268,9 @@ + Warning("font %s at %d dpi not found, characters will be left blank", + tfontptr->n, tfontptr->dpi); + strcpy (tfontptr->name, "None"); +-#ifndef MIKTEX ++#ifndef WIN32 + tfontptr->fmmap.fd = 0; +-#else /* MIKTEX */ ++#else /* WIN32 */ + tfontptr->fmmap.hFile = INVALID_HANDLE_VALUE; + #endif + tfontptr->magnification = 0; +@@ -287,9 +287,9 @@ + false, + 0))) { + Warning(tfontptr->name); /* contains error messsage */ +-#ifndef MIKTEX ++#ifndef WIN32 + tfontptr->fmmap.fd = 0; +-#else /* MIKTEX */ ++#else /* WIN32 */ + tfontptr->fmmap.hFile = INVALID_HANDLE_VALUE; + #endif + #ifdef __riscos +diff -ur dvipng-1.12.orig/misc.c dvipng-1.12/misc.c +--- dvipng-1.12.orig/misc.c 2010-02-20 18:38:56.000000000 +0100 ++++ dvipng-1.12/misc.c 2010-02-24 15:15:05.838643539 +0100 +@@ -752,13 +752,13 @@ + + bool MmapFile (char *filename,struct filemmap *fmmap) + { +-#ifndef MIKTEX ++#ifndef WIN32 + struct stat stat; + #endif + + DEBUG_PRINT(DEBUG_DVI,("\n OPEN FILE:\t'%s'", filename)); + fmmap->data=NULL; +-#ifndef MIKTEX ++#ifndef WIN32 + if ((fmmap->fd = open(filename,O_RDONLY)) == -1) { + Warning("cannot open file <%s>", filename); + return(true); +@@ -789,7 +789,7 @@ + } + close(fmmap->fd); + # endif /* HAVE_MMAP */ +-#else /* MIKTEX */ ++#else /* WIN32 */ + fmmap->hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, 0, + OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, 0); + if (fmmap->hFile == INVALID_HANDLE_VALUE) { +@@ -810,14 +810,14 @@ + CloseHandle (fmmap->hFile); + return(true); + } +-#endif /* MIKTEX */ ++#endif /* WIN32 */ + return(false); + } + + void UnMmapFile(struct filemmap* fmmap) + { + if (fmmap->data!=NULL) { +-#ifndef MIKTEX ++#ifndef WIN32 + # ifdef HAVE_MMAP + if (munmap(fmmap->data,fmmap->size)) + Warning("cannot munmap file at 0x%X",fmmap->data); +@@ -826,11 +826,11 @@ + # else /* HAVE_MMAP */ + free(fmmap->data); + # endif /* HAVE_MMAP */ +-#else /* MIKTEX */ ++#else /* WIN32 */ + UnmapViewOfFile (fmmap->data); + CloseHandle (fmmap->hMap); + CloseHandle (fmmap->hFile); +-#endif /* MIKTEX */ ++#endif /* WIN32 */ + } + fmmap->data=NULL; + } diff --git a/Build/source/texk/dvipng/dvipng-1.12-PATCHES/patch-11-win32-fork-and-pipe b/Build/source/texk/dvipng/dvipng-1.12-PATCHES/patch-11-win32-fork-and-pipe new file mode 100644 index 00000000000..89e88605690 --- /dev/null +++ b/Build/source/texk/dvipng/dvipng-1.12-PATCHES/patch-11-win32-fork-and-pipe @@ -0,0 +1,165 @@ +diff -ur dvipng-1.12.orig/ChangeLog dvipng-1.12/ChangeLog +--- dvipng-1.12.orig/ChangeLog 2010-02-21 19:15:27.000000000 +0100 ++++ dvipng-1.12/ChangeLog 2010-02-24 17:29:02.816848864 +0100 +@@ -1,3 +1,15 @@ ++2010-02-24 Peter Breitenlohner ++ ++ Support WIN32 builds (native or MinGW32). ++ * dvipng.h (min, max): Always undefine before defining. ++ * dvi.c: For WIN32 use Sleep(1000) instead of sleeep(1). ++ * misc.c: #include depends on HAVE_MMAP. ++ * dvipng.h, font.c, misc.c: For mmap code use '#ifdef WIN32' ++ instead of '#ifdef MIKTEX'. ++ ++ * special.c: WIN32 specific replacement for fork and pipe, using ++ code from Akira Kakuto, (e-mail from 23 Feb 2010 23:33:58). ++ + 2010-01-29 Karl Berry + + * test_dvipng.tex: Do not use \usepackage{mathptmx}. +diff -ur dvipng-1.12.orig/special.c dvipng-1.12/special.c +--- dvipng-1.12.orig/special.c 2009-10-01 14:43:06.000000000 +0200 ++++ dvipng-1.12/special.c 2010-02-24 16:10:10.080005933 +0100 +@@ -24,6 +24,15 @@ + + #include "dvipng.h" + ++#ifndef MIKTEX ++#ifdef WIN32 ++#include ++#include ++#include ++#define snprintf _snprintf ++#endif /* WIN32 */ ++#endif ++ + #define SKIPSPACES(s) while(s && *s==' ' && *s!='\0') s++ + + /* PostScript can come as a string (headers and raw specials) or +@@ -132,13 +141,19 @@ + + + static gdImagePtr +-ps2png(struct pscode* pscodep, const char *device, int hresolution, int vresolution, ++ps2png(struct pscode* pscodep, const char *device, int hresolution, int vresolution, + int llx, int lly, int urx, int ury, int bgred, int bggreen, int bgblue) + { + #ifndef MIKTEX + int downpipe[2], uppipe[2]; ++#ifdef WIN32 ++ int nexitcode = STILL_ACTIVE; ++ HANDLE hchild; ++ int savestdin, savestdout; ++#else /* !WIN32 */ + pid_t pid; +-#else ++#endif /* !WIN32 */ ++#else /* MIKTEX */ + HANDLE hPngStream; + HANDLE hPsStream; + HANDLE hStdErr; +@@ -147,7 +162,7 @@ + _TCHAR szGsPath[_MAX_PATH]; + #define GS_PATH szGsPath + int fd; +-#endif ++#endif /* MIKTEX */ + FILE *psstream=NULL, *pngstream=NULL; + char resolution[STRSIZE]; + /* char devicesize[STRSIZE]; */ +@@ -170,6 +185,7 @@ + (option_flags & NO_GSSAFER) ? "-": "-dSAFER", + (option_flags & NO_GSSAFER) ? "": "- ")); + #ifndef MIKTEX ++#ifndef WIN32 + if (pipe(downpipe) || pipe(uppipe)) return(NULL); + /* Ready to fork */ + pid = fork (); +@@ -187,18 +203,51 @@ + (option_flags & NO_GSSAFER) ? NULL: "-", + NULL); + _exit (EXIT_FAILURE); ++#else /* WIN32 */ ++ if (_pipe(downpipe, 65536, O_BINARY | _O_NOINHERIT)==-1 || ++ _pipe(uppipe, 65536, O_BINARY | _O_NOINHERIT)==-1) { ++ fprintf(stderr, "Pipe error.\n"); ++ return NULL; ++#endif /* WIN32 */ + } + /* Parent process. */ +- ++#ifdef WIN32 ++ savestdin = _dup(fileno(stdin)); ++ _dup2(downpipe[0], fileno(stdin)); ++#endif /* WIN32 */ + close(downpipe[0]); ++#ifdef WIN32 ++ savestdout = _dup(fileno(stdout)); ++ _dup2(uppipe[1], fileno(stdout)); ++ close(uppipe[1]); ++#endif /* WIN32 */ + psstream=fdopen(downpipe[1],"wb"); + /* fclose(psstream); psstream=fopen("test.ps","wb"); */ ++#ifndef WIN32 + if (psstream == NULL) + close(downpipe[1]); + close(uppipe[1]); + pngstream=fdopen(uppipe[0],"rb"); + if (pngstream == NULL) + close(uppipe[0]); ++#else /* WIN32 */ ++ if (psstream == NULL) { ++ fprintf(stderr, "psstream == NULL\n"); ++ close(downpipe[1]); ++ } ++ pngstream=fdopen(uppipe[0],"rb"); ++ if (pngstream == NULL) { ++ fprintf(stderr, "pngstream == NULL\n"); ++ close(uppipe[0]); ++ } ++ hchild=(HANDLE)spawnlp(_P_NOWAIT, GS_PATH, GS_PATH, device, resolution, ++ "-dBATCH", "-dNOPAUSE", "-q", "-sOutputFile=-", ++ "-dTextAlphaBits=4", "-dGraphicsAlphaBits=4", ++ (option_flags & NO_GSSAFER) ? "-": "-dSAFER", ++ (option_flags & NO_GSSAFER) ? NULL : "-", NULL); ++ ++ if(hchild) { ++#endif /* WIN32 */ + #else /* MIKTEX */ + if (! miktex_find_miktex_executable("mgs.exe", szGsPath)) { + Warning("Ghostscript could not be found"); +@@ -228,7 +277,7 @@ + if (pngstream == NULL) + _close (fd); + } +-#endif ++#endif /* MIKTEX */ + if (psstream) { + writepscode(psheaderp,psstream); + DEBUG_PRINT(DEBUG_GS,("\n PS CODE:\t<>setpagedevice", +@@ -254,7 +303,24 @@ + } + #ifdef MIKTEX + CloseHandle(pi.hProcess); +-#endif ++#else /* !MIKTEX */ ++#ifdef WIN32 ++ } ++ while(nexitcode == STILL_ACTIVE) ++ GetExitCodeProcess((HANDLE)hchild, (unsigned long*)&nexitcode); ++ ++ CloseHandle((HANDLE)hchild); ++ _dup2(savestdin, fileno(stdin)); ++ _dup2(savestdout, fileno(stdout)); ++ close(savestdin); ++ close(savestdout); ++ close(uppipe[0]); ++ close(uppipe[1]); ++ close(downpipe[0]); ++ close(downpipe[1]); ++#endif /* WIN32 */ ++#endif /* !MIKTEX */ ++ + if (psimage == NULL) { + DEBUG_PRINT(DEBUG_GS,("\n GS OUTPUT:\tNO IMAGE ")); + if (!showpage) { diff --git a/Build/source/texk/dvipng/dvipng-1.12/ChangeLog b/Build/source/texk/dvipng/dvipng-1.12/ChangeLog index 801f60aaae0..be4403114cd 100644 --- a/Build/source/texk/dvipng/dvipng-1.12/ChangeLog +++ b/Build/source/texk/dvipng/dvipng-1.12/ChangeLog @@ -1,3 +1,15 @@ +2010-02-24 Peter Breitenlohner + + Support WIN32 builds (native or MinGW32). + * dvipng.h (min, max): Always undefine before defining. + * dvi.c: For WIN32 use Sleep(1000) instead of sleeep(1). + * misc.c: #include depends on HAVE_MMAP. + * dvipng.h, font.c, misc.c: For mmap code use '#ifdef WIN32' + instead of '#ifdef MIKTEX'. + + * special.c: WIN32 specific replacement for fork and pipe, using + code from Akira Kakuto, (e-mail from 23 Feb 2010 23:33:58). + 2010-01-29 Karl Berry * test_dvipng.tex: Do not use \usepackage{mathptmx}. diff --git a/Build/source/texk/dvipng/dvipng-1.12/dvipng.h b/Build/source/texk/dvipng/dvipng-1.12/dvipng.h index be227501015..4afda3af34d 100644 --- a/Build/source/texk/dvipng/dvipng-1.12/dvipng.h +++ b/Build/source/texk/dvipng/dvipng-1.12/dvipng.h @@ -208,12 +208,12 @@ void ClearPSHeaders(void); /********************************************************/ struct filemmap { -#ifdef MIKTEX +#ifdef WIN32 HANDLE hFile; HANDLE hMap; -#else /* MIKTEX */ +#else /* WIN32 */ int fd; -#endif /* MIKTEX */ +#endif /* WIN32 */ char* data; size_t size; }; diff --git a/Build/source/texk/dvipng/dvipng-1.12/font.c b/Build/source/texk/dvipng/dvipng-1.12/font.c index 048395b8811..d1cadcefc22 100644 --- a/Build/source/texk/dvipng/dvipng-1.12/font.c +++ b/Build/source/texk/dvipng/dvipng-1.12/font.c @@ -161,9 +161,9 @@ void FontDef(unsigned char* command, void* parent) tfontptr->next = hfontptr; hfontptr = tfontptr; tfontnump->fontp = tfontptr; -#ifndef MIKTEX +#ifndef WIN32 tfontptr->fmmap.fd = 0; -#else /* MIKTEX */ +#else /* WIN32 */ tfontptr->fmmap.hFile = INVALID_HANDLE_VALUE; #endif tfontptr->c = c; /* checksum */ @@ -268,9 +268,9 @@ static void FontFind(struct font_entry * tfontptr) Warning("font %s at %d dpi not found, characters will be left blank", tfontptr->n, tfontptr->dpi); strcpy (tfontptr->name, "None"); -#ifndef MIKTEX +#ifndef WIN32 tfontptr->fmmap.fd = 0; -#else /* MIKTEX */ +#else /* WIN32 */ tfontptr->fmmap.hFile = INVALID_HANDLE_VALUE; #endif tfontptr->magnification = 0; @@ -287,9 +287,9 @@ static void FontFind(struct font_entry * tfontptr) false, 0))) { Warning(tfontptr->name); /* contains error messsage */ -#ifndef MIKTEX +#ifndef WIN32 tfontptr->fmmap.fd = 0; -#else /* MIKTEX */ +#else /* WIN32 */ tfontptr->fmmap.hFile = INVALID_HANDLE_VALUE; #endif #ifdef __riscos diff --git a/Build/source/texk/dvipng/dvipng-1.12/misc.c b/Build/source/texk/dvipng/dvipng-1.12/misc.c index 426407bc146..50a8578330c 100644 --- a/Build/source/texk/dvipng/dvipng-1.12/misc.c +++ b/Build/source/texk/dvipng/dvipng-1.12/misc.c @@ -752,13 +752,13 @@ void Message(int activeflags, const char *fmt, ...) bool MmapFile (char *filename,struct filemmap *fmmap) { -#ifndef MIKTEX +#ifndef WIN32 struct stat stat; #endif DEBUG_PRINT(DEBUG_DVI,("\n OPEN FILE:\t'%s'", filename)); fmmap->data=NULL; -#ifndef MIKTEX +#ifndef WIN32 if ((fmmap->fd = open(filename,O_RDONLY)) == -1) { Warning("cannot open file <%s>", filename); return(true); @@ -789,7 +789,7 @@ bool MmapFile (char *filename,struct filemmap *fmmap) } close(fmmap->fd); # endif /* HAVE_MMAP */ -#else /* MIKTEX */ +#else /* WIN32 */ fmmap->hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, 0); if (fmmap->hFile == INVALID_HANDLE_VALUE) { @@ -810,14 +810,14 @@ bool MmapFile (char *filename,struct filemmap *fmmap) CloseHandle (fmmap->hFile); return(true); } -#endif /* MIKTEX */ +#endif /* WIN32 */ return(false); } void UnMmapFile(struct filemmap* fmmap) { if (fmmap->data!=NULL) { -#ifndef MIKTEX +#ifndef WIN32 # ifdef HAVE_MMAP if (munmap(fmmap->data,fmmap->size)) Warning("cannot munmap file at 0x%X",fmmap->data); @@ -826,11 +826,11 @@ void UnMmapFile(struct filemmap* fmmap) # else /* HAVE_MMAP */ free(fmmap->data); # endif /* HAVE_MMAP */ -#else /* MIKTEX */ +#else /* WIN32 */ UnmapViewOfFile (fmmap->data); CloseHandle (fmmap->hMap); CloseHandle (fmmap->hFile); -#endif /* MIKTEX */ +#endif /* WIN32 */ } fmmap->data=NULL; } diff --git a/Build/source/texk/dvipng/dvipng-1.12/special.c b/Build/source/texk/dvipng/dvipng-1.12/special.c index 7c8a64c4a36..3af7fac1486 100644 --- a/Build/source/texk/dvipng/dvipng-1.12/special.c +++ b/Build/source/texk/dvipng/dvipng-1.12/special.c @@ -24,6 +24,15 @@ #include "dvipng.h" +#ifndef MIKTEX +#ifdef WIN32 +#include +#include +#include +#define snprintf _snprintf +#endif /* WIN32 */ +#endif + #define SKIPSPACES(s) while(s && *s==' ' && *s!='\0') s++ /* PostScript can come as a string (headers and raw specials) or @@ -132,13 +141,19 @@ static void writepscode(struct pscode* pscodep, FILE* psstream) static gdImagePtr -ps2png(struct pscode* pscodep, const char *device, int hresolution, int vresolution, +ps2png(struct pscode* pscodep, const char *device, int hresolution, int vresolution, int llx, int lly, int urx, int ury, int bgred, int bggreen, int bgblue) { #ifndef MIKTEX int downpipe[2], uppipe[2]; +#ifdef WIN32 + int nexitcode = STILL_ACTIVE; + HANDLE hchild; + int savestdin, savestdout; +#else /* !WIN32 */ pid_t pid; -#else +#endif /* !WIN32 */ +#else /* MIKTEX */ HANDLE hPngStream; HANDLE hPsStream; HANDLE hStdErr; @@ -147,7 +162,7 @@ ps2png(struct pscode* pscodep, const char *device, int hresolution, int vresolut _TCHAR szGsPath[_MAX_PATH]; #define GS_PATH szGsPath int fd; -#endif +#endif /* MIKTEX */ FILE *psstream=NULL, *pngstream=NULL; char resolution[STRSIZE]; /* char devicesize[STRSIZE]; */ @@ -170,6 +185,7 @@ ps2png(struct pscode* pscodep, const char *device, int hresolution, int vresolut (option_flags & NO_GSSAFER) ? "-": "-dSAFER", (option_flags & NO_GSSAFER) ? "": "- ")); #ifndef MIKTEX +#ifndef WIN32 if (pipe(downpipe) || pipe(uppipe)) return(NULL); /* Ready to fork */ pid = fork (); @@ -187,18 +203,51 @@ ps2png(struct pscode* pscodep, const char *device, int hresolution, int vresolut (option_flags & NO_GSSAFER) ? NULL: "-", NULL); _exit (EXIT_FAILURE); +#else /* WIN32 */ + if (_pipe(downpipe, 65536, O_BINARY | _O_NOINHERIT)==-1 || + _pipe(uppipe, 65536, O_BINARY | _O_NOINHERIT)==-1) { + fprintf(stderr, "Pipe error.\n"); + return NULL; +#endif /* WIN32 */ } /* Parent process. */ - +#ifdef WIN32 + savestdin = _dup(fileno(stdin)); + _dup2(downpipe[0], fileno(stdin)); +#endif /* WIN32 */ close(downpipe[0]); +#ifdef WIN32 + savestdout = _dup(fileno(stdout)); + _dup2(uppipe[1], fileno(stdout)); + close(uppipe[1]); +#endif /* WIN32 */ psstream=fdopen(downpipe[1],"wb"); /* fclose(psstream); psstream=fopen("test.ps","wb"); */ +#ifndef WIN32 if (psstream == NULL) close(downpipe[1]); close(uppipe[1]); pngstream=fdopen(uppipe[0],"rb"); if (pngstream == NULL) close(uppipe[0]); +#else /* WIN32 */ + if (psstream == NULL) { + fprintf(stderr, "psstream == NULL\n"); + close(downpipe[1]); + } + pngstream=fdopen(uppipe[0],"rb"); + if (pngstream == NULL) { + fprintf(stderr, "pngstream == NULL\n"); + close(uppipe[0]); + } + hchild=(HANDLE)spawnlp(_P_NOWAIT, GS_PATH, GS_PATH, device, resolution, + "-dBATCH", "-dNOPAUSE", "-q", "-sOutputFile=-", + "-dTextAlphaBits=4", "-dGraphicsAlphaBits=4", + (option_flags & NO_GSSAFER) ? "-": "-dSAFER", + (option_flags & NO_GSSAFER) ? NULL : "-", NULL); + + if(hchild) { +#endif /* WIN32 */ #else /* MIKTEX */ if (! miktex_find_miktex_executable("mgs.exe", szGsPath)) { Warning("Ghostscript could not be found"); @@ -228,7 +277,7 @@ ps2png(struct pscode* pscodep, const char *device, int hresolution, int vresolut if (pngstream == NULL) _close (fd); } -#endif +#endif /* MIKTEX */ if (psstream) { writepscode(psheaderp,psstream); DEBUG_PRINT(DEBUG_GS,("\n PS CODE:\t<>setpagedevice", @@ -254,7 +303,24 @@ ps2png(struct pscode* pscodep, const char *device, int hresolution, int vresolut } #ifdef MIKTEX CloseHandle(pi.hProcess); -#endif +#else /* !MIKTEX */ +#ifdef WIN32 + } + while(nexitcode == STILL_ACTIVE) + GetExitCodeProcess((HANDLE)hchild, (unsigned long*)&nexitcode); + + CloseHandle((HANDLE)hchild); + _dup2(savestdin, fileno(stdin)); + _dup2(savestdout, fileno(stdout)); + close(savestdin); + close(savestdout); + close(uppipe[0]); + close(uppipe[1]); + close(downpipe[0]); + close(downpipe[1]); +#endif /* WIN32 */ +#endif /* !MIKTEX */ + if (psimage == NULL) { DEBUG_PRINT(DEBUG_GS,("\n GS OUTPUT:\tNO IMAGE ")); if (!showpage) { diff --git a/Build/source/texk/dvipng/help/Makefile.am b/Build/source/texk/dvipng/help/Makefile.am index f9291eeae98..dd86b4717d1 100644 --- a/Build/source/texk/dvipng/help/Makefile.am +++ b/Build/source/texk/dvipng/help/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am for the TeX Live subdirectory texk/dvipng/help/ ## -## Copyright (C) 2009 Peter Breitenlohner +## Copyright (C) 2009, 2010 Peter Breitenlohner ## You may freely use, modify and/or distribute this file. ## DVIPNG_HELP = $(top_srcdir)/doc/dvipng.help @@ -13,13 +13,17 @@ all-local: help-stamp $(DVIPNG_HELP) $(DVIPNG_HELP): $(MAKE) $(AM_MAKEFLAGS) help-stamp help-stamp: ../dvipng$(EXEEXT) - -(cd .. && ./dvipng) | \ - sed -e's/ (dvipng) / /' -e's,/lt-dvipng ,/dvipng ,' \ +if !cross + -(cd .. && ./dvipng$(EXEEXT)) | \ + sed -e's/dvipng.exe/dvipng' \ + -e's/ (dvipng) / /' \ + -e's,/lt-dvipng ,/dvipng ,' \ -e's,^This is .*/dvipng ,This is ./dvipng ,' \ -e's,^Usage: .*/dvipng ,Usage: ./dvipng ,' > dvipng.tmp ( test -r $(DVIPNG_HELP) && diff dvipng.tmp $(DVIPNG_HELP) ) \ || cp dvipng.tmp $(DVIPNG_HELP) rm -f dvipng.tmp +endif !cross echo timestamp >$@ DISTCLEANFILES = help-stamp diff --git a/Build/source/texk/dvipng/help/Makefile.in b/Build/source/texk/dvipng/help/Makefile.in index 7f603a60fae..4202e81d543 100644 --- a/Build/source/texk/dvipng/help/Makefile.in +++ b/Build/source/texk/dvipng/help/Makefile.in @@ -398,13 +398,15 @@ all-local: help-stamp $(DVIPNG_HELP) $(DVIPNG_HELP): $(MAKE) $(AM_MAKEFLAGS) help-stamp help-stamp: ../dvipng$(EXEEXT) - -(cd .. && ./dvipng) | \ - sed -e's/ (dvipng) / /' -e's,/lt-dvipng ,/dvipng ,' \ - -e's,^This is .*/dvipng ,This is ./dvipng ,' \ - -e's,^Usage: .*/dvipng ,Usage: ./dvipng ,' > dvipng.tmp - ( test -r $(DVIPNG_HELP) && diff dvipng.tmp $(DVIPNG_HELP) ) \ - || cp dvipng.tmp $(DVIPNG_HELP) - rm -f dvipng.tmp +@cross_FALSE@ -(cd .. && ./dvipng$(EXEEXT)) | \ +@cross_FALSE@ sed -e's/dvipng.exe/dvipng' \ +@cross_FALSE@ -e's/ (dvipng) / /' \ +@cross_FALSE@ -e's,/lt-dvipng ,/dvipng ,' \ +@cross_FALSE@ -e's,^This is .*/dvipng ,This is ./dvipng ,' \ +@cross_FALSE@ -e's,^Usage: .*/dvipng ,Usage: ./dvipng ,' > dvipng.tmp +@cross_FALSE@ ( test -r $(DVIPNG_HELP) && diff dvipng.tmp $(DVIPNG_HELP) ) \ +@cross_FALSE@ || cp dvipng.tmp $(DVIPNG_HELP) +@cross_FALSE@ rm -f dvipng.tmp echo timestamp >$@ # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-50-reorg-alphabets b/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-50-reorg-alphabets index 3aee7deff38..c44a752cfca 100644 --- a/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-50-reorg-alphabets +++ b/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-50-reorg-alphabets @@ -12,7 +12,7 @@ ======== - Drop unused files (from TL2008 amd more). + Drop unused files (from TL2008 and more). diff -ur -x Makefile.in -x autom4te.cache xindy.orig/configure.ac xindy/configure.ac --- xindy.orig/configure.ac 2009-12-03 11:59:47.000000000 +0100 -- cgit v1.2.3