Merge pull request #49856 from andrew-d/andrew/podofo-closure-size

calibre: remove references to podofo to reduce closure size
This commit is contained in:
Matthew Bauer 2018-11-08 15:05:50 -06:00 committed by GitHub
commit c5080e9a85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 4 deletions

View File

@ -1,7 +1,7 @@
{ stdenv, fetchurl, poppler_utils, pkgconfig, libpng
, imagemagick, libjpeg, fontconfig, podofo, qtbase, qmake, icu, sqlite
, makeWrapper, unrarSupport ? false, chmlib, python2Packages, libusb1, libmtp
, xdg_utils, makeDesktopItem, wrapGAppsHook
, xdg_utils, makeDesktopItem, wrapGAppsHook, removeReferencesTo
}:
stdenv.mkDerivation rec {
@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
nativeBuildInputs = [ makeWrapper pkgconfig qmake ];
nativeBuildInputs = [ makeWrapper pkgconfig qmake removeReferencesTo ];
buildInputs = [
poppler_utils libpng imagemagick libjpeg
@ -58,8 +58,8 @@ stdenv.mkDerivation rec {
export MAGICK_LIB=${imagemagick.out}/lib
export FC_INC_DIR=${fontconfig.dev}/include/fontconfig
export FC_LIB_DIR=${fontconfig.lib}/lib
export PODOFO_INC_DIR=${podofo}/include/podofo
export PODOFO_LIB_DIR=${podofo}/lib
export PODOFO_INC_DIR=${podofo.dev}/include/podofo
export PODOFO_LIB_DIR=${podofo.lib}/lib
export SIP_BIN=${python2Packages.sip}/bin/sip
${python2Packages.python.interpreter} setup.py install --prefix=$out
@ -88,6 +88,15 @@ stdenv.mkDerivation rec {
runHook postInstall
'';
# Remove some references to shrink the closure size. This reference (as of
# 2018-11-06) was a single string like the following:
# /nix/store/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-podofo-0.9.6-dev/include/podofo/base/PdfVariant.h
preFixup = ''
remove-references-to -t ${podofo.dev} $out/lib/calibre/calibre/plugins/podofo.so
'';
disallowedReferences = [ podofo.dev ];
calibreDesktopItem = makeDesktopItem {
name = "calibre";
desktopName = "calibre";

View File

@ -21,6 +21,8 @@ stdenv.mkDerivation rec {
})
];
outputs = [ "out" "dev" "lib" ];
nativeBuildInputs = [ cmake pkgconfig ];
buildInputs = [ zlib freetype libjpeg libtiff fontconfig openssl libpng
@ -31,6 +33,11 @@ stdenv.mkDerivation rec {
"-DPODOFO_BUILD_STATIC=OFF"
"-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON"
];
postInstall = ''
moveToOutput lib "$lib"
'';
meta = with stdenv.lib; {
homepage = http://podofo.sourceforge.net;
description = "A library to work with the PDF file format";