summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorFacundo Tuesca2015-06-08 13:24:46 -0300
committerFacundo Tuesca2015-06-08 13:24:46 -0300
commit7043203ced31f12c8d2ea2c9beaad2f54af9ed38 (patch)
treecc58cc55ad79986451b25e0fa2e04446ff263da9
downloadaur-7043203ced31f12c8d2ea2c9beaad2f54af9ed38.tar.gz
Initial import
-rw-r--r--.SRCINFO30
-rw-r--r--PKGBUILD88
-rw-r--r--k2pdfopt.patch96
-rw-r--r--tesseract.patch12
4 files changed, 226 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..53b9556c72f1
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,30 @@
+pkgbase = k2pdfopt
+ pkgdesc = A tool that optimizes PDF files for viewing on mobile readers
+ pkgver = 2.32
+ pkgrel = 2
+ url = http://www.willus.com/k2pdfopt/
+ arch = i686
+ arch = x86_64
+ license = GPL3
+ makedepends = cmake
+ depends = mupdf>=1.6
+ depends = djvulibre>=3.5.25.3
+ depends = netpbm>=10.61.02
+ depends = leptonica>=1.69
+ source = http://www.willus.com/k2pdfopt/src/k2pdfopt_v2.32_src.zip
+ source = http://www.mupdf.com/downloads/archive/mupdf-1.6-source.tar.gz
+ source = http://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.02.02.tar.gz
+ source = http://www-e.uni-magdeburg.de/jschulen/ocr/gocr-0.49.tar.gz
+ source = https://openjpeg.googlecode.com/files/openjpeg-2.0.0.tar.gz
+ source = k2pdfopt.patch
+ source = tesseract.patch
+ md5sums = facfb12519a0a0b5db63acdac37844d7
+ md5sums = 8d69db41ae9e0b6807b76bb6ed70dc2f
+ md5sums = 26adc8154f0e815053816825dde246e6
+ md5sums = 4e527bc4bdd97c2be15fdd818857507f
+ md5sums = d9be274bddc0f47f268e484bdcaaa6c5
+ md5sums = 07a0f2d3776733ccd0149845816ad4f5
+ md5sums = 0e85e48aed62771dfc090787c079359d
+
+pkgname = k2pdfopt
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..731dcc0eae70
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,88 @@
+# Maintainer: Facundo Tuesca <facutuesca at gmail dot com>
+
+pkgname=k2pdfopt
+pkgver=2.32
+pkgrel=2
+pkgdesc="A tool that optimizes PDF files for viewing on mobile readers"
+arch=('i686' 'x86_64')
+url="http://www.willus.com/k2pdfopt/"
+license=('GPL3')
+makedepends=('cmake')
+depends=('mupdf>=1.6'
+ 'djvulibre>=3.5.25.3'
+ 'netpbm>=10.61.02'
+ 'leptonica>=1.69')
+source=("http://www.willus.com/${pkgname}/src/${pkgname}_v${pkgver}_src.zip"
+ "http://www.mupdf.com/downloads/archive/mupdf-1.6-source.tar.gz"
+ "http://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.02.02.tar.gz"
+ "http://www-e.uni-magdeburg.de/jschulen/ocr/gocr-0.49.tar.gz"
+ "https://openjpeg.googlecode.com/files/openjpeg-2.0.0.tar.gz"
+ "k2pdfopt.patch"
+ "tesseract.patch")
+md5sums=('facfb12519a0a0b5db63acdac37844d7'
+ '8d69db41ae9e0b6807b76bb6ed70dc2f'
+ '26adc8154f0e815053816825dde246e6'
+ '4e527bc4bdd97c2be15fdd818857507f'
+ 'd9be274bddc0f47f268e484bdcaaa6c5'
+ '07a0f2d3776733ccd0149845816ad4f5'
+ '0e85e48aed62771dfc090787c079359d')
+
+prepare() {
+ cd "${srcdir}/${pkgname}_v${pkgver}"
+ rm -f "include_mod/gocr.h"
+ cp mupdf_mod/font.c mupdf_mod/string.c "${srcdir}/mupdf-1.6-source/source/fitz/"
+ cp mupdf_mod/pdf-* "${srcdir}/mupdf-1.6-source/source/pdf/"
+ rm -rf ${srcdir}/mupdf-1.6-source/thirdparty/{curl,freetype,jpeg,zlib}
+ cp tesseract_mod/dawg.cpp "${srcdir}/tesseract-ocr/dict/"
+ cp tesseract_mod/tessdatamanager.cpp "${srcdir}/tesseract-ocr/ccutil/"
+ cp tesseract_mod/tessedit.cpp "${srcdir}/tesseract-ocr/ccmain/"
+ cp tesseract_mod/tesscapi.cpp "${srcdir}/tesseract-ocr/api"
+ cp include_mod/tesseract.h include_mod/leptonica.h "${srcdir}/tesseract-ocr/api/"
+ cd "${srcdir}"
+ patch -p0 -i "${srcdir}/tesseract.patch"
+ patch -p1 -i "${srcdir}/k2pdfopt.patch"
+ mkdir -p "patched_libraries"
+}
+
+build() {
+ cd "${srcdir}/mupdf-1.6-source/"
+ make prefix="${srcdir}/patched_libraries" install
+ install -Dm644 build/debug/libmujs.a "${srcdir}/patched_libraries/lib/"
+ cd "${srcdir}/tesseract-ocr/"
+ ./autogen.sh
+ ./configure --prefix="${srcdir}/patched_libraries" --disable-shared
+ make install
+ cd "${srcdir}/gocr-0.49/"
+ ./configure
+ cp src/{gocr.h,pnm.h,unicode.h,list.h} "${srcdir}/patched_libraries/include"
+ cp include/config.h "${srcdir}/patched_libraries/include"
+ make libs
+ cp src/libPgm2asc.a "${srcdir}/patched_libraries/lib"
+ cd "${srcdir}/openjpeg-2.0.0/"
+ cmake -D BUILD_SHARED_LIBS:bool=off .
+ make openjp2
+ cp bin/libopenjp2.a "${srcdir}/patched_libraries/lib"
+
+ cd "${srcdir}/${pkgname}_v${pkgver}/k2pdfoptlib"
+ gcc -Ofast -Wall -c *.c -I ../include_mod/ -I ${srcdir}/patched_libraries/include \
+ -I . -I ../willuslib
+ ar rcs libk2pdfopt.a *.o
+ cd "${srcdir}/${pkgname}_v${pkgver}/willuslib"
+ gcc -Ofast -Wall -c *.c -I ../include_mod/ -I ${srcdir}/patched_libraries/include
+ ar rcs libwillus.a *.o
+ cd "${srcdir}/${pkgname}_v${pkgver}"
+ gcc -Wall -Ofast -o k2pdfopt.o -c k2pdfopt.c -I k2pdfoptlib/ -I willuslib/ \
+ -I include_mod/ -I ${srcdir}/patched_libraries/include
+ g++ -Ofast k2pdfopt.o -o k2pdfopt -I willuslib/ -I k2pdfoptlib/ -I include_mod/ \
+ -I ${srcdir}/patched_libraries/include -L ${srcdir}/patched_libraries/lib/ \
+ -L willuslib/ -L k2pdfoptlib/ -lk2pdfopt -lwillus -ldjvulibre -lz -lmupdf \
+ -ljbig2dec -ljpeg -lopenjp2 -lpng -lfreetype -lpthread -lmujs \
+ -lPgm2asc -llept -ltesseract -lcrypto
+
+}
+
+package() {
+ cd "${srcdir}/${pkgname}_v${pkgver}"
+ mkdir -p "${pkgdir}/usr/bin/"
+ cp ${pkgname} "${pkgdir}/usr/bin/"
+}
diff --git a/k2pdfopt.patch b/k2pdfopt.patch
new file mode 100644
index 000000000000..803299c0f17c
--- /dev/null
+++ b/k2pdfopt.patch
@@ -0,0 +1,96 @@
+diff -aur k2_old/k2pdfopt_v2.32/willuslib/array.c k2_new/k2pdfopt_v2.32/willuslib/array.c
+--- k2_old/k2pdfopt_v2.32/willuslib/array.c 2014-12-01 13:24:25.000000000 -0300
++++ k2_new/k2pdfopt_v2.32/willuslib/array.c 2015-03-07 09:18:58.602126050 -0300
+@@ -1072,7 +1072,7 @@
+ void arrayf_sort(float *a,int n)
+
+ {
+- sort(a,(long)n);
++ willus_sort(a,(long)n);
+ }
+
+
+diff -aur k2_old/k2pdfopt_v2.32/willuslib/math.c k2_new/k2pdfopt_v2.32/willuslib/math.c
+--- k2_old/k2pdfopt_v2.32/willuslib/math.c 2013-08-15 21:33:50.000000000 -0300
++++ k2_new/k2pdfopt_v2.32/willuslib/math.c 2015-03-07 09:18:58.611126050 -0300
+@@ -532,7 +532,7 @@
+
+
+
+-void sort(float *x,int n)
++void willus_sort(float *x,int n)
+
+ {
+ int top,n1;
+diff -aur k2_old/k2pdfopt_v2.32/willuslib/ocrjocr.c k2_new/k2pdfopt_v2.32/willuslib/ocrjocr.c
+--- k2_old/k2pdfopt_v2.32/willuslib/ocrjocr.c 2012-11-12 13:09:42.000000000 -0300
++++ k2_new/k2pdfopt_v2.32/willuslib/ocrjocr.c 2015-03-07 09:18:58.629126048 -0300
+@@ -29,6 +29,8 @@
+ #ifdef HAVE_GOCR_LIB
+ #include <gocr.h>
+
++job_t *JOB;
++
+ /*
+ ** bmp8 must be grayscale
+ ** (x1,y1) and (x2,y2) from top left of bitmap
+@@ -66,6 +68,7 @@
+ h=y2-y1+1;
+ dh=h+bw*2;
+ job=&_job;
++ JOB=job;
+ job_init(job);
+ job_init_image(job);
+ // willus_mem_alloc_warn((void **)&job->src.p.p,w*h,funcname,10);
+diff -aur k2_old/k2pdfopt_v2.32/willuslib/string.c k2_new/k2pdfopt_v2.32/willuslib/string.c
+--- k2_old/k2pdfopt_v2.32/willuslib/string.c 2014-12-05 11:52:04.000000000 -0300
++++ k2_new/k2pdfopt_v2.32/willuslib/string.c 2015-03-07 09:18:58.620126049 -0300
+@@ -81,7 +81,7 @@
+ ** Returns NULL if EOF, otherwise returns pointer to the string.
+ **
+ */
+-char *get_line(char *buf,int max,FILE *f)
++char *willus_get_line(char *buf,int max,FILE *f)
+
+ {
+ int i;
+diff -aur k2_old/k2pdfopt_v2.32/willuslib/willus.h k2_new/k2pdfopt_v2.32/willuslib/willus.h
+--- k2_old/k2pdfopt_v2.32/willuslib/willus.h 2015-03-06 09:38:28.000000000 -0300
++++ k2_new/k2pdfopt_v2.32/willuslib/willus.h 2015-03-07 09:18:58.594126051 -0300
+@@ -227,9 +227,6 @@
+ ** CMAKE handles the defines, not this source
+ ** (Mod from Dirk Thierbach, 31-Dec-2013)
+ */
+-#ifdef USE_CMAKE
+-#include "config.h"
+-#else /* USE_CMAKE */
+
+ #ifndef HAVE_Z_LIB
+ #define HAVE_Z_LIB
+@@ -281,7 +278,7 @@
+ #undef HAVE_GSL_LIB
+ #endif
+
+-#endif /* USE_CMAKE */
++
+ /*
+ ** Consistency check
+ */
+@@ -551,7 +548,7 @@
+ int *n,FILE *err);
+ int readxyz_ex (char *filename,double **x,double **y,double **z,
+ int *n,FILE *err,int ignore_after_semicolon);
+-void sort (float *x,int n);
++void willus_sort (float *x,int n);
+ void sortd (double *x,int n);
+ void sorti (int *x,int n);
+ void sortxy (float *x,float *y,int n);
+@@ -620,7 +617,7 @@
+ /* string.c */
+ void clean_line (char *buf);
+ void clean_line_end(char *buf);
+-char *get_line (char *buf,int max,FILE *f);
++char *willus_get_line (char *buf,int max,FILE *f);
+ char *get_line_cf (char *buf,int max,FILE *f);
+ int mem_get_line_cf(char *buf,int maxlen,char *cptr,long *cindex,long csize);
+ int in_string (char *buffer,char *pattern);
diff --git a/tesseract.patch b/tesseract.patch
new file mode 100644
index 000000000000..5cb6e0fe3176
--- /dev/null
+++ b/tesseract.patch
@@ -0,0 +1,12 @@
+diff -aur tesseract-ocr/api/Makefile.am tesseract-ocr.new/api/Makefile.am
+--- tesseract-ocr/api/Makefile.am 2012-10-09 14:18:39.000000000 -0300
++++ tesseract-ocr.new/api/Makefile.am 2014-03-20 18:43:13.926030341 -0300
+@@ -36,7 +36,7 @@
+ if VISIBILITY
+ libtesseract_api_la_CPPFLAGS += -DTESS_EXPORTS
+ endif
+-libtesseract_api_la_SOURCES = baseapi.cpp capi.cpp
++libtesseract_api_la_SOURCES = baseapi.cpp capi.cpp tesscapi.cpp
+
+ lib_LTLIBRARIES += libtesseract.la
+ libtesseract_la_LDFLAGS =