Skip to content

Instantly share code, notes, and snippets.

@skvark
Last active April 4, 2024 04:50
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save skvark/49a2f1904192b6db311a to your computer and use it in GitHub Desktop.
Save skvark/49a2f1904192b6db311a to your computer and use it in GitHub Desktop.
Describes how to add repositories to Sailfish OS SDK (emulator and targets) and how to install them so that they can be used straight from the SDK.

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).

  1. 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
  2. Refresh sb2 -t SailfishOS-i486 -m sdk-install -R zypper ref and sb2 -t SailfishOS-armv7hl -m sdk-install -R zypper ref

  3. 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
  4. Synchronize the targets with the SDK. This has to be done because SDK uses shared folders and they do not update automatically.

    1. Go to the Sailfish SDK and click SailFish OS tab
    2. In targets, click manage -> sync for both targets
    3. 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)
  5. If you want to use the i486 emulator, the packages must be installed there too

    1. pkcon install zypper
    2. sudo zypper ar http://repo.merproject.org/obs/home:/skvark/latest_i486 leptonica
    3. sudo zypper ar http://repo.merproject.org/obs/home:/skvark/latest_i486 tesseract-ocr
    4. sudo zypper ref
    5. sudo zypper in leptonica-devel leptonica tesseract-ocr tesseract-ocr-devel

You should be able now to do like this:

  1. In the .pro file, add line LIBS += -ltesseract -llept
  2. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment