From 2284673490ec156d2ae71ef8aa9055f6ceca718e Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Mon, 10 Apr 2017 04:42:06 +0000 Subject: [PATCH] mupdf: gcc2 fixes --- app-text/mupdf/mupdf-1.8.recipe | 7 +- .../{mupdf-1.8.patch => mupdf-1.8.patchset} | 189 ++++++++++++------ 2 files changed, 131 insertions(+), 65 deletions(-) rename app-text/mupdf/patches/{mupdf-1.8.patch => mupdf-1.8.patchset} (51%) diff --git a/app-text/mupdf/mupdf-1.8.recipe b/app-text/mupdf/mupdf-1.8.recipe index 125f3e700..8f9785c3d 100644 --- a/app-text/mupdf/mupdf-1.8.recipe +++ b/app-text/mupdf/mupdf-1.8.recipe @@ -10,14 +10,11 @@ reads XPS/OpenXPS documents and CBZ (Comic Book archive) files." HOMEPAGE="http://www.mupdf.com/" COPYRIGHT="2006-2015 Artifex Software, Inc" LICENSE="AGPL-3.0" -REVISION="1" +REVISION="2" SOURCE_URI="http://www.mupdf.com/downloads/archive/mupdf-$portVersion-source.tar.gz" CHECKSUM_SHA256="a2a3c64d8b24920f87cf4ea9339a25abf7388496440f13b37482d1403c33c206" SOURCE_DIR="mupdf-$portVersion-source" -PATCHES=" - mupdf-1.8.patch - mupdf-1.6-openjpeg21-1.patch - " +PATCHES="mupdf-1.8.patchset" ARCHITECTURES="x86_gcc2 x86 x86_64" SECONDARY_ARCHITECTURES="x86" diff --git a/app-text/mupdf/patches/mupdf-1.8.patch b/app-text/mupdf/patches/mupdf-1.8.patchset similarity index 51% rename from app-text/mupdf/patches/mupdf-1.8.patch rename to app-text/mupdf/patches/mupdf-1.8.patchset index 5b2c84b68..e2d4ed19b 100644 --- a/app-text/mupdf/patches/mupdf-1.8.patch +++ b/app-text/mupdf/patches/mupdf-1.8.patchset @@ -1,63 +1,13 @@ +From c4398d806ff00d119fdc91faa7601dc9904145a5 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Tue, 21 Apr 2015 12:57:05 +0300 -Subject: gcc2 fixes +Date: Sun, 9 Apr 2017 23:23:17 +0000 +Subject: applying patch mupdf-1.8.patch -diff -upr mupdf-1.8-source/include/mupdf/fitz/system.h mupdf-1.8-source-haiku/include/mupdf/fitz/system.h ---- mupdf-1.8-source/include/mupdf/fitz/system.h 2015-11-10 16:19:51.000000000 +0000 -+++ mupdf-1.8-source-haiku/include/mupdf/fitz/system.h -@@ -70,6 +70,12 @@ - #define fz_jmp_buf jmp_buf - #endif - -+#ifdef __HAIKU__ -+#if __GNUC__ < 3 -+#define va_copy __va_copy -+#endif -+#endif -+ - #ifdef _MSC_VER /* Microsoft Visual C */ - - /* MSVC up to VS2012 */ -diff -upr mupdf-1.8-source/scripts/cmapdump.c mupdf-1.8-source-haiku/scripts/cmapdump.c ---- mupdf-1.8-source/scripts/cmapdump.c 2015-11-10 16:19:51.000000000 +0000 -+++ mupdf-1.8-source-haiku/scripts/cmapdump.c -@@ -22,6 +22,24 @@ - #include "../source/fitz/ftoa.c" - #include "../source/fitz/printf.c" - -+#ifdef __HAIKU__ -+#if __GNUC__ < 3 -+#include "../source/fitz/output.c" -+ -+unsigned int -+fz_pixmap_size(fz_context *ctx, fz_pixmap * pix) -+{ -+ if (pix == NULL) -+ return 0; -+ return sizeof(*pix) + pix->n * pix->w * pix->h; -+} -+int pdf_objcmp_resolve(fz_context *ctx, pdf_obj *a, pdf_obj *b) -+{ -+ return 0; -+} -+#endif -+#endif -+ - #include "../source/pdf/pdf-lex.c" - #include "../source/pdf/pdf-cmap.c" - #include "../source/pdf/pdf-cmap-parse.c" --- - - -From: Chris Roberts -Date: Mon, 18 Nov 2013 01:10:58 -0700 -Subject: Remove libm and add install-libs target - - -diff -upr mupdf-1.8-source/Makefile mupdf-1.8-source-haiku/Makefile ---- mupdf-1.8-source/Makefile 2015-11-10 16:19:51.000000000 +0000 -+++ mupdf-1.8-source-haiku/Makefile +diff --git a/Makefile b/Makefile +index f6558cb..307b3b0 100644 +--- a/Makefile ++++ b/Makefile @@ -16,7 +16,7 @@ include Makethird # XCFLAGS or XLIBS instead. Make ignores any lines in the makefile that # set a variable that was set on the command line. @@ -101,9 +51,10 @@ diff -upr mupdf-1.8-source/Makefile mupdf-1.8-source-haiku/Makefile tarball: bash scripts/archive.sh -diff -upr mupdf-1.8-source/Makerules mupdf-1.8-source-haiku/Makerules ---- mupdf-1.8-source/Makerules 2015-11-10 16:19:51.000000000 +0000 -+++ mupdf-1.8-source-haiku/Makerules +diff --git a/Makerules b/Makerules +index bb066dc..9082949 100644 +--- a/Makerules ++++ b/Makerules @@ -66,6 +66,27 @@ AR = xcrun ar LD = xcrun ld RANLIB_CMD = xcrun ranlib $@ @@ -132,3 +83,121 @@ diff -upr mupdf-1.8-source/Makerules mupdf-1.8-source-haiku/Makerules # Linux uses pkg-config for system libraries. else ifeq "$(OS)" "Linux" +diff --git a/include/mupdf/fitz/system.h b/include/mupdf/fitz/system.h +index ca7c8dc..477d915 100644 +--- a/include/mupdf/fitz/system.h ++++ b/include/mupdf/fitz/system.h +@@ -70,6 +70,12 @@ + #define fz_jmp_buf jmp_buf + #endif + ++#ifdef __HAIKU__ ++#if __GNUC__ < 3 ++#define va_copy __va_copy ++#endif ++#endif ++ + #ifdef _MSC_VER /* Microsoft Visual C */ + + /* MSVC up to VS2012 */ +diff --git a/scripts/cmapdump.c b/scripts/cmapdump.c +index ed4a411..317762c 100644 +--- a/scripts/cmapdump.c ++++ b/scripts/cmapdump.c +@@ -22,6 +22,24 @@ + #include "../source/fitz/ftoa.c" + #include "../source/fitz/printf.c" + ++#ifdef __HAIKU__ ++#if __GNUC__ < 3 ++#include "../source/fitz/output.c" ++ ++unsigned int ++fz_pixmap_size(fz_context *ctx, fz_pixmap * pix) ++{ ++ if (pix == NULL) ++ return 0; ++ return sizeof(*pix) + pix->n * pix->w * pix->h; ++} ++int pdf_objcmp_resolve(fz_context *ctx, pdf_obj *a, pdf_obj *b) ++{ ++ return 0; ++} ++#endif ++#endif ++ + #include "../source/pdf/pdf-lex.c" + #include "../source/pdf/pdf-cmap.c" + #include "../source/pdf/pdf-cmap-parse.c" +-- +2.7.0 + + +From 110fc6940815dcef2a77376d1960a2be4ecf65f2 Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Sun, 9 Apr 2017 23:23:17 +0000 +Subject: applying patch mupdf-1.6-openjpeg21-1.patch + + +diff --git a/source/fitz/load-jpx.c b/source/fitz/load-jpx.c +index 6b92e5c..72dea50 100644 +--- a/source/fitz/load-jpx.c ++++ b/source/fitz/load-jpx.c +@@ -1,13 +1,5 @@ + #include "mupdf/fitz.h" + +-/* Without the definition of OPJ_STATIC, compilation fails on windows +- * due to the use of __stdcall. We believe it is required on some +- * linux toolchains too. */ +-#define OPJ_STATIC +-#ifndef _MSC_VER +-#define OPJ_HAVE_STDINT_H +-#endif +- + #include + + static void fz_opj_error_callback(const char *msg, void *client_data) +@@ -117,7 +109,7 @@ fz_load_jpx(fz_context *ctx, unsigned char *data, int size, fz_colorspace *defcs + opj_stream_set_read_function(stream, fz_opj_stream_read); + opj_stream_set_skip_function(stream, fz_opj_stream_skip); + opj_stream_set_seek_function(stream, fz_opj_stream_seek); +- opj_stream_set_user_data(stream, &sb); ++ opj_stream_set_user_data(stream, &sb, NULL); + /* Set the length to avoid an assert */ + opj_stream_set_user_data_length(stream, size); + +-- +2.7.0 + + +From e7f428a65f21943a497a74fcba01d45bcf26fb23 Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Mon, 10 Apr 2017 03:07:51 +0000 +Subject: Fix gcc2 detection + + +diff --git a/include/mupdf/fitz/system.h b/include/mupdf/fitz/system.h +index 477d915..05781a4 100644 +--- a/include/mupdf/fitz/system.h ++++ b/include/mupdf/fitz/system.h +@@ -207,7 +207,7 @@ typedef int fz_off_t; + #endif + + /* Flag unused parameters, for use with 'static inline' functions in headers. */ +-#if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7 ++#if __GNUC__ > 2 + #define FZ_UNUSED __attribute__((__unused__)) + #else + #define FZ_UNUSED +@@ -215,7 +215,7 @@ typedef int fz_off_t; + + /* GCC can do type checking of printf strings */ + #ifndef __printflike +-#if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7 ++#if __GNUC__ > 2 + #define __printflike(fmtarg, firstvararg) \ + __attribute__((__format__ (__printf__, fmtarg, firstvararg))) + #else +-- +2.7.0 +