2017-05-31 10:21:08 +00:00
|
|
|
#!/bin/bash
|
|
|
|
./build_api
|
|
|
|
OBJ_SOURCES="$(find -name '*.o')"
|
|
|
|
BLD_LINKER="-lm -zmuldefs -l tesseract -l lept -l python2.7"
|
|
|
|
|
2017-06-27 09:18:32 +00:00
|
|
|
out=$((swig -python ccextractor.i && ./build_api && gcc -shared $OBJ_SOURCES -o _ccextractor.so ) 2>&1)
|
2017-05-31 10:21:08 +00:00
|
|
|
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
|
2017-05-31 10:35:27 +00:00
|
|
|
rm *.o
|
2017-05-31 10:21:08 +00:00
|
|
|
echo "Compilation successful";
|