From: Jakub Jirutka <jakub@jirutka.cz>
Date: Thu, 21 Jul 2022 18:28:00 +0200
Subject: [PATCH] Fix build with mupdf on Alpine

Alpine's mupdf-dev provides mupdf.pc.
mupdf >=1.19.0 doesn't build libmupdf-third.

--- a/meson.build	2024-06-04 19:32:44.000000000 +0000
+++ b/meson.build	2024-06-07 08:02:04.801711930 +0000
@@ -22,54 +22,16 @@ zathura = dependency('zathura', version:
 girara = dependency('girara-gtk3')
 glib = dependency('glib-2.0')
 cairo = dependency('cairo')
-mupdf = dependency('mupdf', required: false, version: '>=@0@.@1@'.format(mupdf_required_version_major, mupdf_required_version_minor))
-mupdfthird = cc.find_library('mupdf-third')
+mupdf = dependency('mupdf')
 
 build_dependencies = [
   zathura,
   girara,
   glib,
   cairo,
+  mupdf,
 ]
-
-if not mupdf.found()
-  # normal build of mupdf
-  mupdf = cc.find_library('mupdf', has_headers: ['mupdf/fitz/version.h', 'mupdf/fitz.h', 'mupdf/pdf.h'], required: true)
-  version_check = '''
-#include <mupdf/fitz/version.h>
-
-#if FZ_VERSION_MAJOR < @0@ || (FZ_VERSION_MAJOR == @0@ && FZ_VERSION_MINOR < @1@)
-#error "mupdf @0@.@1@ or newer is requried"
-#endif
-'''.format(mupdf_required_version_major, mupdf_required_version_minor)
-  if not cc.compiles(version_check, dependencies: [mupdf])
-    error('mupdf @0@.@1@ or newer is required'.format(mupdf_required_version_major, mupdf_required_version_minor))
-  endif
-
-  build_dependencies += [mupdf, mupdfthird]
-else
-  # build from Debian's libmupdf-dev
-  build_dependencies += [mupdf, mupdfthird]
-
-  libjpeg = dependency('libjpeg')
-  libjbig2dec = cc.find_library('jbig2dec')
-  libopenjp2 = dependency('libopenjp2')
-  gumbo = dependency('gumbo')
-  tesseract = dependency('tesseract')
-  leptonica = dependency('lept')
-  mujs = dependency('mujs')
-
-  build_dependencies += [
-    libjpeg,
-    libjbig2dec,
-    libopenjp2,
-    gumbo,
-    tesseract,
-    leptonica,
-    mujs
-  ]
-endif
 
 if get_option('plugindir') == ''
   plugindir = zathura.get_variable(pkgconfig: 'plugindir')
 else
