|
3 | 3 | The below will produce a rather chubby binary (29M on my Debian box) but it should run correctly on all modern Linux distros. |
4 | 4 | If you don't need a static binary, simply follow the relevant install procedure [here](./README.md) |
5 | 5 |
|
| 6 | +For your convenience, a [build script](./static_build_debian.sh) with all of these is also available. |
| 7 | + |
6 | 8 | - Install deps: |
7 | 9 | ```sh |
8 | | -# apt-get install libdeflate-dev libtiff-dev libsharpyuv-dev libwebp-dev liblerc-dev liblzma-dev libjbig-dev libpng-dev libzstd-dev libjpeg-dev |
| 10 | +apt-get -U -y -q install libdeflate-dev libtiff-dev libsharpyuv-dev libwebp-dev git libgif-dev \ |
| 11 | + liblerc-dev liblzma-dev libjbig-dev libpng-dev libzstd-dev libjpeg-dev build-essential |
9 | 12 | ``` |
10 | 13 |
|
11 | | -Note: Debian/Ubuntu do provide static archives for both `libleptonica` and `libtesseract` but these are compiled with additional options that `super-zaje` does not need and statically linking against these archives would require the installation of several more `dev` packages. |
| 14 | +**Note: Debian/Ubuntu do provide static archives for both `libleptonica` and `libtesseract` but these are compiled with additional options that `super-zaje` does not need and statically linking against them would require the installation of several more `dev` packages. |
| 15 | +The below commands clone from head, obviously, you can use specific versions instead (always best).** |
12 | 16 |
|
13 | 17 | - Build a statically linked version of libleptonica: |
14 | 18 |
|
15 | 19 | ```sh |
16 | | -$ git clone --depth 1 https://github.com/DanBloomberg/leptonica.git |
17 | | -$ ./autogen.sh |
18 | | -$ ./configure --with-pic --disable-shared 'CFLAGS=-D DEFAULT_SEVERITY=L_SEVERITY_ERROR -g0 -O3' |
19 | | -$ make |
20 | | -# make install |
| 20 | +git clone --depth 1 https://github.com/DanBloomberg/leptonica.git |
| 21 | +cd leptonica |
| 22 | +./autogen.sh |
| 23 | +./configure --with-pic --disable-shared 'CFLAGS=-D DEFAULT_SEVERITY=L_SEVERITY_ERROR -g0 -O3' |
| 24 | +make |
| 25 | +make install |
21 | 26 | ``` |
22 | 27 |
|
23 | 28 | - Build a statically linked version of libtesseract: |
24 | 29 | ```sh |
25 | | -$ git clone --depth 1 https://github.com/tesseract-ocr/tesseract.git |
26 | | -$ ./autogen.sh |
27 | | -$ ./configure --with-pic --disable-shared --disable-legacy --disable-graphics --disable-openmp --without-curl --without-archive --disable-doc 'CXXFLAGS=-DTESS_EXPORTS -g0 -O3 -ffast-math' |
28 | | -$ make |
29 | | -# make install |
| 30 | +git clone --depth 1 https://github.com/tesseract-ocr/tesseract.git |
| 31 | +cd tesseract |
| 32 | +./autogen.sh |
| 33 | +./configure --with-pic --disable-shared --disable-legacy --disable-graphics \ |
| 34 | +--disable-openmp --without-curl --without-archive --disable-doc \ |
| 35 | +'CXXFLAGS=-DTESS_EXPORTS -g0 -O3 -ffast-math' |
| 36 | +make |
| 37 | +make install |
30 | 38 | ``` |
31 | 39 |
|
32 | 40 | - Build super-zaje: |
33 | 41 | ```sh |
34 | 42 | git clone https://github.com/jessp01/zaje.git |
35 | 43 | cd zaje/cmd/super-zaje |
36 | | -CGO_ENABLED=1 GOOS=linux go build -a -tags netgo -ldflags '-extldflags "-static -ldeflate -ltiff -L/usr/local/lib -ldeflate -lsharpyuv -lwebp -lLerc -llzma -ljbig -ltesseract -lleptonica -lpng -lzstd -ljpeg -lz -lgif -lsharpyuv -lwebp"' super-zaje.go |
| 44 | +CGO_ENABLED=1 GOOS=linux go build -a -tags netgo -ldflags \ |
| 45 | + '-extldflags "-static -ldeflate -ltiff -L/usr/local/lib -ldeflate -lsharpyuv -lwebp -lLerc -llzma -ljbig -ltesseract -lleptonica -lpng -lzstd -ljpeg -lz -lgif -lsharpyuv -lwebp"' super-zaje.go |
| 46 | +``` |
37 | 47 |
|
| 48 | +**Note: to run `super-zaje` on your target machines, you will need to copy [eng.traineddata](https://github.com/tesseract-ocr/tessdata/raw/refs/heads/main/eng.traineddata) to `/usr/local/share/tessdata`. |
| 49 | +You can also set the `TESSDATA_PREFIX` ENV dir if you wish to copy it to a different location.** |
0 commit comments