-
Notifications
You must be signed in to change notification settings - Fork 254
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
233 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
build_wheels: | ||
name: Build wheel for ${{ matrix.config.platform }} ${{ matrix.config.arch }} | ||
|
||
runs-on: ${{ matrix.config.os }} | ||
strategy: | ||
matrix: | ||
config: | ||
- { os: ubuntu-22.04, platform: manylinux, arch: x86_64 } | ||
- { os: ubuntu-22.04, platform: musllinux, arch: x86_64 } | ||
- { os: macos-12, platform: macosx, arch: x86_64 } | ||
- { os: macos-12, platform: macosx, arch: arm64 } | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build wheel | ||
uses: pypa/cibuildwheel@v2.12.1 | ||
env: | ||
CIBW_ARCHS: "${{ matrix.config.arch }}" | ||
CIBW_BUILD: "cp*-${{ matrix.config.platform }}_${{ matrix.config.arch }}" | ||
CIBW_SKIP: "cp36* cp37*" | ||
|
||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: ./wheelhouse/*.whl | ||
|
||
build_sdist: | ||
name: Build sdist | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.8" | ||
|
||
- name: Build sdist | ||
run: python setup.py sdist | ||
|
||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: ./dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
LEPTONICA_VERSION="1.83.1" | ||
TESSERACT_VERSION="5.3.1" | ||
|
||
PREFIX="${PREFIX:-/usr/local}" | ||
|
||
curl -L -O "https://github.com/DanBloomberg/leptonica/releases/download/${LEPTONICA_VERSION}/leptonica-${LEPTONICA_VERSION}.tar.gz" | ||
|
||
tar -xzf leptonica-${LEPTONICA_VERSION}.tar.gz | ||
|
||
curl -L -o "tesseract-${TESSERACT_VERSION}.tar.gz" "https://github.com/tesseract-ocr/tesseract/archive/refs/tags/${TESSERACT_VERSION}.tar.gz" | ||
|
||
tar -xzf tesseract-${TESSERACT_VERSION}.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
source $(dirname -- "$0")/common-install-tesseract.sh | ||
|
||
# build leptonica | ||
cd leptonica-${LEPTONICA_VERSION} | ||
|
||
cmake \ | ||
-B build \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \ | ||
-DBUILD_SHARED_LIBS=ON | ||
|
||
cmake \ | ||
--build build \ | ||
--config Release \ | ||
--target install | ||
|
||
cd .. | ||
|
||
# build tesseract | ||
cd tesseract-${TESSERACT_VERSION} | ||
|
||
cmake \ | ||
-B build \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \ | ||
-DBUILD_SHARED_LIBS=ON \ | ||
-DOPENMP_BUILD=OFF | ||
|
||
cmake \ | ||
--build build \ | ||
--config Release \ | ||
--target install | ||
|
||
cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
# leptonica dependencies | ||
brew install \ | ||
giflib \ | ||
jpeg-turbo \ | ||
libpng \ | ||
libtiff \ | ||
openjpeg \ | ||
webp \ | ||
zlib | ||
|
||
# tesseract dependencies | ||
brew install \ | ||
pango \ | ||
cairo \ | ||
icu4c | ||
brew link icu4c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
source $(dirname -- "$0")/common-install-tesseract.sh | ||
|
||
# build leptonica | ||
cd leptonica-${LEPTONICA_VERSION} | ||
|
||
cmake \ | ||
-B build \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \ | ||
-DCMAKE_OSX_DEPLOYMENT_TARGET="12.0" \ | ||
-DCMAKE_FIND_FRAMEWORK=NEVER \ | ||
-DBUILD_SHARED_LIBS=ON | ||
|
||
cmake \ | ||
--build build \ | ||
--config Release \ | ||
--target install | ||
|
||
cd .. | ||
|
||
# build tesseract | ||
# see https://github.com/orgs/Homebrew/discussions/4031#discussioncomment-4348867 | ||
export PKG_CONFIG_PATH=$(brew --prefix)/opt/icu4c/lib/pkgconfig:$PKG_CONFIG_PATH | ||
|
||
cd tesseract-${TESSERACT_VERSION} | ||
|
||
cmake \ | ||
-B build \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \ | ||
-DCMAKE_OSX_DEPLOYMENT_TARGET="12.0" \ | ||
-DCMAKE_FIND_FRAMEWORK=NEVER \ | ||
-DBUILD_SHARED_LIBS=ON \ | ||
-DOPENMP_BUILD=OFF | ||
|
||
cmake \ | ||
--build build \ | ||
--config Release \ | ||
--target install | ||
|
||
cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
# leptonica dependencies | ||
yum install -y \ | ||
giflib-devel \ | ||
libjpeg-devel \ | ||
libpng-devel \ | ||
libtiff-devel \ | ||
libwebp-devel \ | ||
openjpeg2-devel \ | ||
zlib-devel | ||
|
||
# tesseract dependencies | ||
yum install -y \ | ||
cairo-devel \ | ||
libicu-devel \ | ||
pango-devel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
# leptonica dependencies | ||
apk add \ | ||
giflib-dev\ | ||
libjpeg-turbo-dev\ | ||
libpng-dev\ | ||
libwebp-dev\ | ||
openjpeg-dev\ | ||
openjpeg-tools\ | ||
tiff-dev\ | ||
zlib-dev | ||
|
||
# tesseract dependencies | ||
apk add \ | ||
cairo-dev \ | ||
icu-dev \ | ||
pango-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[tool.cibuildwheel] | ||
build-verbosity = "1" | ||
|
||
manylinux-x86_64-image = "manylinux_2_28" | ||
manylinux-aarch64-image = "manylinux_2_28" | ||
|
||
[tool.cibuildwheel.linux] | ||
before-all = [ | ||
"bash build-scripts/manylinux-install-build-dependencies.sh", | ||
"bash build-scripts/linux-install-tesseract.sh", | ||
] | ||
|
||
[[tool.cibuildwheel.overrides]] | ||
select = "*-musllinux*" | ||
before-all = [ | ||
"bash build-scripts/musllinux-install-build-dependencies.sh", | ||
"bash build-scripts/linux-install-tesseract.sh", | ||
] | ||
|
||
[tool.cibuildwheel.macos] | ||
before-all = [ | ||
"bash build-scripts/macos-install-build-dependencies.sh", | ||
"bash build-scripts/macos-install-tesseract.sh", | ||
] |