mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 23:03:40 +01:00
Merge pull request #30071 from danielfullmer/mupdf-lib-fix
mupdf: fix library linking
This commit is contained in:
commit
dd9a473763
3 changed files with 26 additions and 15 deletions
|
@ -2,7 +2,7 @@
|
|||
, zlib, libpng
|
||||
, enableGSL ? true, gsl
|
||||
, enableGhostScript ? true, ghostscript
|
||||
, enableMuPDF ? true, jbig2dec, openjpeg, freetype, harfbuzz, mupdf
|
||||
, enableMuPDF ? true, mupdf
|
||||
, enableJPEG2K ? true, jasper
|
||||
, enableDJVU ? true, djvulibre
|
||||
, enableGOCR ? false, gocr # Disabled by default due to crashes
|
||||
|
@ -51,7 +51,19 @@ stdenv.mkDerivation rec {
|
|||
url = "http://git.ghostscript.com/?p=mupdf.git;a=patch;h=2c4e5867ee699b1081527bc6c6ea0e99a35a5c27";
|
||||
sha256 = "14k7x47ifx82sds1c06ibzbmcparfg80719jhgwjk6w1vkh4r693";
|
||||
})
|
||||
|
||||
(fetchpatch {
|
||||
name = "mupdf-1.10a-shared_libs-1.patch";
|
||||
url = "https://ftp.osuosl.org/pub/blfs/conglomeration/mupdf/mupdf-1.10a-shared_libs-1.patch";
|
||||
sha256 = "0kg4vahp7hlyyj5hl18brk8s8xcbqrx19pqjzkfq6ha8mqa3k4ab";
|
||||
})
|
||||
];
|
||||
|
||||
# Override this since the jpeg directory was renamed libjpeg in mupdf 1.11
|
||||
preConfigure = ''
|
||||
# Don't remove mujs because upstream version is incompatible
|
||||
rm -rf thirdparty/{curl,freetype,glfw,harfbuzz,jbig2dec,jpeg,openjpeg,zlib}
|
||||
'';
|
||||
});
|
||||
leptonica_modded = leptonica.overrideAttrs (attrs: {
|
||||
prePatch = ''
|
||||
|
@ -75,8 +87,8 @@ stdenv.mkDerivation rec {
|
|||
[ zlib libpng ] ++
|
||||
optional enableGSL gsl ++
|
||||
optional enableGhostScript ghostscript ++
|
||||
optionals enableMuPDF [ jbig2dec openjpeg freetype harfbuzz mupdf_modded ] ++
|
||||
optionals enableJPEG2K [ jasper ] ++
|
||||
optional enableMuPDF mupdf_modded ++
|
||||
optional enableJPEG2K jasper ++
|
||||
optional enableDJVU djvulibre ++
|
||||
optional enableGOCR gocr ++
|
||||
optionals enableTesseract [ leptonica_modded tesseract_modded ];
|
||||
|
|
|
@ -17,11 +17,11 @@ index 4a2378b..502c477 100644
|
|||
-# willus.h
|
||||
-# HAVE_GSL_LIB
|
||||
+pkg_check_modules(GSL gsl)
|
||||
+if(MUPDF_FOUND)
|
||||
+if(GSL_FOUND)
|
||||
+ set(HAVE_GSL_LIB 1)
|
||||
+ include_directories(SYSTEM ${GSL_INCLUDEDIR})
|
||||
+ set(K2PDFOPT_LIB ${K2PDFOPT_LIB} ${GSL_LDFLAGS})
|
||||
+endif(MUPDF_FOUND)
|
||||
+endif(GSL_FOUND)
|
||||
|
||||
|
||||
# libfreetype6 (>= 2.3.9), libjbig2dec0, libjpeg8 (>= 8c), libx11-6, libxext6, zlib1g (>= 1:1.2.0)
|
||||
|
@ -30,7 +30,7 @@ index 4a2378b..502c477 100644
|
|||
message(STATUS "mupdf libraries: ${MUPDF_LDFLAGS}")
|
||||
set(K2PDFOPT_LIB ${K2PDFOPT_LIB} ${MUPDF_LDFLAGS}
|
||||
- -lmupdf-js-none -lopenjpeg -ljbig2dec -ljpeg -lfreetype
|
||||
+ -lopenjp2 -ljbig2dec -ljpeg -lfreetype -lharfbuzz
|
||||
+
|
||||
)
|
||||
endif(MUPDF_FOUND)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{ stdenv, lib, fetchurl, fetchpatch, pkgconfig
|
||||
, freetype, harfbuzz, openjpeg, jbig2dec
|
||||
, freetype, harfbuzz, openjpeg, jbig2dec, libjpeg
|
||||
, enableX11 ? true, libX11, libXext
|
||||
, enableCurl ? true, curl, openssl
|
||||
}:
|
||||
|
@ -26,11 +26,17 @@ stdenv.mkDerivation rec {
|
|||
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";
|
||||
sha256 = "163bllvjrbm0gvjb25lv7b6sih4zr4g4lap3h0cbq8dvpjxx0jfc";
|
||||
})
|
||||
|
||||
(fetchpatch {
|
||||
name = "mupdf-1.11-shared_libs-1.patch";
|
||||
url = "https://ftp.osuosl.org/pub/blfs/conglomeration/mupdf/mupdf-1.11-shared_libs-1.patch";
|
||||
sha256 = "127x8jhyj3i9cn3mxw9mm5barw2yk43rvmghg54bhn4rjalx857j";
|
||||
})
|
||||
];
|
||||
|
||||
makeFlags = [ "prefix=$(out)" ];
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
buildInputs = [ freetype harfbuzz openjpeg jbig2dec ]
|
||||
buildInputs = [ freetype harfbuzz openjpeg jbig2dec libjpeg ]
|
||||
++ lib.optionals enableX11 [ libX11 libXext ]
|
||||
++ lib.optionals enableCurl [ curl openssl ];
|
||||
outputs = [ "bin" "dev" "out" "man" "doc" ];
|
||||
|
@ -41,13 +47,6 @@ stdenv.mkDerivation rec {
|
|||
'';
|
||||
|
||||
postInstall = ''
|
||||
for i in $out/lib/*.a; do
|
||||
so="''${i%.a}.so"
|
||||
gcc -shared -o $so.${version} -Wl,--whole-archive $i -Wl,--no-whole-archive
|
||||
ln -s $so.${version} $so
|
||||
rm $i
|
||||
done
|
||||
|
||||
mkdir -p "$out/lib/pkgconfig"
|
||||
cat >"$out/lib/pkgconfig/mupdf.pc" <<EOF
|
||||
prefix=$out
|
||||
|
|
Loading…
Reference in a new issue