From ad0da0105356d240b3680e80226d523a684794f4 Mon Sep 17 00:00:00 2001 From: Wolfgang Jenkner Date: Tue, 6 Oct 2015 17:08:50 +0200 Subject: [PATCH] Shave off the cargo cult part of the last change. Don't define OPJ_STATIC before including openjpeg.h since the executables are linked against the shared libopenjp2.so. A vanilla mupdf build would link against (its own version of) a static libopenjp2.a so defining OPJ_STATIC is necessary there to get the correct visibility magic for the function prototypes in openjpeg.h. Apparently, defining OPJ_STATIC didn't make a big difference before a recent change in openjpeg, which is discussed in https://github.com/uclouvain/openjpeg/issues/354 Now, the (rather old) comment in load-jpx.c above the OPJ_STATIC definition predates this change and, in any case, the visibility of the symbols shouldn't make a difference for mupdf since (like the other third-party libraries) libopenjp2 is linked into the executables and not into a shared object, so this still puzzles me. --- .../mupdf/files/patch-source__fitz__load-jpx.c | 32 ++++++++-------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/graphics/mupdf/files/patch-source__fitz__load-jpx.c b/graphics/mupdf/files/patch-source__fitz__load-jpx.c index 3f28b29..3d62514 100644 --- a/graphics/mupdf/files/patch-source__fitz__load-jpx.c +++ b/graphics/mupdf/files/patch-source__fitz__load-jpx.c @@ -1,25 +1,22 @@ --- source/fitz/load-jpx.c.orig 2015-04-16 08:57:45 UTC +++ source/fitz/load-jpx.c -@@ -3,12 +3,17 @@ - /* 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. */ -+ -+#ifdef __cplusplus -+extern "C" -+{ - #define OPJ_STATIC - #ifndef _MSC_VER - #define OPJ_HAVE_STDINT_H - #endif -+#endif +@@ -1,14 +1,6 @@ + #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 +#include static void fz_opj_error_callback(const char *msg, void *client_data) { -@@ -117,7 +122,7 @@ fz_load_jpx(fz_context *ctx, unsigned ch +@@ -117,7 +109,7 @@ fz_load_jpx(fz_context *ctx, unsigned ch 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); @@ -28,10 +25,3 @@ /* Set the length to avoid an assert */ opj_stream_set_user_data_length(stream, size); -@@ -247,3 +252,6 @@ fz_load_jpx(fz_context *ctx, unsigned ch - - return img; - } -+#ifdef __cplusplus -+} -+#endif -- 2.5.3