From 5498b68fdd5e31d888b0b04e9e2a8c07086e6afe Mon Sep 17 00:00:00 2001 From: Bruno Date: Sun, 5 May 2024 09:35:46 +0200 Subject: [PATCH] Hardcoded paths to geogram in zlib (else I think it gets another zlib when compiling with emscripten) --- src/lib/geogram/third_party/zlib/adler32.c | 2 +- src/lib/geogram/third_party/zlib/compress.c | 2 +- src/lib/geogram/third_party/zlib/crc32.c | 2 +- src/lib/geogram/third_party/zlib/deflate.c | 2 +- src/lib/geogram/third_party/zlib/deflate.h | 2 +- src/lib/geogram/third_party/zlib/fix_includes.sh | 5 +++++ src/lib/geogram/third_party/zlib/gzclose.c | 2 +- src/lib/geogram/third_party/zlib/gzguts.h | 2 +- src/lib/geogram/third_party/zlib/gzlib.c | 8 +------- src/lib/geogram/third_party/zlib/gzread.c | 2 +- src/lib/geogram/third_party/zlib/gzwrite.c | 2 +- src/lib/geogram/third_party/zlib/infback.c | 8 ++++---- src/lib/geogram/third_party/zlib/inffast.c | 8 ++++---- src/lib/geogram/third_party/zlib/inflate.c | 8 ++++---- src/lib/geogram/third_party/zlib/inftrees.c | 4 ++-- src/lib/geogram/third_party/zlib/trees.c | 2 +- src/lib/geogram/third_party/zlib/uncompr.c | 2 +- src/lib/geogram/third_party/zlib/zlib.h | 2 +- src/lib/geogram/third_party/zlib/zutil.c | 2 +- src/lib/geogram/third_party/zlib/zutil.h | 2 +- 20 files changed, 34 insertions(+), 35 deletions(-) create mode 100755 src/lib/geogram/third_party/zlib/fix_includes.sh diff --git a/src/lib/geogram/third_party/zlib/adler32.c b/src/lib/geogram/third_party/zlib/adler32.c index 04b81d29bad1..95f1fe432dfa 100644 --- a/src/lib/geogram/third_party/zlib/adler32.c +++ b/src/lib/geogram/third_party/zlib/adler32.c @@ -5,7 +5,7 @@ /* @(#) $Id$ */ -#include "zutil.h" +#include #define BASE 65521U /* largest prime smaller than 65536 */ #define NMAX 5552 diff --git a/src/lib/geogram/third_party/zlib/compress.c b/src/lib/geogram/third_party/zlib/compress.c index f43bacf7ab97..213f7bf36d29 100644 --- a/src/lib/geogram/third_party/zlib/compress.c +++ b/src/lib/geogram/third_party/zlib/compress.c @@ -6,7 +6,7 @@ /* @(#) $Id$ */ #define ZLIB_INTERNAL -#include "zlib.h" +#include /* =========================================================================== Compresses the source buffer into the destination buffer. The level diff --git a/src/lib/geogram/third_party/zlib/crc32.c b/src/lib/geogram/third_party/zlib/crc32.c index 6c38f5c04c6a..9678e1d1bbe3 100644 --- a/src/lib/geogram/third_party/zlib/crc32.c +++ b/src/lib/geogram/third_party/zlib/crc32.c @@ -27,7 +27,7 @@ # endif /* !DYNAMIC_CRC_TABLE */ #endif /* MAKECRCH */ -#include "zutil.h" /* for Z_U4, Z_U8, z_crc_t, and FAR definitions */ +#include /* for Z_U4, Z_U8, z_crc_t, and FAR definitions */ /* A CRC of a message is computed on N braids of words in the message, where diff --git a/src/lib/geogram/third_party/zlib/deflate.c b/src/lib/geogram/third_party/zlib/deflate.c index 012ea8148e8d..4fd125bf8a32 100644 --- a/src/lib/geogram/third_party/zlib/deflate.c +++ b/src/lib/geogram/third_party/zlib/deflate.c @@ -49,7 +49,7 @@ /* @(#) $Id$ */ -#include "deflate.h" +#include const char deflate_copyright[] = " deflate 1.3.1 Copyright 1995-2024 Jean-loup Gailly and Mark Adler "; diff --git a/src/lib/geogram/third_party/zlib/deflate.h b/src/lib/geogram/third_party/zlib/deflate.h index 300c6ada62b8..6f44017ec8b6 100644 --- a/src/lib/geogram/third_party/zlib/deflate.h +++ b/src/lib/geogram/third_party/zlib/deflate.h @@ -13,7 +13,7 @@ #ifndef DEFLATE_H #define DEFLATE_H -#include "zutil.h" +#include /* define NO_GZIP when compiling if you want to disable gzip header and trailer creation by deflate(). NO_GZIP would be used to avoid linking in diff --git a/src/lib/geogram/third_party/zlib/fix_includes.sh b/src/lib/geogram/third_party/zlib/fix_includes.sh new file mode 100755 index 000000000000..93d9dce973cb --- /dev/null +++ b/src/lib/geogram/third_party/zlib/fix_includes.sh @@ -0,0 +1,5 @@ +for i in `ls *.h *.c` +do + cp $i $i.back + cat $i.back | sed -e 's|#include \"\(.*\)\"|#include |g' > $i +done diff --git a/src/lib/geogram/third_party/zlib/gzclose.c b/src/lib/geogram/third_party/zlib/gzclose.c index 48d6a86f04b6..23556d14d40e 100644 --- a/src/lib/geogram/third_party/zlib/gzclose.c +++ b/src/lib/geogram/third_party/zlib/gzclose.c @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#include "gzguts.h" +#include /* gzclose() is in a separate file so that it is linked in only if it is used. That way the other gzclose functions can be used instead to avoid linking in diff --git a/src/lib/geogram/third_party/zlib/gzguts.h b/src/lib/geogram/third_party/zlib/gzguts.h index 4e97dc9ab02d..5eb6473f4e49 100644 --- a/src/lib/geogram/third_party/zlib/gzguts.h +++ b/src/lib/geogram/third_party/zlib/gzguts.h @@ -24,7 +24,7 @@ #endif #include -#include "zlib.h" +#include #ifdef STDC # include # include diff --git a/src/lib/geogram/third_party/zlib/gzlib.c b/src/lib/geogram/third_party/zlib/gzlib.c index 3d3cd9b50715..06e8f0383c36 100644 --- a/src/lib/geogram/third_party/zlib/gzlib.c +++ b/src/lib/geogram/third_party/zlib/gzlib.c @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#include "gzguts.h" +#include #if defined(_WIN32) && !defined(__BORLANDC__) # define LSEEK _lseeki64 @@ -15,12 +15,6 @@ #endif #endif -/* [Bruno] for some reasons this prototype is missing (WTF??) */ -#ifdef __EMSCRIPTEN__ -TAGADA testing that we go there under emscripten -off_t lseek(int fd, off_t offset, int whence); -#endif - #if defined UNDER_CE /* Map the Windows error number in ERROR to a locale-dependent error message diff --git a/src/lib/geogram/third_party/zlib/gzread.c b/src/lib/geogram/third_party/zlib/gzread.c index 4168cbc88752..d5967a42b936 100644 --- a/src/lib/geogram/third_party/zlib/gzread.c +++ b/src/lib/geogram/third_party/zlib/gzread.c @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#include "gzguts.h" +#include /* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from state->fd, and update state->eof, state->err, and state->msg as appropriate. diff --git a/src/lib/geogram/third_party/zlib/gzwrite.c b/src/lib/geogram/third_party/zlib/gzwrite.c index 435b4621b534..c4105c34eb67 100644 --- a/src/lib/geogram/third_party/zlib/gzwrite.c +++ b/src/lib/geogram/third_party/zlib/gzwrite.c @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#include "gzguts.h" +#include /* Initialize state for writing a gzip file. Mark initialization by setting state->size to non-zero. Return -1 on a memory allocation failure, or 0 on diff --git a/src/lib/geogram/third_party/zlib/infback.c b/src/lib/geogram/third_party/zlib/infback.c index e7b25b307a30..a75b61a76887 100644 --- a/src/lib/geogram/third_party/zlib/infback.c +++ b/src/lib/geogram/third_party/zlib/infback.c @@ -10,10 +10,10 @@ inflate_fast() can be used with either inflate.c or infback.c. */ -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" +#include +#include +#include +#include /* strm provides memory allocation functions in zalloc and zfree, or diff --git a/src/lib/geogram/third_party/zlib/inffast.c b/src/lib/geogram/third_party/zlib/inffast.c index 9354676e786e..fd77f16b22cc 100644 --- a/src/lib/geogram/third_party/zlib/inffast.c +++ b/src/lib/geogram/third_party/zlib/inffast.c @@ -3,10 +3,10 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" +#include +#include +#include +#include #ifdef ASMINF # pragma message("Assembler code may have bugs -- use at your own risk") diff --git a/src/lib/geogram/third_party/zlib/inflate.c b/src/lib/geogram/third_party/zlib/inflate.c index 94ecff015a9b..2cf0310b155a 100644 --- a/src/lib/geogram/third_party/zlib/inflate.c +++ b/src/lib/geogram/third_party/zlib/inflate.c @@ -80,10 +80,10 @@ * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. */ -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" +#include +#include +#include +#include #ifdef MAKEFIXED # ifndef BUILDFIXED diff --git a/src/lib/geogram/third_party/zlib/inftrees.c b/src/lib/geogram/third_party/zlib/inftrees.c index 98cfe164458c..f41ff335f4e5 100644 --- a/src/lib/geogram/third_party/zlib/inftrees.c +++ b/src/lib/geogram/third_party/zlib/inftrees.c @@ -3,8 +3,8 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#include "zutil.h" -#include "inftrees.h" +#include +#include #define MAXBITS 15 diff --git a/src/lib/geogram/third_party/zlib/trees.c b/src/lib/geogram/third_party/zlib/trees.c index 6a523ef34e3c..d31e815cc670 100644 --- a/src/lib/geogram/third_party/zlib/trees.c +++ b/src/lib/geogram/third_party/zlib/trees.c @@ -34,7 +34,7 @@ /* #define GEN_TREES_H */ -#include "deflate.h" +#include #ifdef ZLIB_DEBUG # include diff --git a/src/lib/geogram/third_party/zlib/uncompr.c b/src/lib/geogram/third_party/zlib/uncompr.c index 5e256663b451..6581c1955aa2 100644 --- a/src/lib/geogram/third_party/zlib/uncompr.c +++ b/src/lib/geogram/third_party/zlib/uncompr.c @@ -6,7 +6,7 @@ /* @(#) $Id$ */ #define ZLIB_INTERNAL -#include "zlib.h" +#include /* =========================================================================== Decompresses the source buffer into the destination buffer. *sourceLen is diff --git a/src/lib/geogram/third_party/zlib/zlib.h b/src/lib/geogram/third_party/zlib/zlib.h index 786187a8b8e3..3b1d05cd9294 100644 --- a/src/lib/geogram/third_party/zlib/zlib.h +++ b/src/lib/geogram/third_party/zlib/zlib.h @@ -34,7 +34,7 @@ #ifndef ZLIB_H #define ZLIB_H -#include "zconf.h" +#include #ifdef __cplusplus extern "C" { diff --git a/src/lib/geogram/third_party/zlib/zutil.c b/src/lib/geogram/third_party/zlib/zutil.c index b1c5d2d3c6da..dabb1514786d 100644 --- a/src/lib/geogram/third_party/zlib/zutil.c +++ b/src/lib/geogram/third_party/zlib/zutil.c @@ -5,7 +5,7 @@ /* @(#) $Id$ */ -#include "zutil.h" +#include #ifndef Z_SOLO # include "gzguts.h" #endif diff --git a/src/lib/geogram/third_party/zlib/zutil.h b/src/lib/geogram/third_party/zlib/zutil.h index 48dd7febae65..f105bec246fe 100644 --- a/src/lib/geogram/third_party/zlib/zutil.h +++ b/src/lib/geogram/third_party/zlib/zutil.h @@ -19,7 +19,7 @@ # define ZLIB_INTERNAL #endif -#include "zlib.h" +#include #if defined(STDC) && !defined(Z_SOLO) # if !(defined(_WIN32_WCE) && defined(_MSC_VER))