From c16b33bbcc1f7176362678622872eb1cef8c5bdb Mon Sep 17 00:00:00 2001 From: Piotr Bogdan Date: Mon, 14 Jan 2019 01:53:40 +0000 Subject: [PATCH] libreoffice-fresh: 6.1.3.2 -> 6.1.4.2 And patch it, together fixing build with new poppler. Fixes https://github.com/NixOS/nixpkgs/issues/53921 --- .../libreoffice/default-primary-src.nix | 4 +- .../office/libreoffice/default.nix | 9 +- .../office/libreoffice/poppler.patch | 289 ++++++++++++++++++ 3 files changed, 297 insertions(+), 5 deletions(-) create mode 100644 pkgs/applications/office/libreoffice/poppler.patch diff --git a/pkgs/applications/office/libreoffice/default-primary-src.nix b/pkgs/applications/office/libreoffice/default-primary-src.nix index 98a83a33f272..aabdacd6198f 100644 --- a/pkgs/applications/office/libreoffice/default-primary-src.nix +++ b/pkgs/applications/office/libreoffice/default-primary-src.nix @@ -3,7 +3,7 @@ rec { major = "6"; minor = "1"; - patch = "3"; + patch = "4"; tweak = "2"; subdir = "${major}.${minor}.${patch}"; @@ -12,6 +12,6 @@ rec { src = fetchurl { url = "https://download.documentfoundation.org/libreoffice/src/${subdir}/libreoffice-${version}.tar.xz"; - sha256 = "0i4gf3qi16fg7dxq2l4vhkwh4f5lx7xd1ilpzcw26vccqkv3hvyl"; + sha256 = "1zip7clhh3bp9smlxx1y5zpnwhaa6p0xlxg7k5d644q8gqbyk3v4"; }; } diff --git a/pkgs/applications/office/libreoffice/default.nix b/pkgs/applications/office/libreoffice/default.nix index 95df061de5a2..b60874e7c3ca 100644 --- a/pkgs/applications/office/libreoffice/default.nix +++ b/pkgs/applications/office/libreoffice/default.nix @@ -48,14 +48,14 @@ let translations = fetchSrc { name = "translations"; - sha256 = "1cry3gkvk71jf71jk4pff320axfid2wqjdnhkj2z718g4pp54dwf"; + sha256 = "1lgyns8zmwky1p78rvilnixqmicpfaal6x6286l4m7hv46pha181"; }; # TODO: dictionaries help = fetchSrc { name = "help"; - sha256 = "0q26zb2lq2cnkq0cn9ds3qwa981ljz0lyw13pa6f62nvrnwwqgwa"; + sha256 = "0ia490xksnhh4m5fas6irr7qbnkaap7zs3fg8jbq4qrfjh81bcpm"; }; }; @@ -68,7 +68,10 @@ in stdenv.mkDerivation rec { # of rasqal/rasqal.h NIX_CFLAGS_COMPILE = [ "-I${librdf_rasqal}/include/rasqal" ]; - patches = [ ./xdg-open-brief.patch ]; + patches = [ + ./xdg-open-brief.patch + ./poppler.patch + ]; postUnpack = '' mkdir -v $sourceRoot/src diff --git a/pkgs/applications/office/libreoffice/poppler.patch b/pkgs/applications/office/libreoffice/poppler.patch new file mode 100644 index 000000000000..29defb679422 --- /dev/null +++ b/pkgs/applications/office/libreoffice/poppler.patch @@ -0,0 +1,289 @@ +diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx +index 06e4faead..d4174e208 100644 +--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx ++++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx +@@ -298,7 +298,7 @@ void writePpm_( OutputBuffer& o_rOutputBuf, + o_rOutputBuf.resize(header_size); + + // initialize stream +- Guchar *p; ++ unsigned char *p; + GfxRGB rgb; + std::unique_ptr imgStr( + new ImageStream(str, +@@ -401,7 +401,7 @@ void writeImage_( OutputBuffer& o_rOutputBuf, + oneColor = { byteToCol( 0xff ), byteToCol( 0xff ), byteToCol( 0xff ) }; + if( colorMap->getColorSpace()->getMode() == csIndexed || colorMap->getColorSpace()->getMode() == csDeviceGray ) + { +- Guchar nIndex = 0; ++ unsigned char nIndex = 0; + colorMap->getRGB( &nIndex, &zeroColor ); + nIndex = 1; + colorMap->getRGB( &nIndex, &oneColor ); +@@ -514,7 +514,7 @@ void PDFOutDev::printPath( GfxPath* pPath ) + PDFOutDev::PDFOutDev( PDFDoc* pDoc ) : + m_pDoc( pDoc ), + m_aFontMap(), +- m_pUtf8Map( new UnicodeMap("UTF-8", gTrue, &mapUTF8) ), ++ m_pUtf8Map( new UnicodeMap("UTF-8", true, &mapUTF8) ), + m_bSkipImages(false) + { + } +@@ -555,7 +555,11 @@ void PDFOutDev::processLink(Link* link, Catalog*) + LinkAction* pAction = link->getAction(); + if (pAction && pAction->getKind() == actionURI) + { ++#if POPPLER_CHECK_VERSION(0, 72, 0) ++ const char* pURI = static_cast(pAction)->getURI()->c_str(); ++#else + const char* pURI = static_cast(pAction)->getURI()->getCString(); ++#endif + + std::vector aEsc( lcl_escapeLineFeeds(pURI) ); + +@@ -578,7 +582,11 @@ void PDFOutDev::restoreState(GfxState*) + printf( "restoreState\n" ); + } + ++#if POPPLER_CHECK_VERSION(0, 71, 0) ++void PDFOutDev::setDefaultCTM(const double *pMat) ++#else + void PDFOutDev::setDefaultCTM(double *pMat) ++#endif + { + assert(pMat); + +@@ -752,8 +760,11 @@ void PDFOutDev::updateFont(GfxState *state) + printf( " %lld", fontID ); + + aFont = it->second; +- ++#if POPPLER_CHECK_VERSION(0, 72, 0) ++ std::vector aEsc( lcl_escapeLineFeeds(aFont.familyName.c_str()) ); ++#else + std::vector aEsc( lcl_escapeLineFeeds(aFont.familyName.getCString()) ); ++#endif + printf( " %d %d %d %d %f %d %s", + aFont.isEmbedded, + aFont.isBold, +@@ -939,11 +950,11 @@ void PDFOutDev::endTextObject(GfxState*) + } + + void PDFOutDev::drawImageMask(GfxState* pState, Object*, Stream* str, +- int width, int height, GBool invert, ++ int width, int height, poppler_bool invert, + #if POPPLER_CHECK_VERSION(0, 12, 0) +- GBool /*interpolate*/, ++ poppler_bool /*interpolate*/, + #endif +- GBool /*inlineImg*/ ) ++ poppler_bool /*inlineImg*/ ) + { + if (m_bSkipImages) + return; +@@ -972,9 +983,9 @@ void PDFOutDev::drawImageMask(GfxState* pState, Object*, Stream* str, + void PDFOutDev::drawImage(GfxState*, Object*, Stream* str, + int width, int height, GfxImageColorMap* colorMap, + #if POPPLER_CHECK_VERSION(0, 12, 0) +- GBool /*interpolate*/, ++ poppler_bool /*interpolate*/, + #endif +- int* maskColors, GBool /*inlineImg*/ ) ++ int* maskColors, poppler_bool /*inlineImg*/ ) + { + if (m_bSkipImages) + return; +@@ -1023,13 +1034,13 @@ void PDFOutDev::drawMaskedImage(GfxState*, Object*, Stream* str, + int width, int height, + GfxImageColorMap* colorMap, + #if POPPLER_CHECK_VERSION(0, 12, 0) +- GBool /*interpolate*/, ++ poppler_bool /*interpolate*/, + #endif + Stream* maskStr, + int maskWidth, int maskHeight, +- GBool maskInvert ++ poppler_bool maskInvert + #if POPPLER_CHECK_VERSION(0, 12, 0) +- , GBool /*maskInterpolate*/ ++ , poppler_bool /*maskInterpolate*/ + #endif + ) + { +@@ -1045,13 +1056,13 @@ void PDFOutDev::drawSoftMaskedImage(GfxState*, Object*, Stream* str, + int width, int height, + GfxImageColorMap* colorMap, + #if POPPLER_CHECK_VERSION(0, 12, 0) +- GBool /*interpolate*/, ++ poppler_bool /*interpolate*/, + #endif + Stream* maskStr, + int maskWidth, int maskHeight, + GfxImageColorMap* maskColorMap + #if POPPLER_CHECK_VERSION(0, 12, 0) +- , GBool /*maskInterpolate*/ ++ , poppler_bool /*maskInterpolate*/ + #endif + ) + { +diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx +index 7e65f085d..4b5c14d15 100644 +--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx ++++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx +@@ -129,6 +129,12 @@ namespace pdfi + GooString & getFamilyName() const + { return const_cast(familyName); } + }; ++ // Versions before 0.15 defined GBool as int; 0.15 redefined it as bool; 0.71 dropped GBool ++#if POPPLER_VERSION_MAJOR == 0 && POPPLER_VERSION_MINOR < 71 ++typedef GBool poppler_bool; ++#else ++typedef bool poppler_bool; ++#endif + + class PDFOutDev : public OutputDev + { +@@ -151,22 +157,26 @@ namespace pdfi + + // Does this device use upside-down coordinates? + // (Upside-down means (0,0) is the top left corner of the page.) +- virtual GBool upsideDown() override { return gTrue; } ++ virtual poppler_bool upsideDown() override { return true; } + + // Does this device use drawChar() or drawString()? +- virtual GBool useDrawChar() override { return gTrue; } ++ virtual poppler_bool useDrawChar() override { return true; } + + // Does this device use beginType3Char/endType3Char? Otherwise, + // text in Type 3 fonts will be drawn with drawChar/drawString. +- virtual GBool interpretType3Chars() override { return gFalse; } ++ virtual poppler_bool interpretType3Chars() override { return false; } + + // Does this device need non-text content? +- virtual GBool needNonText() override { return gTrue; } ++ virtual poppler_bool needNonText() override { return true; } + + //----- initialization and control + + // Set default transform matrix. ++#if POPPLER_CHECK_VERSION(0, 71, 0) ++ virtual void setDefaultCTM(const double *ctm) override; ++#else + virtual void setDefaultCTM(double *ctm) override; ++#endif + + // Start a page. + virtual void startPage(int pageNum, GfxState *state +@@ -233,40 +243,40 @@ namespace pdfi + + //----- image drawing + virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, +- int width, int height, GBool invert, ++ int width, int height, poppler_bool invert, + #if POPPLER_CHECK_VERSION(0, 12, 0) +- GBool interpolate, ++ poppler_bool interpolate, + #endif +- GBool inlineImg) override; ++ poppler_bool inlineImg) override; + virtual void drawImage(GfxState *state, Object *ref, Stream *str, + int width, int height, GfxImageColorMap *colorMap, + #if POPPLER_CHECK_VERSION(0, 12, 0) +- GBool interpolate, ++ poppler_bool interpolate, + #endif +- int *maskColors, GBool inlineImg) override; ++ int *maskColors, poppler_bool inlineImg) override; + virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, + int width, int height, + GfxImageColorMap *colorMap, + #if POPPLER_CHECK_VERSION(0, 12, 0) +- GBool interpolate, ++ poppler_bool interpolate, + #endif + Stream *maskStr, int maskWidth, int maskHeight, +- GBool maskInvert ++ poppler_bool maskInvert + #if POPPLER_CHECK_VERSION(0, 12, 0) +- , GBool maskInterpolate ++ , poppler_bool maskInterpolate + #endif + ) override; + virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, + int width, int height, + GfxImageColorMap *colorMap, + #if POPPLER_CHECK_VERSION(0, 12, 0) +- GBool interpolate, ++ poppler_bool interpolate, + #endif + Stream *maskStr, + int maskWidth, int maskHeight, + GfxImageColorMap *maskColorMap + #if POPPLER_CHECK_VERSION(0, 12, 0) +- , GBool maskInterpolate ++ , poppler_bool maskInterpolate + #endif + ) override; + +@@ -279,7 +289,7 @@ extern FILE* g_binary_out; + + // note: if you ever change Output_t, please keep in mind that the current code + // relies on it being of 8 bit size +-typedef Guchar Output_t; ++typedef unsigned char Output_t; + typedef std::vector< Output_t > OutputBuffer; + + #endif // INCLUDED_SDEXT_SOURCE_PDFIMPORT_XPDFWRAPPER_PDFIOUTDEV_GPL_HXX +diff --git a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx +index 44f30c0ba..66c175165 100644 +--- a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx ++++ b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx +@@ -242,7 +242,7 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, + appendIHDR( o_rOutputBuf, width, height, 8, 6 ); // RGBA image + + // initialize stream +- Guchar *p, *pm; ++ unsigned char *p, *pm; + GfxRGB rgb; + GfxGray alpha; + ImageStream* imgStr = +@@ -328,7 +328,7 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, + appendIHDR( o_rOutputBuf, width, height, 8, 6 ); // RGBA image + + // initialize stream +- Guchar *p; ++ unsigned char *p; + GfxRGB rgb; + ImageStream* imgStr = + new ImageStream(str, +@@ -374,7 +374,7 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, + { + for( int x = 0; x < maskWidth; ++x ) + { +- Guchar aPixel = 0; ++ unsigned char aPixel = 0; + imgStrMask->getPixel( &aPixel ); + int nIndex = (y*height/maskHeight) * (width*4+1) + // mapped line + (x*width/maskWidth)*4 + 1 + 3 // mapped column +diff --git a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx +index 16db05afe..cd559cab0 100644 +--- a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx ++++ b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx +@@ -69,7 +69,7 @@ int main(int argc, char **argv) + + // read config file + globalParams = new GlobalParams(); +- globalParams->setErrQuiet(gTrue); ++ globalParams->setErrQuiet(true); + #if defined(_MSC_VER) + globalParams->setupBaseFonts(nullptr); + #endif +@@ -143,7 +143,7 @@ int main(int argc, char **argv) + i, + PDFI_OUTDEV_RESOLUTION, + PDFI_OUTDEV_RESOLUTION, +- 0, gTrue, gTrue, gTrue); ++ 0, true, true, true); + rDoc.processLinks(&aOutDev, i); + } +