Skip to content

Commit

Permalink
* Avoid versioning of Tesseract library, preventing it from working …
Browse files Browse the repository at this point in the history
…on Android (issue #38)
  • Loading branch information
saudet committed Feb 24, 2015
1 parent 5ddc4d2 commit 603fec7
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

* Fix failing `cppbuild.sh` for FFmpeg on Ubuntu ([issue #32](https://github.com/bytedeco/javacpp-presets/issues/32))
* Disable iconv, XCB, and SDL for more portables builds of FFmpeg
* Avoid versioning of Leptonica libraries, which breaks Tesseract on Android ([issue #38](https://github.com/bytedeco/javacpp-presets/issues/38))
* Avoid versioning of Leptonica and Tesseract libraries, preventing them from working on Android ([issue #38](https://github.com/bytedeco/javacpp-presets/issues/38))
* Add x265 in the `cppbuild.sh` script for FFmpeg, thanks to Mark Bolstad ([issue bytedeco/javacv#41](https://github.com/bytedeco/javacv/issues/41))
* Upgrade presets for FFmpeg 2.5.4, OpenSSL 1.0.2
* Switch from `IntPointer` to `BoolPointer` for the `BOOL*` pointer type of Leptonica ([issue #36](https://github.com/bytedeco/javacpp-presets/issues/36))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"leptonica/ptra.h", "leptonica/queue.h", "leptonica/stack.h", "leptonica/arrayaccess.h", "leptonica/bmf.h", "leptonica/ccbord.h",
"leptonica/dewarp.h", "leptonica/gplot.h", "leptonica/imageio.h", "leptonica/jbclass.h", "leptonica/morph.h", "leptonica/pix.h",
"leptonica/recog.h", "leptonica/regutils.h", "leptonica/sudoku.h", "leptonica/watershed.h", "leptonica/allheaders.h"}, link="lept@.4",
preloadpath="/usr/lib/", preload={"gif@.4", "jpeg@.62", "png16@.16", "tiff@.5", "webp@.5"}),
preload={"gif@.4", "jpeg@.62", "png16@.16", "tiff@.5", "webp@.5"}),
@Platform(value="linux-x86", preloadpath={"/usr/lib32/", "/usr/lib/"}),
@Platform(value="linux-x86_64", preloadpath={"/usr/lib64/", "/usr/lib/"}),
@Platform(value="android", link="lept"),
Expand Down
2 changes: 2 additions & 0 deletions tesseract/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ fi

case $PLATFORM in
android-arm)
patch -Np1 < ../../../tesseract-$TESSERACT_VERSION-android.patch
cp "$ANDROID_ROOT/usr/lib/crtbegin_so.o" "$ANDROID_ROOT/usr/lib/crtend_so.o" api
ar r api/librt.a "$ANDROID_ROOT/usr/lib/crtbegin_dynamic.o"
./configure --prefix=$INSTALL_PATH --host="arm-linux-androideabi" --with-sysroot="$ANDROID_ROOT" LIBLEPT_HEADERSDIR="$INSTALL_PATH/../../../leptonica/cppbuild/$PLATFORM/include/" CC="$ANDROID_BIN-gcc" CXX="$ANDROID_BIN-g++" STRIP="$ANDROID_BIN-strip" CPPFLAGS="--sysroot=$ANDROID_ROOT -DANDROID -I$INSTALL_PATH/../../../leptonica/cppbuild/$PLATFORM/include/ -I$ANDROID_CPP/include/ -I$ANDROID_CPP/include/backward/ -I$ANDROID_CPP/libs/armeabi/include/ -fPIC -ffunction-sections -funwind-tables -fstack-protector -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300" LDFLAGS="-L$ANDROID_ROOT/usr/lib/ -L$ANDROID_CPP/libs/armeabi/ -nostdlib -Wl,--fix-cortex-a8 -L$INSTALL_PATH/../../../leptonica/cppbuild/$PLATFORM/lib/ -L./" LIBS="-lgnustl_static -lgcc -ldl -lz -lm -lc"
make -j4
make install-strip
;;
android-x86)
patch -Np1 < ../../../tesseract-$TESSERACT_VERSION-android.patch
cp "$ANDROID_ROOT/usr/lib/crtbegin_so.o" "$ANDROID_ROOT/usr/lib/crtend_so.o" api
ar r api/librt.a "$ANDROID_ROOT/usr/lib/crtbegin_dynamic.o"
./configure --prefix=$INSTALL_PATH --host="i686-linux-android" --with-sysroot="$ANDROID_ROOT" LIBLEPT_HEADERSDIR="$INSTALL_PATH/../../../leptonica/cppbuild/$PLATFORM/include/" CC="$ANDROID_BIN-gcc" CXX="$ANDROID_BIN-g++" STRIP="$ANDROID_BIN-strip" CPPFLAGS="--sysroot=$ANDROID_ROOT -DANDROID -I$INSTALL_PATH/../../../leptonica/cppbuild/$PLATFORM/include/ -I$ANDROID_CPP/include/ -I$ANDROID_CPP/include/backward/ -I$ANDROID_CPP/libs/x86/include/ -fPIC -ffunction-sections -funwind-tables -mssse3 -mfpmath=sse -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -L$INSTALL_PATH/../../../leptonica/cppbuild/$PLATFORM/lib/" LDFLAGS="-L$ANDROID_ROOT/usr/lib/ -L$ANDROID_CPP/libs/x86/ -nostdlib -L$INSTALL_PATH/../../../leptonica/cppbuild/$PLATFORM/lib/ -L." LIBS="-lgnustl_static -lgcc -ldl -lz -lm -lc"
Expand Down
33 changes: 33 additions & 0 deletions tesseract/tesseract-3.03-android.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
diff -ruN tesseract-3.03/api/Makefile.am tesseract-3.03-android/api/Makefile.am
--- tesseract-3.03/api/Makefile.am 2014-01-24 07:51:24.000000000 +0900
+++ tesseract-3.03-android/api/Makefile.am 2015-02-24 21:11:57.588323059 +0900
@@ -20,7 +20,7 @@
noinst_LTLIBRARIES = libtesseract_api.la
else
lib_LTLIBRARIES += libtesseract_api.la
-libtesseract_api_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION)
+libtesseract_api_la_LDFLAGS = -avoid-version
libtesseract_api_la_LIBADD = \
../ccmain/libtesseract_main.la \
../cube/libtesseract_cube.la \
diff -ruN tesseract-3.03/api/Makefile.in tesseract-3.03-android/api/Makefile.in
--- tesseract-3.03/api/Makefile.in 2014-02-05 09:04:29.000000000 +0900
+++ tesseract-3.03-android/api/Makefile.in 2015-02-24 21:12:24.921849154 +0900
@@ -298,7 +298,7 @@
include_HEADERS = apitypes.h baseapi.h capi.h renderer.h
lib_LTLIBRARIES = $(am__append_3) libtesseract.la
@USING_MULTIPLELIBS_FALSE@noinst_LTLIBRARIES = libtesseract_api.la
-@USING_MULTIPLELIBS_TRUE@libtesseract_api_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION)
+@USING_MULTIPLELIBS_TRUE@libtesseract_api_la_LDFLAGS = -avoid-version
@USING_MULTIPLELIBS_TRUE@libtesseract_api_la_LIBADD = \
@USING_MULTIPLELIBS_TRUE@ ../ccmain/libtesseract_main.la \
@USING_MULTIPLELIBS_TRUE@ ../cube/libtesseract_cube.la \
@@ -315,7 +315,7 @@

libtesseract_api_la_CPPFLAGS = $(AM_CPPFLAGS) $(am__append_4)
libtesseract_api_la_SOURCES = baseapi.cpp capi.cpp pdfrenderer.cpp renderer.cpp
-libtesseract_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION) \
+libtesseract_la_LDFLAGS = -avoid-version \
$(am__append_8)
libtesseract_la_SOURCES =
# Dummy C++ source to cause C++ linking.

0 comments on commit 603fec7

Please sign in to comment.