From e63dcd75746f2b61e19d792413431d434257ead3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Wed, 17 Mar 2021 08:42:17 +0700 Subject: [PATCH] k2pdfopt: update to 2.53. --- .../patches/01-CMakeLists.txt-fixes.patch | 102 +++++++++--------- .../k2pdfopt/patches/02-header-fixes.patch | 68 ++++++------ .../03-willuslib-ocrtess.c-tesscapi-fix.patch | 15 ++- .../04-willuslib-wmupdfinfo.c-mupdf-fix.patch | 26 ----- .../patches/05-willuslib-bmpmupdf.c-fix.patch | 15 ++- srcpkgs/k2pdfopt/patches/06-tess-no-log.patch | 19 ++++ srcpkgs/k2pdfopt/template | 13 ++- srcpkgs/k2pdfopt/update | 2 + 8 files changed, 133 insertions(+), 127 deletions(-) delete mode 100644 srcpkgs/k2pdfopt/patches/04-willuslib-wmupdfinfo.c-mupdf-fix.patch create mode 100644 srcpkgs/k2pdfopt/patches/06-tess-no-log.patch create mode 100644 srcpkgs/k2pdfopt/update diff --git a/srcpkgs/k2pdfopt/patches/01-CMakeLists.txt-fixes.patch b/srcpkgs/k2pdfopt/patches/01-CMakeLists.txt-fixes.patch index 07931dd43470..196378bbcdd0 100644 --- a/srcpkgs/k2pdfopt/patches/01-CMakeLists.txt-fixes.patch +++ b/srcpkgs/k2pdfopt/patches/01-CMakeLists.txt-fixes.patch @@ -1,10 +1,14 @@ -diff --git CMakeLists.txt CMakeLists.txt -index 4a2378b5e9..2ed0ccca4b 100644 ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -54,0 +55 @@ -+ set(K2PDFOPT_LIB ${K2PDFOPT_LIB} ${JASPER_LIBRARY}) -@@ -57,11 +58 @@ +Index: b/CMakeLists.txt +=================================================================== +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -57,37 +57,26 @@ endif(JPEG_FOUND) + include(FindJasper) + if(JASPER_FOUND) + set(HAVE_JASPER_LIB 1) ++ set(K2PDFOPT_LIB ${K2PDFOPT_LIB} ${JASPER_LIBRARIES}) + endif(JASPER_FOUND) + -# paths from willuslib/wgs.c -find_program(GHOSTSCRIPT_EXECUTABLE gs -# PATHS /usr/bin /usr/share/gs /usr/local/gs /opt/gs @@ -17,19 +21,23 @@ index 4a2378b5e9..2ed0ccca4b 100644 - message(STATUS "Could NOT find ghostscript executable") -endif(GHOSTSCRIPT_EXECUTABLE) +set(HAVE_GHOSTSCRIPT 1) -@@ -70 +60,0 @@ --# HAVE_GSL_LIB -@@ -71,0 +62,6 @@ + + # willus.h + # HAVE_GSL_LIB + +pkg_check_modules(GSL gsl) +if(GSL_FOUND) + set(HAVE_GSL_LIB 1) + include_directories(SYSTEM ${GSL_INCLUDEDIR}) + set(K2PDFOPT_LIB ${K2PDFOPT_LIB} ${GSL_LDFLAGS}) +endif(GSL_FOUND) -@@ -76,2 +71,0 @@ + + # libfreetype6 (>= 2.3.9), libjbig2dec0, libjpeg8 (>= 8c), libx11-6, libxext6, zlib1g (>= 1:1.2.0) + # MUPDF_STATIC_LDFLAGS misses mupdf-js-none, and doubles libs ... + -pkg_check_modules(MUPDF mupdf) -if(MUPDF_FOUND) -@@ -79,7 +73 @@ + set(HAVE_MUPDF_LIB 1) - # (includes jbig2dec, openjpeg, freetype) - include_directories(SYSTEM ${MUPDF_INCLUDEDIR}) - message(STATUS "mupdf libraries: ${MUPDF_LDFLAGS}") @@ -37,51 +45,39 @@ index 4a2378b5e9..2ed0ccca4b 100644 - -lmupdf-js-none -lopenjpeg -ljbig2dec -ljpeg -lfreetype - ) -endif(MUPDF_FOUND) -+set(K2PDFOPT_LIB ${K2PDFOPT_LIB} -pthread -lmupdf -lmupdf-third -lopenjp2 -ljbig2dec -lfreetype -lharfbuzz) -@@ -95,2 +91,14 @@ --# HAVE_LEPTONICA_LIB --# HAVE_TESSERACT_LIB -+ -+pkg_check_modules(LEPTONICA lept) -+if(LEPTONICA_FOUND) -+ set(HAVE_LEPTONICA_LIB 1) -+ include_directories(SYSTEM ${LEPTONICA_INCLUDEDIR}) -+ set(K2PDFOPT_LIB ${K2PDFOPT_LIB} ${LEPTONICA_LDFLAGS} ${LEPTONICA_LIBRARIES}) -+endif(LEPTONICA_FOUND) -+ -+pkg_check_modules(TESSERACT tesseract) -+if(TESSERACT_FOUND) -+ set(HAVE_TESSERACT_LIB 1) -+ include_directories(SYSTEM ${TESSERACT_INCLUDEDIR}) -+ set(K2PDFOPT_LIB ${K2PDFOPT_LIB} ${TESSERACT_LDFLAGS}) -+endif(TESSERACT_FOUND) -@@ -100 +108 @@ --SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_CMAKE -Wall") -+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_CMAKE -Wall -Wextra") -@@ -108,0 +117,2 @@ ++set(K2PDFOPT_LIB ${K2PDFOPT_LIB} -pthread -lmupdf -lmupdf-third -lgumbo -lopenjp2 -ljbig2dec -lfreetype -lharfbuzz) + + pkg_check_modules(DJVU ddjvuapi) + if(DJVU_FOUND) +@@ -123,6 +112,8 @@ configure_file ( + "${PROJECT_BINARY_DIR}/config.h" + ) + +include_directories(${PROJECT_BINARY_DIR}) + -@@ -112 +121,0 @@ --# ms -@@ -114 +123 @@ --target_link_libraries (k2pdfopt k2pdfoptlib willuslib ${K2PDFOPT_LIB}) -+target_link_libraries(k2pdfopt k2pdfoptlib willuslib ${K2PDFOPT_LIB}) -@@ -115,0 +125 @@ + add_subdirectory(willuslib) + add_subdirectory(k2pdfoptlib) + +@@ -130,6 +121,7 @@ add_subdirectory(k2pdfoptlib) + add_executable(k2pdfopt k2pdfopt.c) + target_link_libraries (k2pdfopt k2pdfoptlib willuslib ${K2PDFOPT_LIB} pthread) + +install(TARGETS k2pdfopt RUNTIME DESTINATION bin) -diff --git willuslib/CMakeLists.txt willuslib/CMakeLists.txt -index 463bbc95e7..104d02e360 100644 ---- willuslib/CMakeLists.txt -+++ willuslib/CMakeLists.txt -@@ -9 +9 @@ -- ocrjocr.c ocrtess.c pdfwrite.c point2d.c render.c strbuf.c string.c -+ ocrgocr.c ocrtess.c pdfwrite.c point2d.c render.c strbuf.c string.c -@@ -24,0 +25,4 @@ + + message("") + message("-- Summary --") +Index: b/willuslib/CMakeLists.txt +=================================================================== +--- a/willuslib/CMakeLists.txt ++++ b/willuslib/CMakeLists.txt +@@ -22,6 +22,10 @@ if(DJVU_FOUND) + endif(DJVU_FOUND) + + if(MUPDF_FOUND) +if(TESSERACT_FOUND) + set(WILLUSLIB_SRC ${WILLUSLIB_SRC} ocrtess.c) +endif(TESSERACT_FOUND) + -@@ -29,3 +33 @@ --# HAVE_GOCR_LIB: ocrjocr.c --# HAVE_TESSERACT_LIB: ocrtess.c -- -+# HAVE_GOCR_LIB: ocrgocr.c + set(WILLUSLIB_SRC ${WILLUSLIB_SRC} bmpmupdf.c wmupdf.c) + endif(MUPDF_FOUND) + diff --git a/srcpkgs/k2pdfopt/patches/02-header-fixes.patch b/srcpkgs/k2pdfopt/patches/02-header-fixes.patch index 1b5667fc09ca..22082976502d 100644 --- a/srcpkgs/k2pdfopt/patches/02-header-fixes.patch +++ b/srcpkgs/k2pdfopt/patches/02-header-fixes.patch @@ -1,7 +1,7 @@ -diff --git willuslib/gslpolyfit.c willuslib/gslpolyfit.c -index 5d2b6fbb85..f127bf054f 100644 ---- willuslib/gslpolyfit.c -+++ willuslib/gslpolyfit.c +Index: b/willuslib/gslpolyfit.c +=================================================================== +--- a/willuslib/gslpolyfit.c ++++ b/willuslib/gslpolyfit.c @@ -24,7 +24,10 @@ #include #include "willus.h" @@ -14,10 +14,10 @@ index 5d2b6fbb85..f127bf054f 100644 #endif void gslpolyfit(double *x,double *y0,int n,int d,double *c0) -diff --git willuslib/bmp.c willuslib/bmp.c -index 583644d565..b2c36d5673 100644 ---- willuslib/bmp.c -+++ willuslib/bmp.c +Index: b/willuslib/bmp.c +=================================================================== +--- a/willuslib/bmp.c ++++ b/willuslib/bmp.c @@ -37,7 +37,7 @@ #include #endif @@ -27,26 +27,25 @@ index 583644d565..b2c36d5673 100644 #endif #define BOUND(x,xmin,xmax) if ((x)<(xmin)) (x)=(xmin); else { if ((x)>(xmax)) (x)=(xmax); } -diff --git willuslib/ocrtess.c willuslib/ocrtess.c -index e1366e1aab..58aaf97fb9 100644 ---- willuslib/ocrtess.c -+++ willuslib/ocrtess.c -@@ -24,8 +24,9 @@ - #include +Index: b/willuslib/ocrtess.c +=================================================================== +--- a/willuslib/ocrtess.c ++++ b/willuslib/ocrtess.c +@@ -25,8 +25,8 @@ #include #include + #include -#include -#include -+#include +#include +#include #include "willus.h" - -diff --git willuslib/wleptonica.c willuslib/wleptonica.c -index a4e3cfd61d..a85be0949d 100644 ---- willuslib/wleptonica.c -+++ willuslib/wleptonica.c + char *ocrtess_langnames[] = +Index: b/willuslib/wleptonica.c +=================================================================== +--- a/willuslib/wleptonica.c ++++ b/willuslib/wleptonica.c @@ -23,7 +23,7 @@ #include "willus.h" @@ -65,19 +64,16 @@ index a4e3cfd61d..a85be0949d 100644 if (bmp1!=NULL) { PIX *pix2,*pix2d; - -diff --git willuslib/wmupdf.c willuslib/wmupdf.c -index 81627efd4c..fcab84c1db 100644 ---- willuslib/wmupdf.c -+++ willuslib/wmupdf.c -@@ -189,8 +189,8 @@ int wmupdf_remake_pdf(char *infile,char *outfile,WPDFPAGEINFO *pageinfo,int use_ - pdf_write_opts.do_compress=1; - pdf_write_opts.do_linear=0; - pdf_write_opts.do_garbage=1; /* 2 and 3 don't work for this. */ -- pdf_write_opts.continue_on_error=0; -- pdf_write_opts.errors=NULL; -+ //pdf_write_opts.continue_on_error=0; -+ //pdf_write_opts.errors=NULL; - write_failed=0; - wpdfpageinfo_sort(pageinfo); - xref=NULL; +Index: b/willuslib/bmpdjvu.c +=================================================================== +--- a/willuslib/bmpdjvu.c ++++ b/willuslib/bmpdjvu.c +@@ -23,7 +23,7 @@ + #include "willus.h" + + #ifdef HAVE_DJVU_LIB +-#include ++#include + + static void handle(int wait,ddjvu_context_t *ctx); + static void djvu_add_page_info(char *buf,ddjvu_document_t *doc,int page,int npages); diff --git a/srcpkgs/k2pdfopt/patches/03-willuslib-ocrtess.c-tesscapi-fix.patch b/srcpkgs/k2pdfopt/patches/03-willuslib-ocrtess.c-tesscapi-fix.patch index adc76c83866f..944965a38a3a 100644 --- a/srcpkgs/k2pdfopt/patches/03-willuslib-ocrtess.c-tesscapi-fix.patch +++ b/srcpkgs/k2pdfopt/patches/03-willuslib-ocrtess.c-tesscapi-fix.patch @@ -1,7 +1,11 @@ -diff -r -u0 willuslib/ocrtess.c willuslib/ocrtess.c ---- willuslib/ocrtess.c 2018-12-31 19:59:58.000000000 +0100 -+++ willuslib/ocrtess.c 2019-07-27 18:47:06.706765733 +0200 -@@ -29,0 +30,258 @@ +Index: b/willuslib/ocrtess.c +=================================================================== +--- a/willuslib/ocrtess.c ++++ b/willuslib/ocrtess.c +@@ -27,6 +27,264 @@ + #include + #include + #include + + +/* @@ -260,3 +264,6 @@ diff -r -u0 willuslib/ocrtess.c willuslib/ocrtess.c + TessBaseAPIEnd(api); + TessBaseAPIDelete(api); + } + #include "willus.h" + + char *ocrtess_langnames[] = diff --git a/srcpkgs/k2pdfopt/patches/04-willuslib-wmupdfinfo.c-mupdf-fix.patch b/srcpkgs/k2pdfopt/patches/04-willuslib-wmupdfinfo.c-mupdf-fix.patch deleted file mode 100644 index 1b3bf4d057ad..000000000000 --- a/srcpkgs/k2pdfopt/patches/04-willuslib-wmupdfinfo.c-mupdf-fix.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff -r -w -u0 willuslib/wmupdfinfo.c willuslib/wmupdfinfo.c ---- willuslib/wmupdfinfo.c 2018-11-21 10:05:22.000000000 +0100 -+++ willuslib/wmupdfinfo.c 2019-07-27 19:56:23.418595275 +0200 -@@ -217 +217 @@ -- pdf_print_obj(ctx, out, pdf_resolve_indirect(ctx, obj), 1); -+ pdf_print_obj(ctx, out, pdf_resolve_indirect(ctx, obj), 1, 1); -@@ -224 +224 @@ -- pdf_print_obj(ctx, out, pdf_resolve_indirect(ctx, obj), 1); -+ pdf_print_obj(ctx, out, pdf_resolve_indirect(ctx, obj), 1, 1); -@@ -240 +240 @@ -- n=pdf_sprint_obj(ctx,NULL,0,robj,1); -+ char* f = pdf_sprint_obj(ctx,NULL,0,&n,robj,1,1); -@@ -245 +245 @@ -- pdf_print_obj(ctx,out,robj,1); -+ pdf_print_obj(ctx,out,robj,1,1); -@@ -249 +249,2 @@ -- pdf_sprint_obj(ctx,buf,n+2,robj,1); -+ int len = 0; -+ char* d = pdf_sprint_obj(ctx,buf,n+2,&len,robj,1,1); -@@ -256,0 +258 @@ -+ fz_free(ctx, d); -@@ -257,0 +260 @@ -+ fz_free(ctx, f); -@@ -278 +281 @@ -- pdf_print_obj(ctx,out, pdf_resolve_indirect(ctx,obj), 1); -+ pdf_print_obj(ctx,out, pdf_resolve_indirect(ctx,obj), 1, 1); diff --git a/srcpkgs/k2pdfopt/patches/05-willuslib-bmpmupdf.c-fix.patch b/srcpkgs/k2pdfopt/patches/05-willuslib-bmpmupdf.c-fix.patch index 7ed4528e8faf..b715dbb84f36 100644 --- a/srcpkgs/k2pdfopt/patches/05-willuslib-bmpmupdf.c-fix.patch +++ b/srcpkgs/k2pdfopt/patches/05-willuslib-bmpmupdf.c-fix.patch @@ -1,8 +1,15 @@ -diff -r -w -u0 willuslib/bmpmupdf.c willuslib/bmpmupdf.c ---- willuslib/bmpmupdf.c 2018-11-20 21:13:12.000000000 +0100 -+++ willuslib/bmpmupdf.c 2019-07-27 20:12:37.386555334 +0200 -@@ -28 +28,3 @@ +Index: b/willuslib/bmpmupdf.c +=================================================================== +--- a/willuslib/bmpmupdf.c ++++ b/willuslib/bmpmupdf.c +@@ -25,7 +25,9 @@ + + #ifdef HAVE_MUPDF_LIB + #include -void pdf_install_load_system_font_funcs(fz_context *ctx); +void pdf_install_load_system_font_funcs(fz_context *ctx) +{ +} + + static void mupdf_cbz_add_page_info(char *buf,fz_context *ctx,fz_document *doc, + int pageno,int npages); diff --git a/srcpkgs/k2pdfopt/patches/06-tess-no-log.patch b/srcpkgs/k2pdfopt/patches/06-tess-no-log.patch new file mode 100644 index 000000000000..69fc099e1baa --- /dev/null +++ b/srcpkgs/k2pdfopt/patches/06-tess-no-log.patch @@ -0,0 +1,19 @@ +Index: b/willuslib/ocrtess.c +=================================================================== +--- a/willuslib/ocrtess.c ++++ b/willuslib/ocrtess.c +@@ -482,14 +482,12 @@ int ocrtess_lang_count(char *langstr) + void ocrtess_set_logfile(char *filename) + + { +- tess_capi_set_logfile(filename); + } + + + void ocrtess_debug_message(char *message) + + { +- tess_capi_debug_message(message); + } + + diff --git a/srcpkgs/k2pdfopt/template b/srcpkgs/k2pdfopt/template index a099962a8063..cbe042e81971 100644 --- a/srcpkgs/k2pdfopt/template +++ b/srcpkgs/k2pdfopt/template @@ -1,18 +1,23 @@ # Template file for 'k2pdfopt' pkgname=k2pdfopt -version=2.51 +version=2.53 revision=1 wrksrc="${pkgname}_v${version}" build_style=cmake hostmakedepends="pkgconf unzip" makedepends="zlib-devel libpng-devel libjpeg-turbo-devel jasper-devel freetype-devel libopenjpeg2-devel jbig2dec-devel djvulibre-devel - tesseract-ocr-devel leptonica-devel gsl-devel mupdf-devel harfbuzz-devel" + tesseract-ocr-devel leptonica-devel gsl-devel mupdf-devel harfbuzz-devel + gumbo-parser-devel" depends="ghostscript" short_desc="Optimize PDF/DJVU files for mobile e-readers and smartphones" maintainer="John Eira " license="GPL-3.0-or-later" homepage="https://willus.com/k2pdfopt/" distfiles="http://willus.com/k2pdfopt/src/k2pdfopt_v${version}_src.zip" -checksum="3e6e4d7aac9c9bed4c7854888a6a91213be10121be76e17f83e080e829ac5fde" -broken="https://build.voidlinux.org/builders/x86_64-musl_builder/builds/22343/steps/shell_3/logs/stdio" +checksum=58c1b0647be5237570c110b0bb77eb78fab384282a2648edb59eac673070959b +patch_args=-Np1 + +post_extract() { + rm -rf *_mod +} diff --git a/srcpkgs/k2pdfopt/update b/srcpkgs/k2pdfopt/update new file mode 100644 index 000000000000..c3d5bc997ced --- /dev/null +++ b/srcpkgs/k2pdfopt/update @@ -0,0 +1,2 @@ +site=https://willus.com/k2pdfopt/src/ +pattern='k2pdfopt_v\K[\d.]+[a-z]?(?=_src.zip)'