From dc9e59887746e69ff07b6d144b41f738dcbc9f01 Mon Sep 17 00:00:00 2001 From: Luigi Scarso <luigi.scarso@gmail.com> Date: Wed, 8 Mar 2017 16:12:21 +0000 Subject: [PATCH] cairo and pixman outside mp core. --- source/texk/web2c/luatexdir/lua/mplibstuff.w | 29 ++++++++++++++++ source/texk/web2c/mplibdir/am/libmplib.am | 7 ++-- source/texk/web2c/mplibdir/mp.w | 35 +++++++++++++++----- source/texk/web2c/mplibdir/pngout.w | 3 ++ 4 files changed, 62 insertions(+), 12 deletions(-) diff --git a/source/texk/web2c/luatexdir/lua/mplibstuff.w b/source/texk/web2c/luatexdir/lua/mplibstuff.w index 1271044d7..3104a2870 100644 --- a/source/texk/web2c/luatexdir/lua/mplibstuff.w +++ b/source/texk/web2c/luatexdir/lua/mplibstuff.w @@ -62,3 +62,32 @@ void mp_svg_backend_free (void *mp) {return;} /* int mp_svg_ship_out (void *hh, int prologues) {mplibstuff_message(svg);return 1;} int mp_svg_gr_ship_out (void *hh, int qprologues, int standalone) {mplibstuff_message(svg);return 1;} +@ @c +const char* +cairo_version_string (void); +const char* +pixman_version_string (void); +#define CAIRO_VERSION_STRING "CAIRO NOT AVAILABLE" +const char *COMPILED_CAIRO_VERSION_STRING = CAIRO_VERSION_STRING; +#define PIXMAN_VERSION_STRING "PIXMAN NOT AVAILABLE" +const char *COMPILED_PIXMAN_VERSION_STRING = PIXMAN_VERSION_STRING; + +const char* +cairo_version_string (void) +{ + return CAIRO_VERSION_STRING; +} + +const char* +pixman_version_string (void) +{ + return PIXMAN_VERSION_STRING; +} + + + + + +@ @c +char png_libpng_ver[] = "PNG NOT AVAILABLE"; + diff --git a/source/texk/web2c/mplibdir/am/libmplib.am b/source/texk/web2c/mplibdir/am/libmplib.am index afe805760..238131b42 100644 --- a/source/texk/web2c/mplibdir/am/libmplib.am +++ b/source/texk/web2c/mplibdir/am/libmplib.am @@ -10,8 +10,9 @@ EXTRA_LIBRARIES += libmplibcore.a libmplibbackends.a libmplib_a_CPPFLAGS = $(MPFR_INCLUDES) $(GMP_INCLUDES) $(CAIRO_INCLUDES) $(PIXMAN_INCLUDES) \ $(LIBPNG_INCLUDES) $(ZLIB_INCLUDES) $(AM_CPPFLAGS) -I$(srcdir)/mplibdir -libmplibcore_a_CPPFLAGS = $(libmplib_a_CPPFLAGS) -libmplibbackends_a_CPPFLAGS = $(libmplib_a_CPPFLAGS) +libmplibcore_a_CPPFLAGS = $(MPFR_INCLUDES) $(GMP_INCLUDES) $(LIBPNG_INCLUDES) $(ZLIB_INCLUDES) $(AM_CPPFLAGS) -I$(srcdir)/mplibdir +libmplibbackends_a_CPPFLAGS = $(MPFR_INCLUDES) $(GMP_INCLUDES) $(CAIRO_INCLUDES) $(PIXMAN_INCLUDES) \ + $(LIBPNG_INCLUDES) $(ZLIB_INCLUDES) $(AM_CPPFLAGS) -I$(srcdir)/mplibdir ## libmplib C sources core + backends nodist_libmplibcore_a_SOURCES = tfmin.c $(mp_c_h) $(mpmath_c_h) $(mpmathbinary_c_h) $(mpmathdecimal_c_h) \ @@ -88,7 +89,7 @@ libmplib_web += mplibdir/mpmathdouble.w mplibdir/mpstrings.w mplibdir/tfmin.w ## core need headers backends $(nodist_libmplibcore_a_SOURCES): $(svgout_c_h) $(pngout_c_h) -$(libmplibcore_a_OBJECTS): $(nodist_libmplibcore_a_SOURCES) $(KPATHSEA_DEPEND) $(CAIRO_DEPEND) $(MPFR_DEPEND) +$(libmplibcore_a_OBJECTS): $(nodist_libmplibcore_a_SOURCES) $(KPATHSEA_DEPEND) $(MPFR_DEPEND) $(libmplibbackends_a_OBJECTS): $(nodist_libmplibbackends_a_SOURCES) $(KPATHSEA_DEPEND) $(CAIRO_DEPEND) $(MPFR_DEPEND) diff --git a/source/texk/web2c/mplibdir/mp.w b/source/texk/web2c/mplibdir/mp.w index ec6e0d66c..df07b889e 100644 --- a/source/texk/web2c/mplibdir/mp.w +++ b/source/texk/web2c/mplibdir/mp.w @@ -1,4 +1,4 @@ -% $Id: mp.w 2115 2017-02-01 13:56:12Z luigi $ +% $Id: mp.w 2124 2017-03-08 13:15:13Z luigi $ % % This file is part of MetaPost; % the MetaPost program is in the public domain. @@ -176,18 +176,18 @@ static int DEBUGENVELOPECOUNTER=0; #include <time.h> /* for struct tm \& co */ #include <zlib.h> /* for |ZLIB_VERSION|, zlibVersion() */ #include <png.h> /* for |PNG_LIBPNG_VER_STRING|, |png_libpng_ver| */ -#include <pixman.h> /* for |PIXMAN_VERSION_STRING|, |pixman_version_string()| */ -#include <cairo.h> /* for |CAIRO_VERSION_STRING|, |cairo_version_string()| */ +/*\#include <pixman.h>*/ /* for |PIXMAN_VERSION_STRING|, |pixman_version_string()| */ +/*\#include <cairo.h>*/ /* for |CAIRO_VERSION_STRING|, |cairo_version_string()| */ #include <gmp.h> /* for |gmp_version| */ #include <mpfr.h> /* for |MPFR_VERSION_STRING|, |mpfr_get_version()| */ #include "mplib.h" #include "mplibps.h" /* external header */ -#include "mplibsvg.h" /* external header */ -#include "mplibpng.h" /* external header */ +/*\#include "mplibsvg.h" */ /* external header */ +/*\#include "mplibpng.h" */ /* external header */ #include "mpmp.h" /* internal header */ #include "mppsout.h" /* internal header */ -#include "mpsvgout.h" /* internal header */ -#include "mppngout.h" /* internal header */ +/*\#include "mpsvgout.h"*/ /* internal header */ +/*\#include "mppngout.h"*/ /* internal header */ #include "mpmath.h" /* internal header */ #include "mpmathdouble.h" /* internal header */ #include "mpmathdecimal.h" /* internal header */ @@ -202,7 +202,24 @@ mp_number ueps_ap; /* epsilon for above approximations */ boolean is_dxdy, is_dxindyin; /* END PATCH */ +@ We move the {\tt cairo} and {\tt pixman} libraries outside {\tt mp.w}, +to minimize dependencies. +@c +extern const char *COMPILED_CAIRO_VERSION_STRING; +extern const char* cairo_version_string (void); +extern const char *COMPILED_PIXMAN_VERSION_STRING; +extern const char* pixman_version_string (void); +extern void mp_png_backend_initialize (MP mp); +extern void mp_png_backend_free (MP mp); +extern int mp_png_gr_ship_out (void *hh, const char *options, int standalone); +extern int mp_png_ship_out (void *hh, const char *options); +extern void mp_svg_backend_initialize (MP mp); +extern void mp_svg_backend_free (MP mp); +extern int mp_svg_ship_out (mp_edge_object *hh, int prologues); +extern int mp_svg_gr_ship_out (mp_edge_object *hh, int prologues, int standalone); + +@ @c extern font_number mp_read_font_info (MP mp, char *fname); /* tfmin.w */ @h @<Declarations@>; @<Basic printing procedures@>; @@ -30652,8 +30669,8 @@ char *mp_metapost_version (void) { return mp_strdup (metapost_version); } void mp_show_library_versions (void) { - fprintf(stdout, "Compiled with cairo %s; using %s\n", CAIRO_VERSION_STRING, cairo_version_string()); - fprintf(stdout, "Compiled with pixman %s; using %s\n", PIXMAN_VERSION_STRING, pixman_version_string()); + fprintf(stdout, "Compiled with cairo %s; using %s\n", COMPILED_CAIRO_VERSION_STRING, cairo_version_string()); + fprintf(stdout, "Compiled with pixman %s; using %s\n",COMPILED_PIXMAN_VERSION_STRING, pixman_version_string()); fprintf(stdout, "Compiled with libpng %s; using %s\n", PNG_LIBPNG_VER_STRING, png_libpng_ver); fprintf(stdout, "Compiled with zlib %s; using %s\n", ZLIB_VERSION, zlibVersion()); fprintf(stdout, "Compiled with mpfr %s; using %s\n", MPFR_VERSION_STRING, mpfr_get_version()); diff --git a/source/texk/web2c/mplibdir/pngout.w b/source/texk/web2c/mplibdir/pngout.w index b42bf7b32..742522c2f 100644 --- a/source/texk/web2c/mplibdir/pngout.w +++ b/source/texk/web2c/mplibdir/pngout.w @@ -79,6 +79,9 @@ properly. That is |typedef struct pngout_data_struct * pngout_data|. #ifndef MPPNGOUT_H #define MPPNGOUT_H 1 #include "cairo.h" +const char *COMPILED_CAIRO_VERSION_STRING = CAIRO_VERSION_STRING; +#include "pixman.h" +const char *COMPILED_PIXMAN_VERSION_STRING = PIXMAN_VERSION_STRING; #define PNG_SKIP_SETJMP_CHECK 1 #include "png.h" #include "mplib.h" -- GitLab