From 53bba3d3e7178f5e8759bdcc33a5665b05d3181f Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 13 Dec 2019 09:20:31 +0000 Subject: [PATCH 01/17] begun work on updating pdf2htmlEX to poppler-0.83.0 --- buildScripts/buildInstallLocally | 2 +- buildScripts/getPdf2htmlEX | 2 +- .../3rdparty/poppler/git/CairoFontEngine.cc | 5 +++-- .../3rdparty/poppler/git/CairoFontEngine.h | 4 ++-- .../3rdparty/poppler/git/CairoOutputDev.cc | 21 +++++++++---------- .../3rdparty/poppler/git/CairoOutputDev.h | 12 +++++------ .../3rdparty/poppler/git/CairoRescaleBox.cc | 6 +++--- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/buildScripts/buildInstallLocally b/buildScripts/buildInstallLocally index 4c15ffe..419c9c9 100755 --- a/buildScripts/buildInstallLocally +++ b/buildScripts/buildInstallLocally @@ -10,7 +10,7 @@ export MAKE_PARALLEL="-j $(nproc)" # choose one of the following... # -export PDF2HTMLEX_BRANCH=fontforge-update +export PDF2HTMLEX_BRANCH=update-poppler # export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" ################ diff --git a/buildScripts/getPdf2htmlEX b/buildScripts/getPdf2htmlEX index 7075601..abc7e18 100755 --- a/buildScripts/getPdf2htmlEX +++ b/buildScripts/getPdf2htmlEX @@ -3,7 +3,7 @@ # This bash script automates the process of getting the original pdf2htmlEX # source -PDF2HTMLEX_BRANCH=fontforge-update +PDF2HTMLEX_BRANCH=update-poppler echo "" echo "-------------------------------------------------------------------" diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc b/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc index 3a479e4..bcfa095 100644 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc +++ b/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc @@ -36,8 +36,9 @@ // //======================================================================== -#include +#include +#include "config.h" #include #include "CairoFontEngine.h" #include "CairoOutputDev.h" @@ -90,7 +91,7 @@ CairoFont::getFontFace(void) { unsigned long CairoFont::getGlyph(CharCode code, - Unicode *u, int uLen) { + const Unicode *u, int uLen) { FT_UInt gid; if (codeToGID && code < codeToGIDLen) { diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.h b/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.h index 2a55af1..34802c1 100644 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.h +++ b/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.h @@ -15,7 +15,7 @@ // under GPL version 2 or later // // Copyright (C) 2005, 2006 Kristian Høgsberg -// Copyright (C) 2005, 2018 Albert Astals Cid +// Copyright (C) 2005, 2018, 2019 Albert Astals Cid // Copyright (C) 2006, 2007 Jeff Muizelaar // Copyright (C) 2006, 2010 Carlos Garcia Campos // Copyright (C) 2008, 2017 Adrian Johnson @@ -54,7 +54,7 @@ public: virtual bool matches(Ref &other, bool printing); cairo_font_face_t *getFontFace(void); - unsigned long getGlyph(CharCode code, Unicode *u, int uLen); + unsigned long getGlyph(CharCode code, const Unicode *u, int uLen); double getSubstitutionCorrection(GfxFont *gfxFont); bool isSubstitute() { return substitute; } diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc b/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc index 846c81a..28f3ae6 100644 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc +++ b/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc @@ -38,7 +38,7 @@ // //======================================================================== -#include +#include #include #include @@ -712,7 +712,7 @@ void CairoOutputDev::updateFont(GfxState *state) { /* Align stroke coordinate i if the point is the start or end of a * horizontal or vertical line */ -void CairoOutputDev::alignStrokeCoords(GfxSubpath *subpath, int i, double *x, double *y) +void CairoOutputDev::alignStrokeCoords(const GfxSubpath *subpath, int i, double *x, double *y) { double x1, y1, x2, y2; bool align = false; @@ -752,13 +752,12 @@ void CairoOutputDev::alignStrokeCoords(GfxSubpath *subpath, int i, double *x, do #undef STROKE_COORD_TOLERANCE -void CairoOutputDev::doPath(cairo_t *c, GfxState *state, GfxPath *path) { - GfxSubpath *subpath; +void CairoOutputDev::doPath(cairo_t *c, GfxState *state, const GfxPath *path) { int i, j; double x, y; cairo_new_path (c); for (i = 0; i < path->getNumSubpaths(); ++i) { - subpath = path->getSubpath(i); + const GfxSubpath *subpath = path->getSubpath(i); if (subpath->getNumPoints() > 0) { if (align_stroke_coords) { alignStrokeCoords(subpath, 0, &x, &y); @@ -1395,7 +1394,7 @@ void CairoOutputDev::beginString(GfxState *state, const GooString *s) void CairoOutputDev::drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, - CharCode code, int nBytes, Unicode *u, int uLen) + CharCode code, int nBytes, const Unicode *u, int uLen) { if (currentFont) { glyphs[glyphCount].index = currentFont->getGlyph (code, u, uLen); @@ -1512,7 +1511,7 @@ finish: bool CairoOutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, - CharCode code, Unicode *u, int uLen) { + CharCode code, const Unicode *u, int uLen) { cairo_save (cairo); cairo_matrix_t matrix; @@ -3068,7 +3067,7 @@ private: GfxRGB *lookup; int width; GfxImageColorMap *colorMap; - int *maskColors; + const int *maskColors; int current_row; bool imageError; @@ -3078,7 +3077,7 @@ public: int scaledWidth, int scaledHeight, bool printing, GfxImageColorMap *colorMapA, - int *maskColorsA) { + const int *maskColorsA) { cairo_surface_t *image = nullptr; int i; @@ -3253,7 +3252,7 @@ void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int widthA, int heightA, GfxImageColorMap *colorMap, bool interpolate, - int *maskColors, bool inlineImg) + const int *maskColors, bool inlineImg) { cairo_surface_t *image; cairo_pattern_t *pattern, *maskPattern; @@ -3474,7 +3473,7 @@ void CairoImageOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, void CairoImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - bool interpolate, int *maskColors, bool inlineImg) + bool interpolate, const int *maskColors, bool inlineImg) { cairo_t *cr; cairo_surface_t *surface; diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.h b/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.h index 0fbbf0d..9e6f497 100644 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.h +++ b/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.h @@ -192,13 +192,13 @@ public: void drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, - CharCode code, int nBytes, Unicode *u, int uLen) override; + CharCode code, int nBytes, const Unicode *u, int uLen) override; void beginActualText(GfxState *state, const GooString *text) override; void endActualText(GfxState *state) override; bool beginType3Char(GfxState *state, double x, double y, double dx, double dy, - CharCode code, Unicode *u, int uLen) override; + CharCode code, const Unicode *u, int uLen) override; void endType3Char(GfxState *state) override; void beginTextObject(GfxState *state) override; void endTextObject(GfxState *state) override; @@ -221,7 +221,7 @@ public: void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - bool interpolate, int *maskColors, bool inlineImg) override; + bool interpolate, const int *maskColors, bool inlineImg) override; void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, @@ -274,7 +274,7 @@ public: double *getType3GlyphBBox () { return t3_glyph_bbox; } protected: - void doPath(cairo_t *cairo, GfxState *state, GfxPath *path); + void doPath(cairo_t *cairo, GfxState *state, const GfxPath *path); cairo_surface_t *downscaleSurface(cairo_surface_t *orig_surface); void getScaledSize(const cairo_matrix_t *matrix, int orig_width, int orig_height, @@ -285,7 +285,7 @@ protected: void setMimeData(GfxState *state, Stream *str, Object *ref, GfxImageColorMap *colorMap, cairo_surface_t *image, int height); void fillToStrokePathClip(GfxState *state); - void alignStrokeCoords(GfxSubpath *subpath, int i, double *x, double *y); + void alignStrokeCoords(const GfxSubpath *subpath, int i, double *x, double *y); #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0) bool setMimeDataForJBIG2Globals (Stream *str, cairo_surface_t *image); #endif @@ -469,7 +469,7 @@ public: bool interpolate, bool inlineImg) override; void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - bool interpolate, int *maskColors, bool inlineImg) override; + bool interpolate, const int *maskColors, bool inlineImg) override; void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc b/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc index 2c0e1ed..04b0955 100644 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc +++ b/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc @@ -44,7 +44,7 @@ /* This implements a box filter that supports non-integer box sizes */ -#include +#include #include #include @@ -62,8 +62,8 @@ static void downsample_row_box_filter ( int start, int width, - uint32_t *src, uint32_t *src_limit, uint32_t *dest, - int coverage[], int pixel_coverage) + uint32_t *src, const uint32_t *src_limit, uint32_t *dest, + const int coverage[], int pixel_coverage) { /* we need an array of the pixel contribution of each destination pixel on the boundaries. * we invert the value to get the value on the other size of the box */ From 59dcc07638897cd6803d40fe9237b7bc839c146c Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 13 Dec 2019 09:24:01 +0000 Subject: [PATCH 02/17] bumped poppler version --- buildScripts/versionEnvs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index 54b12f4..569db01 100755 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -3,8 +3,9 @@ # This bash script exports environment variables for the latest software # versions +export POPPLER_VERSION=poppler-0.83.0 #export POPPLER_VERSION=poppler-0.82.0 -export POPPLER_VERSION=poppler-0.81.0 +#export POPPLER_VERSION=poppler-0.81.0 export FONTFORGE_VERSION=20190801 #export FONTFORGE_VERSION=20170731 From a8323f1c16ce0eb123f0ba85279a315354674ce4 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 13 Dec 2019 11:27:54 +0000 Subject: [PATCH 03/17] initial pass at updating pdf2htmlEX to use poppler-0.83.0 --- pdf2htmlEX/CMakeLists.txt | 6 ++++-- .../CairoBackgroundRenderer.cc | 2 +- .../BackgroundRenderer/CairoBackgroundRenderer.h | 2 +- .../SplashBackgroundRenderer.cc | 2 +- .../SplashBackgroundRenderer.h | 2 +- pdf2htmlEX/src/DrawingTracer.cc | 8 ++++---- pdf2htmlEX/src/DrawingTracer.h | 2 +- pdf2htmlEX/src/HTMLRenderer/HTMLRenderer.h | 4 +++- pdf2htmlEX/src/HTMLRenderer/font.cc | 3 ++- pdf2htmlEX/src/HTMLRenderer/image.cc | 4 +++- pdf2htmlEX/src/HTMLRenderer/text.cc | 2 +- pdf2htmlEX/src/Preprocessor.cc | 2 +- pdf2htmlEX/src/Preprocessor.h | 2 +- pdf2htmlEX/src/pdf2htmlEX.cc | 16 +++++++++++----- pdf2htmlEX/src/util/unicode.cc | 2 +- pdf2htmlEX/src/util/unicode.h | 2 +- 16 files changed, 37 insertions(+), 24 deletions(-) diff --git a/pdf2htmlEX/CMakeLists.txt b/pdf2htmlEX/CMakeLists.txt index 68d77c7..3f65ae7 100644 --- a/pdf2htmlEX/CMakeLists.txt +++ b/pdf2htmlEX/CMakeLists.txt @@ -82,9 +82,11 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Woverloaded-virtual") # CYGWIN or GCC 4.5.x bug if(CYGWIN) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x") +# was: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x") +# the following change is untested: +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14") else() -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -pthread") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -pthread") endif() # check the C++11 features we need diff --git a/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.cc b/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.cc index a7eaed8..ae5c809 100644 --- a/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.cc +++ b/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.cc @@ -46,7 +46,7 @@ CairoBackgroundRenderer::~CairoBackgroundRenderer() void CairoBackgroundRenderer::drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, - CharCode code, int nBytes, Unicode *u, int uLen) + CharCode code, int nBytes, const Unicode *u, int uLen) { // draw characters as image when // - in fallback mode diff --git a/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.h b/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.h index d5c8637..f8bbc07 100644 --- a/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.h +++ b/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.h @@ -42,7 +42,7 @@ public: virtual void drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, - CharCode code, int nBytes, Unicode *u, int uLen); + CharCode code, int nBytes, const Unicode *u, int uLen); //for proof void beginTextObject(GfxState *state); diff --git a/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc b/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc index be14222..757f0a1 100644 --- a/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc +++ b/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc @@ -65,7 +65,7 @@ void SplashBackgroundRenderer::startPage(int pageNum, GfxState *state, XRef *xre void SplashBackgroundRenderer::drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, - CharCode code, int nBytes, Unicode *u, int uLen) + CharCode code, int nBytes, const Unicode *u, int uLen) { if (param.proof || html_renderer->is_char_covered(drawn_char_count)) { SplashOutputDev::drawChar(state,x,y,dx,dy,originX,originY,code,nBytes,u,uLen); diff --git a/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.h b/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.h index 55baeb3..b8e07c0 100644 --- a/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.h +++ b/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.h @@ -44,7 +44,7 @@ public: virtual void drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, - CharCode code, int nBytes, Unicode *u, int uLen); + CharCode code, int nBytes, const Unicode *u, int uLen); //for proof void beginTextObject(GfxState *state); diff --git a/pdf2htmlEX/src/DrawingTracer.cc b/pdf2htmlEX/src/DrawingTracer.cc index 7086565..5d23d42 100644 --- a/pdf2htmlEX/src/DrawingTracer.cc +++ b/pdf2htmlEX/src/DrawingTracer.cc @@ -136,10 +136,10 @@ void DrawingTracer::restore() #endif } -void DrawingTracer::do_path(GfxState * state, GfxPath * path) +void DrawingTracer::do_path(GfxState * state, const GfxPath * path) { //copy from CairoOutputDev::doPath - GfxSubpath *subpath; + const GfxSubpath *subpath; int i, j; double x, y; cairo_new_path(cairo); @@ -220,9 +220,9 @@ void DrawingTracer::stroke(GfxState * state) break; } - GfxPath * path = state->getPath(); + const GfxPath * path = state->getPath(); for (int i = 0; i < path->getNumSubpaths(); ++i) { - GfxSubpath * subpath = path->getSubpath(i); + const GfxSubpath * subpath = path->getSubpath(i); if (subpath->getNumPoints() <= 0) continue; double x = subpath->getX(0); diff --git a/pdf2htmlEX/src/DrawingTracer.h b/pdf2htmlEX/src/DrawingTracer.h index 3a0bc88..0d186d0 100644 --- a/pdf2htmlEX/src/DrawingTracer.h +++ b/pdf2htmlEX/src/DrawingTracer.h @@ -65,7 +65,7 @@ public: private: void finish(); // Following methods operate in user space (just before CTM is applied) - void do_path(GfxState * state, GfxPath * path); + void do_path(GfxState * state, const GfxPath * path); void draw_non_char_bbox(GfxState * state, double * bbox, int what); void draw_char_bbox(GfxState * state, double * bbox, int inTransparencyGroup); // If cairo is available, parameter state is ignored diff --git a/pdf2htmlEX/src/HTMLRenderer/HTMLRenderer.h b/pdf2htmlEX/src/HTMLRenderer/HTMLRenderer.h index c71d282..6f2c24c 100644 --- a/pdf2htmlEX/src/HTMLRenderer/HTMLRenderer.h +++ b/pdf2htmlEX/src/HTMLRenderer/HTMLRenderer.h @@ -156,7 +156,9 @@ struct HTMLRenderer : OutputDev virtual void drawString(GfxState * state, const GooString * s); - virtual void drawImage(GfxState * state, Object * ref, Stream * str, int width, int height, GfxImageColorMap * colorMap, bool interpolate, int *maskColors, bool inlineImg); + virtual void drawImage(GfxState * state, Object * ref, Stream * str, + int width, int height, GfxImageColorMap * colorMap, + bool interpolate, const int *maskColors, bool inlineImg); virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, diff --git a/pdf2htmlEX/src/HTMLRenderer/font.cc b/pdf2htmlEX/src/HTMLRenderer/font.cc index 3392a9e..466f691 100644 --- a/pdf2htmlEX/src/HTMLRenderer/font.cc +++ b/pdf2htmlEX/src/HTMLRenderer/font.cc @@ -636,7 +636,8 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo if(mapped_code > max_key) max_key = mapped_code; - Unicode u, *pu=&u; + Unicode u; + Unicode const *pu=&u; if(info.use_tounicode) { int n = ctu ? diff --git a/pdf2htmlEX/src/HTMLRenderer/image.cc b/pdf2htmlEX/src/HTMLRenderer/image.cc index ef51ffc..b4d84cc 100644 --- a/pdf2htmlEX/src/HTMLRenderer/image.cc +++ b/pdf2htmlEX/src/HTMLRenderer/image.cc @@ -12,7 +12,9 @@ namespace pdf2htmlEX { -void HTMLRenderer::drawImage(GfxState * state, Object * ref, Stream * str, int width, int height, GfxImageColorMap * colorMap, bool interpolate, int *maskColors, bool inlineImg) +void HTMLRenderer::drawImage(GfxState * state, Object * ref, Stream * str, + int width, int height, GfxImageColorMap * colorMap, + bool interpolate, const int *maskColors, bool inlineImg) { tracer.draw_image(state); diff --git a/pdf2htmlEX/src/HTMLRenderer/text.cc b/pdf2htmlEX/src/HTMLRenderer/text.cc index 06df7aa..506f947 100644 --- a/pdf2htmlEX/src/HTMLRenderer/text.cc +++ b/pdf2htmlEX/src/HTMLRenderer/text.cc @@ -74,7 +74,7 @@ void HTMLRenderer::drawString(GfxState * state, const GooString * s) int uLen; CharCode code; - Unicode *u = nullptr; + Unicode const *u = nullptr; HR_DEBUG(printf("HTMLRenderer::drawString:len=%d\n", len)); diff --git a/pdf2htmlEX/src/Preprocessor.cc b/pdf2htmlEX/src/Preprocessor.cc index 42318b2..643bbc7 100644 --- a/pdf2htmlEX/src/Preprocessor.cc +++ b/pdf2htmlEX/src/Preprocessor.cc @@ -65,7 +65,7 @@ void Preprocessor::process(PDFDoc * doc) void Preprocessor::drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, - CharCode code, int nBytes, Unicode *u, int uLen) + CharCode code, int nBytes, const Unicode *u, int uLen) { GfxFont * font = state->getFont(); if(!font) return; diff --git a/pdf2htmlEX/src/Preprocessor.h b/pdf2htmlEX/src/Preprocessor.h index d121b59..756993d 100644 --- a/pdf2htmlEX/src/Preprocessor.h +++ b/pdf2htmlEX/src/Preprocessor.h @@ -39,7 +39,7 @@ public: virtual void drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, - CharCode code, int nBytes, Unicode *u, int uLen); + CharCode code, int nBytes, const Unicode *u, int uLen); // Start a page. // UGLY: These 2 versions are for different versions of poppler diff --git a/pdf2htmlEX/src/pdf2htmlEX.cc b/pdf2htmlEX/src/pdf2htmlEX.cc index 3223752..edf32ee 100644 --- a/pdf2htmlEX/src/pdf2htmlEX.cc +++ b/pdf2htmlEX/src/pdf2htmlEX.cc @@ -407,8 +407,11 @@ int main(int argc, char **argv) param.tmp_dir.c_str()); bool finished = false; - // read config file - globalParams = new GlobalParams(!param.poppler_data_dir.empty() ? param.poppler_data_dir.c_str() : NULL); + // read poppler config file + globalParams = std::make_unique( + !param.poppler_data_dir.empty() ? param.poppler_data_dir.c_str() : NULL + ); + // open PDF file PDFDoc * doc = nullptr; try @@ -435,8 +438,11 @@ int main(int argc, char **argv) cerr << "Document has copy-protection bit set." << endl; } - param.first_page = min(max(param.first_page, 1), doc->getNumPages()); - param.last_page = min(max(param.last_page, param.first_page), doc->getNumPages()); + param.first_page = + min(max(param.first_page, 1), doc->getNumPages()); + param.last_page = + min(max(param.last_page, param.first_page), + doc->getNumPages()); unique_ptr(new HTMLRenderer(argv[0], param))->process(doc); @@ -454,7 +460,7 @@ int main(int argc, char **argv) // clean up delete doc; - delete globalParams; + globalParams.reset(); // check for memory leaks // Poppler Object class (Object.h) no longer has memCheck diff --git a/pdf2htmlEX/src/util/unicode.cc b/pdf2htmlEX/src/util/unicode.cc index 31ec4f8..2ebc88e 100644 --- a/pdf2htmlEX/src/util/unicode.cc +++ b/pdf2htmlEX/src/util/unicode.cc @@ -55,7 +55,7 @@ Unicode unicode_from_font (CharCode code, GfxFont * font) return map_to_private(code); } -Unicode check_unicode(Unicode * u, int len, CharCode code, GfxFont * font) +Unicode check_unicode(Unicode const * u, int len, CharCode code, GfxFont * font) { if(len == 0) return map_to_private(code); diff --git a/pdf2htmlEX/src/util/unicode.h b/pdf2htmlEX/src/util/unicode.h index c789dea..d4a5d48 100644 --- a/pdf2htmlEX/src/util/unicode.h +++ b/pdf2htmlEX/src/util/unicode.h @@ -83,7 +83,7 @@ Unicode unicode_from_font (CharCode code, GfxFont * font); * if we got multi-unicode values, it might be expanded ligature, try to restore it * if we cannot figure it out at the end, use a private mapping */ -Unicode check_unicode(Unicode * u, int len, CharCode code, GfxFont * font); +Unicode check_unicode(Unicode const * u, int len, CharCode code, GfxFont * font); } // namespace pdf2htmlEX From 1d29159ecbc1e9615c7d4a755b13e3945b4d0a02 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 13 Dec 2019 11:44:20 +0000 Subject: [PATCH 04/17] added build script to list files by change times --- buildScripts/listFilesByChangeTime | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 buildScripts/listFilesByChangeTime diff --git a/buildScripts/listFilesByChangeTime b/buildScripts/listFilesByChangeTime new file mode 100755 index 0000000..e88213f --- /dev/null +++ b/buildScripts/listFilesByChangeTime @@ -0,0 +1,9 @@ +#!/bin/bash + +# see:https://stackoverflow.com/a/7448828 + +find . -type f -print0 | \ + xargs -0 stat --format '%Y :%y %n' | \ + sort -nr | \ + grep -v build | \ + cut -d: -f2- From 4007aa64e544ed9b051ef822f5417b7f55748514 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 13 Dec 2019 12:06:45 +0000 Subject: [PATCH 05/17] corrected 3rdParty poppler files --- pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc | 3 +-- pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc | 2 +- pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc b/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc index bcfa095..776b6de 100644 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc +++ b/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc @@ -36,9 +36,8 @@ // //======================================================================== -#include +#include -#include "config.h" #include #include "CairoFontEngine.h" #include "CairoOutputDev.h" diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc b/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc index 28f3ae6..0f3c156 100644 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc +++ b/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc @@ -38,7 +38,7 @@ // //======================================================================== -#include +#include #include #include diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc b/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc index 04b0955..1c7ccd1 100644 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc +++ b/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc @@ -44,7 +44,7 @@ /* This implements a box filter that supports non-integer box sizes */ -#include +#include #include #include From 99fc35b8b517f6332633fbc6d08346266ea567d7 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 13 Dec 2019 13:44:50 +0000 Subject: [PATCH 06/17] corrected font forge build --- buildScripts/buildFontforge | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 9df9001..a2f75b3 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -16,23 +16,18 @@ echo "" # # see: https://github.com/travis-ci/travis-ci/issues/5301 (unfixed) # -if [ -n "$PYTHON_CFLAGS" ] ; then - export PYTHON_CFLAGS="$(python3-config --cflags) $PYTHON_CFLAGS" -fi - -if [ -n "$PYTHON_LIBS" ] ; then - export PYTHON_LIBS="$(python3-config --ldflags) $PYTHON_LIBS" -fi echo "" echo "PYTHON_CFLAGS:" echo "-------------------------------" +export PYTHON_CFLAGS="$(python3-config --cflags) $PYTHON_CFLAGS" echo $PYTHON_CFLAGS echo "-------------------------------" echo "" echo "" echo "PYTHON_LIBS:" echo "-------------------------------" +export PYTHON_LIBS="$(python3-config --ldflags) $PYTHON_LIBS" echo $PYTHON_LIBS echo "-------------------------------" echo "" From c75471f1315aad0a6b415cfc91ed7187892f8f5f Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 13 Dec 2019 14:26:05 +0000 Subject: [PATCH 07/17] turned travis back on --- .travis.yml.off => .travis.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .travis.yml.off => .travis.yml (100%) diff --git a/.travis.yml.off b/.travis.yml similarity index 100% rename from .travis.yml.off rename to .travis.yml From 34da5a01a0111136db86b6a786c08b7aeea5d024 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 13 Dec 2019 14:33:16 +0000 Subject: [PATCH 08/17] pushed again to force travis --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e86e656..c4bd168 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build Status](https://travis-ci.org/pdf2htmlEX/pdf2htmlEX.svg?branch=master)](https://travis-ci.org/pdf2htmlEX/pdf2htmlEX) -# Differences from upstream pdf2htmlEX: +# Differences from upstream pdf2htmlEX: This is my branch of pdf2htmlEX which aims to allow an open collaboration to help keep the project active. A number of changes and improvements have been incorperated from other forks: From 23830c24f0921e70af006bb57fae93501fadb26b Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 13 Dec 2019 21:54:01 +0000 Subject: [PATCH 09/17] corrected travis homebrew to remove python 2 --- buildScripts/travisHomeBrewDoItAll | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll index cbc2879..d04f76d 100755 --- a/buildScripts/travisHomeBrewDoItAll +++ b/buildScripts/travisHomeBrewDoItAll @@ -26,23 +26,23 @@ echo $LDFLAGS echo $CPPFLAGS which clang echo "-------------------------------------------------" -brew install llvm -brew install -v python@2 -brew install jq +#brew install llvm +#brew install -v python@2 +#brew install jq echo "-------------------------------------------------" echo $PATH echo $LDFLAGS echo $CPPFLAGS which clang -export llvmVersion=$(brew info --json=v1 llvm | jq '.[].installed[].version' | tr -d '"') +#export llvmVersion=$(brew info --json=v1 llvm | jq '.[].installed[].version' | tr -d '"') echo $llvmVersion -export python2Version=$(brew info --json=v1 python@2 | jq '.[].installed[].version' | tr -d '"') +#export python2Version=$(brew info --json=v1 python@2 | jq '.[].installed[].version' | tr -d '"') echo $python2Version echo "-------------------------------------------------" -brew info llvm -brew switch llvm $llvmVersion -brew info python@2 -brew switch python@2 $python2Version +#brew info llvm +#brew switch llvm $llvmVersion +#brew info python@2 +#brew switch python@2 $python2Version echo "-------------------------------------------------" echo $PATH echo $LDFLAGS From 5fc7d42a1656e3280f0dc336bf1a5a80520bb592 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 17 Dec 2019 06:15:03 +0000 Subject: [PATCH 10/17] added get tools and libraries using both apt and brew --- buildScripts/buildInstallLocally | 41 ------------------- buildScripts/buildInstallLocallyApt | 41 +++++++++++++++++++ buildScripts/buildInstallLocallyBrew | 41 +++++++++++++++++++ .../{getBuildTools => getBuildToolsApt} | 0 buildScripts/getBuildToolsBrew | 24 +++++++++++ .../{getDevLibraries => getDevLibrariesApt} | 0 buildScripts/getDevLibrariesBrew | 21 ++++++++++ buildScripts/getPoppler | 8 ++++ 8 files changed, 135 insertions(+), 41 deletions(-) delete mode 100755 buildScripts/buildInstallLocally create mode 100755 buildScripts/buildInstallLocallyApt create mode 100755 buildScripts/buildInstallLocallyBrew rename buildScripts/{getBuildTools => getBuildToolsApt} (100%) create mode 100755 buildScripts/getBuildToolsBrew rename buildScripts/{getDevLibraries => getDevLibrariesApt} (100%) create mode 100755 buildScripts/getDevLibrariesBrew diff --git a/buildScripts/buildInstallLocally b/buildScripts/buildInstallLocally deleted file mode 100755 index 419c9c9..0000000 --- a/buildScripts/buildInstallLocally +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -# This bash script builds the complete pdf2htmlEX application LOCALLY -# (It does not create the AppImage or Docker images) - -# Adjust the following two environment variables to suit your needs -# -export UNATTENDED="--assume-yes" -export MAKE_PARALLEL="-j $(nproc)" - -# choose one of the following... -# -export PDF2HTMLEX_BRANCH=update-poppler -# export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" - -################ -# do the build - -./buildScripts/versionEnvs || { echo 'versionEnvs FAILED' ; exit 1 ; } - -./buildScripts/reportEnvs || { echo 'reportEnvs FAILED' ; exit 1 ; } - -./buildScripts/getBuildTools || { echo 'getBuildTools FAILED' ; exit 1 ; } - -./buildScripts/getDevLibraries || { echo 'getDevLibraries FAILED' ; exit 1 ; } - -./buildScripts/getPoppler || { echo 'getPoppler FAILED' ; exit 1 ; } - -./buildScripts/buildPoppler || { echo 'buildPoppler FAILED' ; exit 1 ; } - -./buildScripts/installPoppler || { echo 'installPoppler FAILED' ; exit 1 ; } - -./buildScripts/getFontforge || { echo 'getFontforge FAILED' ; exit 1 ; } - -./buildScripts/buildFontforge || { echo 'buildFontforge FAILED' ; exit 1 ; } - -./buildScripts/installFontforge || { echo 'installFontforge FAILED' ; exit 1 ; } - -./buildScripts/buildPdf2htmlEX || { echo 'buildPdf2htmlEX FAILED' ; exit 1 ; } - -./buildScripts/installPdf2htmlEX || { echo 'installPdf2htmlEX FAILED' ; exit 1 ; } diff --git a/buildScripts/buildInstallLocallyApt b/buildScripts/buildInstallLocallyApt new file mode 100755 index 0000000..49ba59c --- /dev/null +++ b/buildScripts/buildInstallLocallyApt @@ -0,0 +1,41 @@ +#!/bin/bash + +# This bash script builds the complete pdf2htmlEX application LOCALLY +# (It does not create the AppImage or Docker images) + +# Adjust the following two environment variables to suit your needs +# +export UNATTENDED="--assume-yes" +export MAKE_PARALLEL="-j $(nproc)" + +# choose one of the following... +# +export PDF2HTMLEX_BRANCH=update-poppler +# export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" + +################ +# do the build + +./buildScripts/versionEnvs || { echo 'versionEnvs FAILED' ; exit 1 ; } + +./buildScripts/reportEnvs || { echo 'reportEnvs FAILED' ; exit 1 ; } + +./buildScripts/getBuildToolsApt || { echo 'getBuildToolsApt FAILED' ; exit 1 ; } + +./buildScripts/getDevLibrariesApt || { echo 'getDevLibrariesApt FAILED' ; exit 1 ; } + +./buildScripts/getPoppler || { echo 'getPoppler FAILED' ; exit 1 ; } + +./buildScripts/buildPoppler || { echo 'buildPoppler FAILED' ; exit 1 ; } + +./buildScripts/installPoppler || { echo 'installPoppler FAILED' ; exit 1 ; } + +./buildScripts/getFontforge || { echo 'getFontforge FAILED' ; exit 1 ; } + +./buildScripts/buildFontforge || { echo 'buildFontforge FAILED' ; exit 1 ; } + +./buildScripts/installFontforge || { echo 'installFontforge FAILED' ; exit 1 ; } + +./buildScripts/buildPdf2htmlEX || { echo 'buildPdf2htmlEX FAILED' ; exit 1 ; } + +./buildScripts/installPdf2htmlEX || { echo 'installPdf2htmlEX FAILED' ; exit 1 ; } diff --git a/buildScripts/buildInstallLocallyBrew b/buildScripts/buildInstallLocallyBrew new file mode 100755 index 0000000..aa32c7c --- /dev/null +++ b/buildScripts/buildInstallLocallyBrew @@ -0,0 +1,41 @@ +#!/bin/bash + +# This bash script builds the complete pdf2htmlEX application LOCALLY +# (It does not create the AppImage or Docker images) + +# Adjust the following two environment variables to suit your needs +# +export UNATTENDED="--assume-yes" +export MAKE_PARALLEL="-j $(nproc)" + +# choose one of the following... +# +export PDF2HTMLEX_BRANCH=update-poppler +# export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" + +################ +# do the build + +./buildScripts/versionEnvs || { echo 'versionEnvs FAILED' ; exit 1 ; } + +./buildScripts/reportEnvs || { echo 'reportEnvs FAILED' ; exit 1 ; } + +./buildScripts/getBuildToolsBrew || { echo 'getBuildToolsBrew FAILED' ; exit 1 ; } + +./buildScripts/getDevLibrariesBrew || { echo 'getDevLibrariesBrew FAILED' ; exit 1 ; } + +./buildScripts/getPoppler || { echo 'getPoppler FAILED' ; exit 1 ; } + +./buildScripts/buildPoppler || { echo 'buildPoppler FAILED' ; exit 1 ; } + +./buildScripts/installPoppler || { echo 'installPoppler FAILED' ; exit 1 ; } + +./buildScripts/getFontforge || { echo 'getFontforge FAILED' ; exit 1 ; } + +./buildScripts/buildFontforge || { echo 'buildFontforge FAILED' ; exit 1 ; } + +./buildScripts/installFontforge || { echo 'installFontforge FAILED' ; exit 1 ; } + +./buildScripts/buildPdf2htmlEX || { echo 'buildPdf2htmlEX FAILED' ; exit 1 ; } + +./buildScripts/installPdf2htmlEX || { echo 'installPdf2htmlEX FAILED' ; exit 1 ; } diff --git a/buildScripts/getBuildTools b/buildScripts/getBuildToolsApt similarity index 100% rename from buildScripts/getBuildTools rename to buildScripts/getBuildToolsApt diff --git a/buildScripts/getBuildToolsBrew b/buildScripts/getBuildToolsBrew new file mode 100755 index 0000000..1ee11e1 --- /dev/null +++ b/buildScripts/getBuildToolsBrew @@ -0,0 +1,24 @@ +#!/bin/bash + +# This bash script automates getting the required build tools (brew install) + +echo "" +echo "-------------------------------------------------------------------" +echo "INSTALLING Build Tools (using Home/Linux Brew)" +echo "-------------------------------------------------------------------" +echo "" + +brew update +brew install \ + git \ + pkg-config \ + ruby \ + autoconf \ + libtool \ + cmake \ + make \ + gcc \ + gettext \ + openjdk \ + jq \ + tree diff --git a/buildScripts/getDevLibraries b/buildScripts/getDevLibrariesApt similarity index 100% rename from buildScripts/getDevLibraries rename to buildScripts/getDevLibrariesApt diff --git a/buildScripts/getDevLibrariesBrew b/buildScripts/getDevLibrariesBrew new file mode 100755 index 0000000..0938300 --- /dev/null +++ b/buildScripts/getDevLibrariesBrew @@ -0,0 +1,21 @@ +#!/bin/bash + +# This bash script automates getting the development libraries required to +# build poppler and fontforge (using Home/Linux Brew) + +echo "" +echo "-------------------------------------------------------------------" +echo "INSTALLING development libraries (using Home/Linux Brew)" +echo "-------------------------------------------------------------------" +echo "" + +brew update +brew install \ + cairo \ + libspiro \ + libpng \ + jpeg \ + pango \ + little-cms2 \ + libxml2 \ + libuninameslist \ diff --git a/buildScripts/getPoppler b/buildScripts/getPoppler index ca25e1c..528cfe4 100755 --- a/buildScripts/getPoppler +++ b/buildScripts/getPoppler @@ -21,4 +21,12 @@ wget https://poppler.freedesktop.org/$POPPLER_VERSION.tar.xz tar xvf $POPPLER_VERSION.tar.xz +echo "Getting poppler-data version: 0.4.9" + mv $POPPLER_VERSION poppler + +wget https://poppler.freedesktop.org/poppler-data-0.4.9.tar.gz + +tar xvf poppler-data-0.4.9.tar.gz + +mv poppler-data-0.4.9 poppler-data From 45e6d8e80b1b79eccaec4c921c38a4f4f777177d Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 17 Dec 2019 16:01:02 +0000 Subject: [PATCH 11/17] updated how poppler-data in built --- buildScripts/buildPoppler | 4 ++++ buildScripts/createAppImage | 6 +++++- buildScripts/createDockerImage | 6 +++++- buildScripts/getDevLibrariesApt | 1 - 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/buildScripts/buildPoppler b/buildScripts/buildPoppler index 52df3e9..baf305b 100755 --- a/buildScripts/buildPoppler +++ b/buildScripts/buildPoppler @@ -14,3 +14,7 @@ cd build cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \ -DENABLE_LIBOPENJPEG=none .. make $MAKE_PARALLEL + +cd ../../poppler-data + +make install prefix=/usr/local diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index 4ebebd6..6fe9eb8 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -25,7 +25,11 @@ sudo rm -rf install_manifest.txt make install DESTDIR=../../imageBuild/appDir -cd ../../imageBuild +cd ../../poppler-data + +make install DESTDIR=../../imageBuild/appDir + +cd ../imageBuild # force libfontconfig into AppImage (linuxdeploy blacklists libfontconfig) # diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index 71e2287..e31daa4 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -48,7 +48,11 @@ echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> buildScripts/reSourceVersi make install DESTDIR=../../imageBuild/dockerDir - cd ../../imageBuild/dockerDir + cd ../../poppler-data + + make install DESTDIR=../../imageBuild/dockerDir + + cd ../imageBuild/dockerDir copy_deps diff --git a/buildScripts/getDevLibrariesApt b/buildScripts/getDevLibrariesApt index dadc2e4..ce518a2 100755 --- a/buildScripts/getDevLibrariesApt +++ b/buildScripts/getDevLibrariesApt @@ -19,7 +19,6 @@ sudo apt-get $UNATTENDED install \ libspiro-dev \ libpng-dev \ libjpeg-dev \ - poppler-data \ libpango1.0-dev \ liblcms2-dev \ libxml2-dev \ From c46d2ad73347821447ce96604e0bb0b8293114b7 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 17 Dec 2019 16:06:00 +0000 Subject: [PATCH 12/17] create getPdf2htmlEXBrew for home/linux brew users --- .../{getPdf2htmlEX => getPdf2htmlEXApt} | 0 buildScripts/getPdf2htmlEXBrew | 24 +++++++++++++++++++ 2 files changed, 24 insertions(+) rename buildScripts/{getPdf2htmlEX => getPdf2htmlEXApt} (100%) create mode 100755 buildScripts/getPdf2htmlEXBrew diff --git a/buildScripts/getPdf2htmlEX b/buildScripts/getPdf2htmlEXApt similarity index 100% rename from buildScripts/getPdf2htmlEX rename to buildScripts/getPdf2htmlEXApt diff --git a/buildScripts/getPdf2htmlEXBrew b/buildScripts/getPdf2htmlEXBrew new file mode 100755 index 0000000..4754fe0 --- /dev/null +++ b/buildScripts/getPdf2htmlEXBrew @@ -0,0 +1,24 @@ +#!/bin/bash + +# This bash script automates the process of getting the original pdf2htmlEX +# source + +PDF2HTMLEX_BRANCH=update-poppler + +echo "" +echo "-------------------------------------------------------------------" +echo "GETTING pdf2htmlEX sources (using wget)" +echo " (PDF2HTMLEX_BRANCH: [$PDF2HTMLEX_BRANCH])" +echo "-------------------------------------------------------------------" +echo "" + + +wget https://codeload.github.com/stephengaito/pdf2htmlEX/zip/$PDF2HTMLEX_BRANCH + +mv $PDF2HTMLEX_BRANCH $PDF2HTMLEX_BRANCH.zip + +brew install unzip + +unzip $PDF2HTMLEX_BRANCH.zip + +mv pdf2htmlEX-$PDF2HTMLEX_BRANCH pdf2htmlEX From 8f496afa8b894167386bb3997e647973ed6331e4 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 17 Dec 2019 16:23:39 +0000 Subject: [PATCH 13/17] refactored install directory to PDF2HTMLEX_PREFIX --- buildScripts/buildFontforge | 2 +- buildScripts/buildInstallLocallyApt | 2 ++ buildScripts/buildInstallLocallyBrew | 2 ++ buildScripts/buildPdf2htmlEX | 2 +- buildScripts/buildPdf2htmlEXClang | 2 +- buildScripts/buildPoppler | 6 +----- buildScripts/createAppImage | 10 +++++----- buildScripts/createDockerImage | 2 +- buildScripts/installPoppler | 23 ++++++++++++++--------- 9 files changed, 28 insertions(+), 23 deletions(-) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index a2f75b3..c41fd68 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -40,7 +40,7 @@ cd fontforge ./bootstrap ./configure \ - --prefix=/usr/local \ + --prefix=$PDF2HTMLEX_PREFIX \ --enable-python-scripting=3 \ --disable-dependency-tracking \ --disable-silent-rules \ diff --git a/buildScripts/buildInstallLocallyApt b/buildScripts/buildInstallLocallyApt index 49ba59c..75b45bd 100755 --- a/buildScripts/buildInstallLocallyApt +++ b/buildScripts/buildInstallLocallyApt @@ -13,6 +13,8 @@ export MAKE_PARALLEL="-j $(nproc)" export PDF2HTMLEX_BRANCH=update-poppler # export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" +export PDF2HTMLEX_PREFIX=/usr/local + ################ # do the build diff --git a/buildScripts/buildInstallLocallyBrew b/buildScripts/buildInstallLocallyBrew index aa32c7c..1cb4849 100755 --- a/buildScripts/buildInstallLocallyBrew +++ b/buildScripts/buildInstallLocallyBrew @@ -13,6 +13,8 @@ export MAKE_PARALLEL="-j $(nproc)" export PDF2HTMLEX_BRANCH=update-poppler # export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" +export PDF2HTMLEX_PREFIX=toBeDetermined + ################ # do the build diff --git a/buildScripts/buildPdf2htmlEX b/buildScripts/buildPdf2htmlEX index 1d49382..cf6dd00 100755 --- a/buildScripts/buildPdf2htmlEX +++ b/buildScripts/buildPdf2htmlEX @@ -11,5 +11,5 @@ echo "" cd pdf2htmlEX mkdir build cd build -cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local .. +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PDF2HTMLEX_PREFIX .. make $MAKE_PARALLEL diff --git a/buildScripts/buildPdf2htmlEXClang b/buildScripts/buildPdf2htmlEXClang index 3ea3a3f..eb65509 100755 --- a/buildScripts/buildPdf2htmlEXClang +++ b/buildScripts/buildPdf2htmlEXClang @@ -11,5 +11,5 @@ echo "" cd pdf2htmlEX mkdir build cd build -CC=clang CXX=clang++ cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. +CC=clang CXX=clang++ cmake -DCMAKE_INSTALL_PREFIX=$PDF2HTMLEX_PREFIX .. make $MAKE_PARALLEL diff --git a/buildScripts/buildPoppler b/buildScripts/buildPoppler index baf305b..9845412 100755 --- a/buildScripts/buildPoppler +++ b/buildScripts/buildPoppler @@ -11,10 +11,6 @@ echo "" cd poppler mkdir build cd build -cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \ +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PDF2HTMLEX_PREFIX \ -DENABLE_LIBOPENJPEG=none .. make $MAKE_PARALLEL - -cd ../../poppler-data - -make install prefix=/usr/local diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index 6fe9eb8..796567a 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -41,11 +41,11 @@ wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/$LI chmod a+x $LINUX_DEPLOY_APP_IMAGE -./$LINUX_DEPLOY_APP_IMAGE \ - -e appDir/usr/local/bin/pdf2htmlEX \ - --create-desktop-file \ - -i ../pdf2htmlEX/logo/pdf2htmlEX.svg \ - --appdir=appDir \ +./$LINUX_DEPLOY_APP_IMAGE \ + -e appDir/$PDF2HTMLEX_PREFIX/bin/pdf2htmlEX \ + --create-desktop-file \ + -i ../pdf2htmlEX/logo/pdf2htmlEX.svg \ + --appdir=appDir \ --output appimage diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index e31daa4..a075492 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -62,7 +62,7 @@ echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> buildScripts/reSourceVersi FROM $DOCKER_FROM COPY ./ / RUN ldconfig -ENTRYPOINT ["/usr/local/bin/pdf2htmlEX"] +ENTRYPOINT ["$PDF2HTMLEX_PREFIX/bin/pdf2htmlEX"] DOCKERFILE_HERE_DOC cd .. diff --git a/buildScripts/installPoppler b/buildScripts/installPoppler index 2ae5b15..42ce6ce 100755 --- a/buildScripts/installPoppler +++ b/buildScripts/installPoppler @@ -26,17 +26,22 @@ sudo make install cd .. -sudo mkdir -p /usr/local/include/poppler -sudo cp poppler/*.h /usr/local/include/poppler +sudo mkdir -p $PDF2HTMLEX_PREFIX/include/poppler +sudo cp poppler/*.h $PDF2HTMLEX_PREFIX/include/poppler -sudo mkdir -p /usr/local/include/poppler/goo -sudo cp goo/*.h /usr/local/include/poppler/goo +sudo mkdir -p $PDF2HTMLEX_PREFIX/include/poppler/goo +sudo cp goo/*.h $PDF2HTMLEX_PREFIX/include/poppler/goo -sudo mkdir -p /usr/local/include/poppler/fofi -sudo cp fofi/*.h /usr/local/include/poppler/fofi +sudo mkdir -p $PDF2HTMLEX_PREFIX/include/poppler/fofi +sudo cp fofi/*.h $PDF2HTMLEX_PREFIX/include/poppler/fofi -sudo mkdir -p /usr/local/include/poppler/splash -sudo cp splash/*.h /usr/local/include/poppler/splash +sudo mkdir -p $PDF2HTMLEX_PREFIX/include/poppler/splash +sudo cp splash/*.h $PDF2HTMLEX_PREFIX/include/poppler/splash sudo cp build/poppler/poppler-config.h \ - /usr/local/include/poppler + $PDF2HTMLEX_PREFIX/include/poppler + +cd ../poppler-data + +sudo make install prefix=$PDF2HTMLEX_PREFIX + From f7295b7388ac366ba769fedfd310045ec76a51ed Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 17 Dec 2019 16:44:24 +0000 Subject: [PATCH 14/17] put pdf2htmlex_prefix into reSourceVersionEnvs --- buildScripts/buildInstallLocallyApt | 2 ++ buildScripts/buildInstallLocallyBrew | 2 ++ buildScripts/reportEnvs | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/buildScripts/buildInstallLocallyApt b/buildScripts/buildInstallLocallyApt index 75b45bd..8e6537f 100755 --- a/buildScripts/buildInstallLocallyApt +++ b/buildScripts/buildInstallLocallyApt @@ -15,6 +15,8 @@ export PDF2HTMLEX_BRANCH=update-poppler export PDF2HTMLEX_PREFIX=/usr/local +echo "export PDF2HTMLEX_PREFIX=\"$PDF2HTMLEX_PREFIX\"" >> buildScripts/reSourceVersionEnvs + ################ # do the build diff --git a/buildScripts/buildInstallLocallyBrew b/buildScripts/buildInstallLocallyBrew index 1cb4849..3147fad 100755 --- a/buildScripts/buildInstallLocallyBrew +++ b/buildScripts/buildInstallLocallyBrew @@ -15,6 +15,8 @@ export PDF2HTMLEX_BRANCH=update-poppler export PDF2HTMLEX_PREFIX=toBeDetermined +echo "export PDF2HTMLEX_PREFIX=\"$PDF2HTMLEX_PREFIX\"" >> buildScripts/reSourceVersionEnvs + ################ # do the build diff --git a/buildScripts/reportEnvs b/buildScripts/reportEnvs index 941d538..d49fedf 100755 --- a/buildScripts/reportEnvs +++ b/buildScripts/reportEnvs @@ -10,9 +10,9 @@ echo " build dir: [$TRAVIS_BUILD_DIR]" echo " repo slug: [$TRAVIS_REPO_SLUG]" echo "Build env:" +echo " prefix: [$PDF2HTMLEX_PREFIX]" echo " unattended: [$UNATTENDED]" echo " make parallel: [$MAKE_PARALLEL]" - source ./buildScripts/reSourceVersionEnvs echo "pdf2htmlEX env:" From 64531afddaff4f4c8904834820ffe64a4fbdac91 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 17 Dec 2019 16:48:24 +0000 Subject: [PATCH 15/17] refactored build prefix --- buildScripts/buildInstallLocallyApt | 2 -- buildScripts/buildInstallLocallyBrew | 2 -- buildScripts/versionEnvs | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/buildScripts/buildInstallLocallyApt b/buildScripts/buildInstallLocallyApt index 8e6537f..75b45bd 100755 --- a/buildScripts/buildInstallLocallyApt +++ b/buildScripts/buildInstallLocallyApt @@ -15,8 +15,6 @@ export PDF2HTMLEX_BRANCH=update-poppler export PDF2HTMLEX_PREFIX=/usr/local -echo "export PDF2HTMLEX_PREFIX=\"$PDF2HTMLEX_PREFIX\"" >> buildScripts/reSourceVersionEnvs - ################ # do the build diff --git a/buildScripts/buildInstallLocallyBrew b/buildScripts/buildInstallLocallyBrew index 3147fad..1cb4849 100755 --- a/buildScripts/buildInstallLocallyBrew +++ b/buildScripts/buildInstallLocallyBrew @@ -15,8 +15,6 @@ export PDF2HTMLEX_BRANCH=update-poppler export PDF2HTMLEX_PREFIX=toBeDetermined -echo "export PDF2HTMLEX_PREFIX=\"$PDF2HTMLEX_PREFIX\"" >> buildScripts/reSourceVersionEnvs - ################ # do the build diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index 569db01..77b3597 100755 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -32,4 +32,4 @@ echo "export FONTFORGE_VERSION=\"$FONTFORGE_VERSION\"" >> buildScripts/reSourceV echo "export PDF2HTMLEX_BRANCH=\"$PDF2HTMLEX_BRANCH\"" >> buildScripts/reSourceVersionEnvs echo "export MACHINE_ARCH=\"$MACHINE_ARCH\"" >> buildScripts/reSourceVersionEnvs echo "export BUILD_TIME=\"$BUILD_TIME\"" >> buildScripts/reSourceVersionEnvs - +echo "export PDF2HTMLEX_PREFIX=\"$PDF2HTMLEX_PREFIX\"" >> buildScripts/reSourceVersionEnvs From b4df602953bac9d6dac43ed8bd3a9a4dc5c24a37 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 17 Dec 2019 17:24:05 +0000 Subject: [PATCH 16/17] continued work on the use of prefix --- buildScripts/buildInstallLocallyApt | 4 ++++ buildScripts/createAppImage | 2 +- buildScripts/createDockerImage | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/buildScripts/buildInstallLocallyApt b/buildScripts/buildInstallLocallyApt index 75b45bd..72aeced 100755 --- a/buildScripts/buildInstallLocallyApt +++ b/buildScripts/buildInstallLocallyApt @@ -13,6 +13,10 @@ export MAKE_PARALLEL="-j $(nproc)" export PDF2HTMLEX_BRANCH=update-poppler # export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" +# The following environment variable determines where the poppler, +# poppler-data, fontforge and pdf2htmlEX packages are installed. +# CHANGE IT TO SUIT YOUR NEEDS: +# export PDF2HTMLEX_PREFIX=/usr/local ################ diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index 796567a..77c5b25 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -27,7 +27,7 @@ make install DESTDIR=../../imageBuild/appDir cd ../../poppler-data -make install DESTDIR=../../imageBuild/appDir +make install prefix=$PDF2HTMLEX_PREFIX DESTDIR=../../imageBuild/appDir cd ../imageBuild diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index a075492..9858825 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -50,7 +50,7 @@ echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> buildScripts/reSourceVersi cd ../../poppler-data - make install DESTDIR=../../imageBuild/dockerDir + make install prefix=$PDF2HTMLEX_PREFIX DESTDIR=../../imageBuild/dockerDir cd ../imageBuild/dockerDir From 8d6e9636ad8e1e80923e5c2a6b542e44e54a4c2d Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 17 Dec 2019 17:45:56 +0000 Subject: [PATCH 17/17] updated image creation for poppler-data --- buildScripts/createAppImage | 2 +- buildScripts/createDockerImage | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index 77c5b25..360d0fd 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -27,7 +27,7 @@ make install DESTDIR=../../imageBuild/appDir cd ../../poppler-data -make install prefix=$PDF2HTMLEX_PREFIX DESTDIR=../../imageBuild/appDir +make install prefix=$PDF2HTMLEX_PREFIX DESTDIR=../imageBuild/appDir cd ../imageBuild diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index 9858825..aca0d3a 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -50,7 +50,7 @@ echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> buildScripts/reSourceVersi cd ../../poppler-data - make install prefix=$PDF2HTMLEX_PREFIX DESTDIR=../../imageBuild/dockerDir + make install prefix=$PDF2HTMLEX_PREFIX DESTDIR=../imageBuild/dockerDir cd ../imageBuild/dockerDir