Monday, January 07, 2019

Re: graphics/tesseract pkg-config --cflags

On 1/7/19 3:46 PM, Stuart Henderson wrote:
> On 2019/01/07 15:29, Raphael Graf wrote:
>> The diff below fixes the pkg-config file installed by tesseract.
>>
>> Before:
>> x1$ pkg-config --cflags tesseract
>> -I/usr/local/include/tesseract -I/usr/local/include/leptonica
>>
>> After:
>> x1$ pkg-config --cflags tesseract
>> -I/usr/local/include -I/usr/local/include/tesseract -I/usr/local/include/leptonica
>>
>> The fix is inspired by tesseract.pc.cmake (which we do not use):
>> https://github.com/tesseract-ocr/tesseract/blob/3.05/tesseract.pc.cmake
>>
>> (The issue is already fixed in upstream version 4.0.0)
>
> Could you explain the problem please? I don't see anything different in
> git master for this file, and don't see why -I/usr/local/include is needed
> when the files are all in the subdirectory?

The tesseract headers are normally included like this:
#include <tesseract/baseapi.h>

For example in one of the opencv_contrib modules:
https://github.com/opencv/opencv_contrib/blob/master/modules/text/src/precomp.hpp

The git master version uses '-I/usr/local/include' only.
(It is not obvious if you are looking at tesseract.pc.in, the value of
@includedir@ is in fact '/usr/local/include' now).


>
>>
>> Index: tesseract/patches/patch-tesseract_pc_in
>> ===================================================================
>> RCS file: tesseract/patches/patch-tesseract_pc_in
>> diff -N tesseract/patches/patch-tesseract_pc_in
>> --- /dev/null 1 Jan 1970 00:00:00 -0000
>> +++ tesseract/patches/patch-tesseract_pc_in 7 Jan 2019 13:56:00 -0000
>> @@ -0,0 +1,20 @@
>> +$OpenBSD$
>> +
>> +Index: tesseract.pc.in
>> +--- tesseract.pc.in.orig
>> ++++ tesseract.pc.in
>> +@@ -4,7 +4,7 @@ bindir=@bindir@
>> + datarootdir = @datarootdir@
>> + datadir=@datadir@
>> + libdir=@libdir@
>> +-includedir=@includedir@
>> ++includedir=@prefix@/include
>> +
>> + Name: @PACKAGE_NAME@
>> + Description: An OCR Engine that was developed at HP Labs between 1985 and 1995... and now at Google.
>> +@@ -13,4 +13,4 @@ Version: @VERSION@
>> + Requires.private: lept
>> + Libs: -L${libdir} -ltesseract
>> + Libs.private: -lpthread @OPENCL_LDFLAGS@
>> +-Cflags: -I${includedir}
>> ++Cflags: -I${includedir} -I${includedir}/tesseract
>>
>>
>

No comments:

Post a Comment