From 13e1235a802460219c9c8edddbd5ebbe2cb3c978 Mon Sep 17 00:00:00 2001 From: Andrew Dunham Date: Tue, 6 Nov 2018 21:13:03 -0800 Subject: [PATCH] calibre: remove references to podofo --- pkgs/applications/misc/calibre/default.nix | 17 +++++++++++++---- pkgs/development/libraries/podofo/default.nix | 7 +++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/misc/calibre/default.nix b/pkgs/applications/misc/calibre/default.nix index 1ad236f0d13f..3554c36f5194 100644 --- a/pkgs/applications/misc/calibre/default.nix +++ b/pkgs/applications/misc/calibre/default.nix @@ -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"; diff --git a/pkgs/development/libraries/podofo/default.nix b/pkgs/development/libraries/podofo/default.nix index 9ddb70c7a8c5..ce3f5ab6b789 100644 --- a/pkgs/development/libraries/podofo/default.nix +++ b/pkgs/development/libraries/podofo/default.nix @@ -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";