Merge pull request #30071 from danielfullmer/mupdf-lib-fix

mupdf: fix library linking

authored by Orivej Desh and committed by GitHub dd9a4737 da20916e

+26 -15
+15 -3
pkgs/applications/misc/k2pdfopt/default.nix
··· 2 2 , zlib, libpng 3 3 , enableGSL ? true, gsl 4 4 , enableGhostScript ? true, ghostscript 5 - , enableMuPDF ? true, jbig2dec, openjpeg, freetype, harfbuzz, mupdf 5 + , enableMuPDF ? true, mupdf 6 6 , enableJPEG2K ? true, jasper 7 7 , enableDJVU ? true, djvulibre 8 8 , enableGOCR ? false, gocr # Disabled by default due to crashes ··· 51 51 url = "http://git.ghostscript.com/?p=mupdf.git;a=patch;h=2c4e5867ee699b1081527bc6c6ea0e99a35a5c27"; 52 52 sha256 = "14k7x47ifx82sds1c06ibzbmcparfg80719jhgwjk6w1vkh4r693"; 53 53 }) 54 + 55 + (fetchpatch { 56 + name = "mupdf-1.10a-shared_libs-1.patch"; 57 + url = "https://ftp.osuosl.org/pub/blfs/conglomeration/mupdf/mupdf-1.10a-shared_libs-1.patch"; 58 + sha256 = "0kg4vahp7hlyyj5hl18brk8s8xcbqrx19pqjzkfq6ha8mqa3k4ab"; 59 + }) 54 60 ]; 61 + 62 + # Override this since the jpeg directory was renamed libjpeg in mupdf 1.11 63 + preConfigure = '' 64 + # Don't remove mujs because upstream version is incompatible 65 + rm -rf thirdparty/{curl,freetype,glfw,harfbuzz,jbig2dec,jpeg,openjpeg,zlib} 66 + ''; 55 67 }); 56 68 leptonica_modded = leptonica.overrideAttrs (attrs: { 57 69 prePatch = '' ··· 75 87 [ zlib libpng ] ++ 76 88 optional enableGSL gsl ++ 77 89 optional enableGhostScript ghostscript ++ 78 - optionals enableMuPDF [ jbig2dec openjpeg freetype harfbuzz mupdf_modded ] ++ 79 - optionals enableJPEG2K [ jasper ] ++ 90 + optional enableMuPDF mupdf_modded ++ 91 + optional enableJPEG2K jasper ++ 80 92 optional enableDJVU djvulibre ++ 81 93 optional enableGOCR gocr ++ 82 94 optionals enableTesseract [ leptonica_modded tesseract_modded ];
+3 -3
pkgs/applications/misc/k2pdfopt/k2pdfopt.patch
··· 17 17 -# willus.h 18 18 -# HAVE_GSL_LIB 19 19 +pkg_check_modules(GSL gsl) 20 - +if(MUPDF_FOUND) 20 + +if(GSL_FOUND) 21 21 + set(HAVE_GSL_LIB 1) 22 22 + include_directories(SYSTEM ${GSL_INCLUDEDIR}) 23 23 + set(K2PDFOPT_LIB ${K2PDFOPT_LIB} ${GSL_LDFLAGS}) 24 - +endif(MUPDF_FOUND) 24 + +endif(GSL_FOUND) 25 25 26 26 27 27 # libfreetype6 (>= 2.3.9), libjbig2dec0, libjpeg8 (>= 8c), libx11-6, libxext6, zlib1g (>= 1:1.2.0) ··· 30 30 message(STATUS "mupdf libraries: ${MUPDF_LDFLAGS}") 31 31 set(K2PDFOPT_LIB ${K2PDFOPT_LIB} ${MUPDF_LDFLAGS} 32 32 - -lmupdf-js-none -lopenjpeg -ljbig2dec -ljpeg -lfreetype 33 - + -lopenjp2 -ljbig2dec -ljpeg -lfreetype -lharfbuzz 33 + + 34 34 ) 35 35 endif(MUPDF_FOUND) 36 36
+8 -9
pkgs/applications/misc/mupdf/default.nix
··· 1 1 { stdenv, lib, fetchurl, fetchpatch, pkgconfig 2 - , freetype, harfbuzz, openjpeg, jbig2dec 2 + , freetype, harfbuzz, openjpeg, jbig2dec, libjpeg 3 3 , enableX11 ? true, libX11, libXext 4 4 , enableCurl ? true, curl, openssl 5 5 }: ··· 26 26 url = "http://git.ghostscript.com/?p=mupdf.git;a=blobdiff_plain;f=platform/x11/jstest_main.c;h=f158d9628ed0c0a84e37fe128277679e8334422a;hp=13c3a0a3ba3ff4aae29f6882d23740833c1d842f;hb=06a012a42c9884e3cd653e7826cff1ddec04eb6e;hpb=34e18d127a02146e3415b33c4b67389ce1ddb614"; 27 27 sha256 = "163bllvjrbm0gvjb25lv7b6sih4zr4g4lap3h0cbq8dvpjxx0jfc"; 28 28 }) 29 + 30 + (fetchpatch { 31 + name = "mupdf-1.11-shared_libs-1.patch"; 32 + url = "https://ftp.osuosl.org/pub/blfs/conglomeration/mupdf/mupdf-1.11-shared_libs-1.patch"; 33 + sha256 = "127x8jhyj3i9cn3mxw9mm5barw2yk43rvmghg54bhn4rjalx857j"; 34 + }) 29 35 ]; 30 36 31 37 makeFlags = [ "prefix=$(out)" ]; 32 38 nativeBuildInputs = [ pkgconfig ]; 33 - buildInputs = [ freetype harfbuzz openjpeg jbig2dec ] 39 + buildInputs = [ freetype harfbuzz openjpeg jbig2dec libjpeg ] 34 40 ++ lib.optionals enableX11 [ libX11 libXext ] 35 41 ++ lib.optionals enableCurl [ curl openssl ]; 36 42 outputs = [ "bin" "dev" "out" "man" "doc" ]; ··· 41 47 ''; 42 48 43 49 postInstall = '' 44 - for i in $out/lib/*.a; do 45 - so="''${i%.a}.so" 46 - gcc -shared -o $so.${version} -Wl,--whole-archive $i -Wl,--no-whole-archive 47 - ln -s $so.${version} $so 48 - rm $i 49 - done 50 - 51 50 mkdir -p "$out/lib/pkgconfig" 52 51 cat >"$out/lib/pkgconfig/mupdf.pc" <<EOF 53 52 prefix=$out