From: Dmitry Shachnev <mitya57@debian.org>
Date: Fri, 13 Sep 2024 23:05:14 +0300
Subject: Build with system zlib

Origin: Fedora, https://src.fedoraproject.org/rpms/texmaker/blob/rawhide/f/texmaker-zlib.patch
---
 pdfium/core/fxcodec/codec/fx_codec_flate.cpp |  2 +-
 texmaker.pro                                 | 22 ++++------------------
 2 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/pdfium/core/fxcodec/codec/fx_codec_flate.cpp b/pdfium/core/fxcodec/codec/fx_codec_flate.cpp
index 9e40d3e..71ede62 100644
--- a/pdfium/core/fxcodec/codec/fx_codec_flate.cpp
+++ b/pdfium/core/fxcodec/codec/fx_codec_flate.cpp
@@ -11,7 +11,7 @@
 
 #include "core/fxcodec/fx_codec.h"
 #include "core/fxcrt/fx_ext.h"
-#include "third_party/zlib_v128/zlib.h"
+#include <zlib.h>
 
 extern "C" {
 static void* my_alloc_func(void* opaque,
diff --git a/texmaker.pro b/texmaker.pro
index f643a4b..9e31112 100644
--- a/texmaker.pro
+++ b/texmaker.pro
@@ -28,9 +28,11 @@ QT += webenginewidgets
 }
 
 
-CONFIG	+= qt hide_symbols warn_off rtti_off exceptions_off c++11 release
+CONFIG	+= qt hide_symbols warn_off rtti_off exceptions_off c++11 release link_pkgconfig
 CONFIG -= precompile_header
 
+PKGCONFIG += zlib
+
 gcc {
     QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter
 }
@@ -54,8 +56,7 @@ INCLUDEPATH += \
     pdfium/third_party/ \
     pdfium/third_party/freetype/include \
     pdfium/third_party/freetype/include/freetype \
-    pdfium/fpdfsdk \
-    pdfium/third_party/zlib_v128
+    pdfium/fpdfsdk
 
 ###############################
 
@@ -695,21 +696,6 @@ SOURCES	+= main.cpp \
     pdfium/third_party/libopenjpeg20/t2.c \
     pdfium/third_party/libopenjpeg20/tcd.c \
     pdfium/third_party/libopenjpeg20/tgt.c \
-    pdfium/third_party/zlib_v128/adler32.c \
-    pdfium/third_party/zlib_v128/compress.c \
-    pdfium/third_party/zlib_v128/crc32.c \
-    pdfium/third_party/zlib_v128/deflate.c \
-    pdfium/third_party/zlib_v128/gzclose.c \
-    pdfium/third_party/zlib_v128/gzlib.c \
-    pdfium/third_party/zlib_v128/gzread.c \
-    pdfium/third_party/zlib_v128/gzwrite.c \
-    pdfium/third_party/zlib_v128/infback.c \
-    pdfium/third_party/zlib_v128/inffast.c \
-    pdfium/third_party/zlib_v128/inflate.c \
-    pdfium/third_party/zlib_v128/inftrees.c \
-    pdfium/third_party/zlib_v128/trees.c \
-    pdfium/third_party/zlib_v128/uncompr.c \
-    pdfium/third_party/zlib_v128/zutil.c \
     pdfium/third_party/agg23/agg_curves.cpp \
     pdfium/third_party/agg23/agg_path_storage.cpp \
     pdfium/third_party/agg23/agg_rasterizer_scanline_aa.cpp \
