File: build_library

package info (click to toggle)
ccextractor 0.87%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 10,064 kB
  • sloc: ansic: 172,772; makefile: 777; sh: 622; python: 319
file content (34 lines) | stat: -rwxr-xr-x 981 bytes parent folder | download | duplicates (2)
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
#!/bin/bash
BLD_LINKER="-lm -zmuldefs -l tesseract -l lept -l python2.7"
WRAPPER_FLAGS="-Wl,-wrap,write"

out=$((./build_api && gcc -shared $(find -name '*.o') -o _ccextractor.so $BLD_LINKER)2>&1)
res=$?
if [[ $out == *"gcc: command not found"* ]]
then
    echo "Error: please install gcc";
    exit 1
fi
if [[ $out == *"curl.h: No such file or directory"* ]]
then
    echo "Error: please install curl development library (libcurl4-gnutls-dev for Debian/Ubuntu)";
    exit 2
fi
if [[ $out == *"capi.h: No such file or directory"* ]]
then
    echo "Error: please install tesseract development library (tesseract-ocr-dev for Debian/Ubuntu)";
    exit 3
fi
if [[ $out == *"allheaders.h: No such file or directory"* ]]
then
    echo "Error: please install leptonica development library (libleptonica-dev for Debian/Ubuntu)";
    exit 4
fi
if [[ $res -ne 0 ]]  # Unknown error
then
    echo "Compiled with errors"
    >&2 echo "$out"
    exit 5
fi
rm *.o
echo "Compilation successful";