-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-linux.sh
executable file
·52 lines (44 loc) · 1.58 KB
/
build-linux.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
set -euo pipefail
CONFIG="${1?}"
TESSERACT_VERSION="${2?}"
LEPTONICA_VERSION="${3?}"
TESSERACT_DIR="${4-tesseract-$TESSERACT_VERSION}"
LEPTONICA_DIR="${5-leptonica-$LEPTONICA_VERSION}"
# configure leptonica
cmake $LEPTONICA_DIR -B "leptonica_build_$CONFIG" \
-DCMAKE_INSTALL_PREFIX="release/leptonica/$CONFIG" \
-DCMAKE_BUILD_TYPE="$CONFIG" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \
-DBUILD_SHARED_LIBS=OFF \
-DENABLE_ZLIB=OFF \
-DENABLE_PNG=OFF \
-DENABLE_GIF=OFF \
-DENABLE_JPEG=OFF \
-DENABLE_TIFF=OFF \
-DENABLE_WEBP=OFF \
-DENABLE_OPENJPEG=OFF \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
# build leptonica
cmake --build "leptonica_build_$CONFIG"
cmake --install "leptonica_build_$CONFIG" --prefix "release/leptonica/$CONFIG"
# configure tesseract
cmake $TESSERACT_DIR -B "tesseract_build_${CONFIG}" \
-DCMAKE_INSTALL_PREFIX="release/tesseract/$CONFIG" \
-DCMAKE_BUILD_TYPE="$CONFIG" \
-DBUILD_SHARED_LIBS=OFF \
-DLeptonica_DIR="$(pwd)/release/leptonica/$CONFIG/lib/cmake/leptonica" \
-DUSE_SYSTEM_ICU=ON \
-DBUILD_TRAINING_TOOLS=OFF \
-DBUILD_TESTS=OFF \
-DDISABLED_LEGACY_ENGINE=ON \
-DDISABLE_TIFF=ON \
-DDISABLE_CURL=ON \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
# build
cmake --build "tesseract_build_${CONFIG}"
cmake --install "tesseract_build_${CONFIG}" --prefix "release/tesseract/$CONFIG"
# copy leptonica static libraries to tesseract
cp -r "release/leptonica/$CONFIG/lib" "release/tesseract/$CONFIG/"
tar -C "release/tesseract/$CONFIG" -cvf "release/tesseract-linux-$TESSERACT_VERSION-$CONFIG.tar.gz" .