This guide uses my own repos from Mer Obs. I found it very hard to find information about this so hopefully someone sees this useful. This short guide was created as a side product while I was creating these RPM packages (which wasn't so clear to me either).
-
Add the repositories to the Mer SDK armv7hl and i486 targets (you'll have to ssh to the Mer SDK):
sb2 -t SailfishOS-armv7hl -m sdk-install -R zypper ar -f http://repo.merproject.org/obs/home:/skvark/latest_armv7hl tesseract-ocr
sb2 -t SailfishOS-armv7hl -m sdk-install -R zypper ar -f http://repo.merproject.org/obs/home:/skvark/latest_armv7hl leptonica
sb2 -t SailfishOS-i486 -m sdk-install -R zypper ar -f http://repo.merproject.org/obs/home:/skvark/latest_i486 tesseract-ocr
sb2 -t SailfishOS-i486 -m sdk-install -R zypper ar -f http://repo.merproject.org/obs/home:/skvark/latest_i486 leptonica
-
Refresh
sb2 -t SailfishOS-i486 -m sdk-install -R zypper ref
andsb2 -t SailfishOS-armv7hl -m sdk-install -R zypper ref
-
Install packages:
sb2 -t SailfishOS-armv7hl -m sdk-install -R zypper in tesseract-ocr-devel tesseract-ocr leptonica leptonica-devel
sb2 -t SailfishOS-i486 -m sdk-install -R zypper in tesseract-ocr-devel tesseract-ocr leptonica leptonica-devel
-
Synchronize the targets with the SDK. This has to be done because SDK uses shared folders and they do not update automatically.
- Go to the Sailfish SDK and click SailFish OS tab
- In targets, click manage -> sync for both targets
- Check that i.e. the header files appeared to the shared folder (in Windows i.e. C:\SailfishOS\mersdk\targets\SailfishOS-i486\usr\include\tesseract)
-
If you want to use the i486 emulator, the packages must be installed there too
pkcon install zypper
sudo zypper ar http://repo.merproject.org/obs/home:/skvark/latest_i486 leptonica
sudo zypper ar http://repo.merproject.org/obs/home:/skvark/latest_i486 tesseract-ocr
sudo zypper ref
sudo zypper in leptonica-devel leptonica tesseract-ocr tesseract-ocr-devel
You should be able now to do like this:
- In the .pro file, add line
LIBS += -ltesseract -llept
- In your C++ files include the development headers like this:
#include <tesseract/baseapi.h>
#include <leptonica/allheaders.h>
However, this is not everything. You can't submit the app to the Jolla Harbour yet, because the libraries are not likely allowed in the store. You should package the libs with the app and after that it would be allowed in the Harbour.