mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-08 21:00:05 +02:00
gocr: added recipe and patch for version 0.50
* removed previous non-working recipe
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
DESCRIPTION="An OCR (Octical Character Recognition) reader"
|
||||
HOMEPAGE="http://jocr.sofrceforge.net"
|
||||
SRC_URI="http://www-e.uni-magdeburg.de/jschulen/ocr/gocr-0.49.tar.gz"
|
||||
REVISION="1"
|
||||
STATUS_HAIKU="stable"
|
||||
DEPEND=""
|
||||
CHECKSUM_MD5="4e527bc4bdd97c2be15fdd818857507f"
|
||||
|
||||
BUILD()
|
||||
{
|
||||
cd gocr-0.49
|
||||
libtoolize --force --copy --install
|
||||
aclocal
|
||||
autoconf
|
||||
./configure --prefix=`finddir B_COMMON_DIRECTORY` \
|
||||
--libdir=`finddir B_COMMON_LIB_DIRECTORY` \
|
||||
--bindir=`finddir B_COMMON_BIN_DIRECTORY`
|
||||
make
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
cd gocr-0.49
|
||||
make install DESTDIR=${DESTDIR}
|
||||
}
|
||||
|
||||
LICENSE="GNU GPL v2"
|
||||
COPYRIGHT="2000-2010 Joerg Schulenburg"
|
||||
51
app-text/gocr/gocr-0.50.recipe
Normal file
51
app-text/gocr/gocr-0.50.recipe
Normal file
@@ -0,0 +1,51 @@
|
||||
SUMMARY="An OCR (Octical Character Recognition) reader"
|
||||
DESCRIPTION="
|
||||
It converts scanned images of text back to text files. Joerg Schulenburg \
|
||||
started the program, and now leads a team of developers.
|
||||
GOCR can be used with different front-ends, which makes it very easy to port \
|
||||
to different OSes and architectures. It can open many different image \
|
||||
formats, and its quality have been improving in a daily basis."
|
||||
HOMEPAGE="http://jocr.sofrceforge.net"
|
||||
SRC_URI="http://www-e.uni-magdeburg.de/jschulen/ocr/gocr-$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="bc261244f887419cba6d962ec1ad58eefd77176885093c4a43061e7fd565f5b5"
|
||||
LICENSE="GNU GPL v2"
|
||||
COPYRIGHT="2000-2013 Joerg Schulenburg"
|
||||
ARCHITECTURES="x86_gcc2 ?x86 ?x86_64"
|
||||
|
||||
REVISION="1"
|
||||
|
||||
PROVIDES="
|
||||
$portName = $portVersion
|
||||
cmd:gocr
|
||||
cmd:gocr.tcl
|
||||
"
|
||||
|
||||
REQUIRES="
|
||||
haiku
|
||||
"
|
||||
|
||||
BUILD_PREREQUIRES="
|
||||
haiku_devel
|
||||
cmd:gcc
|
||||
cmd:ld
|
||||
cmd:make
|
||||
cmd:libtoolize
|
||||
cmd:aclocal
|
||||
cmd:autoconf
|
||||
"
|
||||
|
||||
PATCHES="gocr-0.50.patchset"
|
||||
|
||||
BUILD()
|
||||
{
|
||||
libtoolize --force --copy --install
|
||||
aclocal
|
||||
autoconf
|
||||
runConfigure configure
|
||||
make
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
make install DESTDIR=${DESTDIR}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
diff -urN gocr-0.49-orig/configure.in gocr-0.49/configure.in
|
||||
--- gocr-0.49-orig/configure.in 2010-08-04 12:33:10.000000000 +0000
|
||||
+++ gocr-0.49/configure.in 2011-06-03 13:04:26.985137152 +0000
|
||||
@@ -41,8 +41,8 @@
|
||||
# netpbm-9 : libpnm + pnm.h (+ p[bgp]m.h)
|
||||
# pnm_readpaminit (netpbm-10)
|
||||
# pnm_readpnminit (netpbm-9,10)
|
||||
-# ToDo: how to check that -lm is needed?
|
||||
-LDFLAGS="-lm $LDFLAGS"
|
||||
+AC_CHECK_LIBM
|
||||
+LDFLAGS="$LIBM $LDFLAGS"
|
||||
AC_SEARCH_LIBS(pnm_readpnminit,[netpbm pnm],[check_netpbm_h="pam.h pnm.h"],
|
||||
[ echo " * * * try option --with-netpbm=PATH"])
|
||||
fi
|
||||
diff -urN gocr-0.49-orig/src/barcode.c gocr-0.49/src/barcode.c
|
||||
--- gocr-0.49-orig/src/barcode.c 2010-08-04 12:03:59.000000000 +0000
|
||||
+++ gocr-0.49/src/barcode.c 2011-06-03 13:05:00.909115392 +0000
|
||||
@@ -999,8 +999,10 @@
|
||||
/* j is the num of bars found above, some inner bars are not counted */
|
||||
/* ToDo: better iterative add next nearest bars from sorted list near bars? */
|
||||
{
|
||||
- int row, col;
|
||||
+ int row, col, nc, nr, dm_d;
|
||||
+ int cpos=0;
|
||||
char *dm_bitmap=NULL;
|
||||
+ char *code=0;
|
||||
|
||||
// store pattern without finder pattern into dm_bitmap
|
||||
dm_bitmap=(char *)malloc(4*(bx1-regx)*(by1-regy));
|
||||
@@ -1016,6 +1018,7 @@
|
||||
|
||||
/* transport the info to the gocr-output (development) */
|
||||
if (JOB->cfg.verbose) {
|
||||
+
|
||||
fprintf(stderr,"\n# ");
|
||||
for (col=0;col<2*bx1;col++)
|
||||
if (col<=8) fprintf(stderr," %1d",col); else
|
||||
@@ -1048,7 +1051,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
- char *code=0; int cpos=0;
|
||||
box2->c=PICTURE; /* BARCODE */
|
||||
code=NULL;
|
||||
code=(char *)malloc(6*4*bx1*by1/8+128); /* maxlen: &#%3d; = 6 */
|
||||
@@ -1070,9 +1072,10 @@
|
||||
/* ToDo: decode and print/store barcode bars=j */
|
||||
x = +0; // col += 2
|
||||
y = +4; // row -= 2
|
||||
- int nc=2*(bx1-regx), nr=2*(by1-regy),
|
||||
+ nc=2*(bx1-regx);
|
||||
+ nr=2*(by1-regy);
|
||||
// dm_mode=0, // ECC200-mode: 0=ASCII+digitpair, 230=C40
|
||||
- dm_d=+1; // direction right/down
|
||||
+ dm_d=+1; // direction right/down
|
||||
for (j=0;j<(bx1-regx)*(by1-regy)/2;j++) { // each byte
|
||||
int dm_byte=0;
|
||||
const int *pp; /* pointer to (const int) */
|
||||
97
app-text/gocr/patches/gocr-0.50.patchset
Normal file
97
app-text/gocr/patches/gocr-0.50.patchset
Normal file
@@ -0,0 +1,97 @@
|
||||
From de2d5c3bd349402fbbf5d31fdb2ca43ea2a77146 Mon Sep 17 00:00:00 2001
|
||||
From: Sergei Reznikov <diver@gelios.net>
|
||||
Date: Sun, 29 Mar 2015 14:15:42 +0300
|
||||
Subject: Haiku fixes
|
||||
|
||||
|
||||
diff --git a/configure.in b/configure.in
|
||||
index d2fe591..bcdf326 100644
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -41,8 +41,8 @@ if test "$with_netpbm" != "no"; then
|
||||
# netpbm-9 : libpnm + pnm.h (+ p[bgp]m.h)
|
||||
# pnm_readpaminit (netpbm-10)
|
||||
# pnm_readpnminit (netpbm-9,10)
|
||||
-# ToDo: how to check that -lm is needed?
|
||||
-LDFLAGS="-lm $LDFLAGS"
|
||||
+AC_CHECK_LIBM
|
||||
+LDFLAGS="$LIBM $LDFLAGS"
|
||||
AC_SEARCH_LIBS(pnm_readpnminit,[netpbm pnm],[check_netpbm_h="pam.h pnm.h"],
|
||||
[ echo " * * * try option --with-netpbm=PATH"])
|
||||
fi
|
||||
diff --git a/src/barcode.c b/src/barcode.c
|
||||
index 1c0d666..dfd7219 100644
|
||||
--- a/src/barcode.c
|
||||
+++ b/src/barcode.c
|
||||
@@ -1177,8 +1177,9 @@ int detect_barcode(job_t *job)
|
||||
/* j is the num of bars found above, some inner bars are not counted */
|
||||
/* ToDo: better iterative add next nearest bars from sorted list near bars? */
|
||||
{
|
||||
- int row, col;
|
||||
+ int row, col, cpos, nc, nr, dm_d;
|
||||
char *dm_bitmap=NULL;
|
||||
+ char *code=0;
|
||||
|
||||
// store pattern without finder pattern into dm_bitmap
|
||||
dm_bitmap=(char *)malloc(4*(bx1-regx)*(by1-regy));
|
||||
@@ -1226,7 +1227,6 @@ int detect_barcode(job_t *job)
|
||||
}
|
||||
}
|
||||
|
||||
- char *code=0; int cpos=0;
|
||||
box2->c=PICTURE; /* BARCODE */
|
||||
code=NULL;
|
||||
code=(char *)malloc(6*4*bx1*by1/8+128); /* maxlen: &#%3d; = 6 */
|
||||
@@ -1248,7 +1248,8 @@ int detect_barcode(job_t *job)
|
||||
/* ToDo: decode and print/store barcode bars=j */
|
||||
x = +0; // col += 2
|
||||
y = +4; // row -= 2
|
||||
- int nc=2*(bx1-regx), nr=2*(by1-regy),
|
||||
+ nc=2*(bx1-regx);
|
||||
+ nr=2*(by1-regy);
|
||||
// dm_mode=0, // ECC200-mode: 0=ASCII+digitpair, 230=C40
|
||||
dm_d=+1; // direction right/down
|
||||
for (j=0;j<(bx1-regx)*(by1-regy)/2;j++) { // each byte
|
||||
@@ -1466,6 +1467,12 @@ int detect_barcode(job_t *job)
|
||||
qr_mode=0, qr_mask=0, qr_version=0, qr_ecclevel=0;
|
||||
int an2, ad1, ad2, // allignment parts, rest distance, main distance
|
||||
num_rawbits;
|
||||
+ int num_data_bytes, num_ecc_bytes; // data bytes include header bits
|
||||
+ int b1, b2;
|
||||
+ int dl=0, el=0, i_ecc=num_data_bytes, i_data=0; // data and ecc length
|
||||
+ int next_wbits=1023; // bits of the next dataword
|
||||
+ unsigned char qr_ecc[256]; // buffer for generated ecc data
|
||||
+ unsigned char *ptext=NULL; // pointer to char tuple of next word
|
||||
|
||||
if(job->cfg.verbose)
|
||||
fprintf(stderr,"#\n# barcode.c detect_barcode search qrcode ");
|
||||
@@ -1773,7 +1780,6 @@ int detect_barcode(job_t *job)
|
||||
qrbytes=(unsigned char *)malloc(x*x/8); // enough space for data bits + ecc
|
||||
nbits=0; // num valid data bits 0..x*x-- of all data blocks
|
||||
bbits=0; // 8 bits
|
||||
- int num_data_bytes, num_ecc_bytes; // data bytes include header bits
|
||||
interleave= qrConst[qr_version-1][6+2*qr_ecclevel+0] // 1-40 0123=LMQH
|
||||
+ qrConst[qr_version-1][6+2*qr_ecclevel+1];
|
||||
// raw_bytes, raw_bits_mod, ecc0 .. ecc3
|
||||
@@ -1853,9 +1859,6 @@ int detect_barcode(job_t *job)
|
||||
// v2 H m1=34=3*11+1=114bit
|
||||
// L m1=77=3*25+2=257bit
|
||||
// v3 e2=Q m1= raw=34+36ecc=70(ok)rest7
|
||||
- int b1, b2;
|
||||
- int dl=0, el=0, i_ecc=num_data_bytes, i_data=0; // data and ecc length
|
||||
- unsigned char qr_ecc[256]; // buffer for generated ecc data
|
||||
b1 = qrConst[qr_version-1][6+2*qr_ecclevel+0];
|
||||
b2 = qrConst[qr_version-1][6+2*qr_ecclevel+1];
|
||||
// for b1 and b2 we have different datasize ???
|
||||
@@ -1887,8 +1890,6 @@ int detect_barcode(job_t *job)
|
||||
nchars=0; // num chars (nwords*cpw+rest) expected
|
||||
dchars=0; // num chars decoded
|
||||
wbits=0; // data bits of local word
|
||||
- int next_wbits=1023; // bits of the next dataword
|
||||
- unsigned char *ptext=NULL; // pointer to char tuple of next word
|
||||
// get bits and words from deinterleaved byte stream
|
||||
g_debug(fprintf(stderr,"\n# qrcode bytes: %02x %02x %02x ...\n# qr new_block ",
|
||||
255&(int)qrbytes[0], 255&(int)qrbytes[1], 255&(int)qrbytes[2]);)
|
||||
--
|
||||
2.2.2
|
||||
|
||||
Reference in New Issue
Block a user