2014-04-12 10:41:27 +00:00
|
|
|
#!/bin/bash
|
2016-12-14 01:41:38 +00:00
|
|
|
BLD_FLAGS="-std=gnu99 -Wno-write-strings -DGPAC_CONFIG_LINUX -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -DENABLE_OCR"
|
2017-05-25 11:27:57 +00:00
|
|
|
BLD_INCLUDE="-I../src -I /usr/include/leptonica/ -I /usr/include/tesseract/ -I../src/lib_ccx/ -I../src/gpacmp4/ -I../src/libpng/ -I../src/zlib/ -I../src/zvbi -I../src/lib_hash -I../src/protobuf-c -I../src/utf8proc"
|
2015-08-27 10:50:55 +00:00
|
|
|
SRC_LIBPNG="$(find ../src/libpng/ -name '*.c')"
|
|
|
|
SRC_ZLIB="$(find ../src/zlib/ -name '*.c')"
|
2016-02-09 15:27:49 +00:00
|
|
|
SRC_ZVBI="$(find ../src/zvbi/ -name '*.c')"
|
2015-08-27 10:50:55 +00:00
|
|
|
SRC_CCX="$(find ../src/lib_ccx/ -name '*.c')"
|
|
|
|
SRC_GPAC="$(find ../src/gpacmp4/ -name '*.c')"
|
2016-05-22 01:49:31 +00:00
|
|
|
SRC_HASH="$(find ../src/lib_hash/ -name '*.c')"
|
2016-08-25 22:57:33 +00:00
|
|
|
SRC_PROTOBUF="$(find ../src/protobuf-c/ -name '*.c')"
|
2016-09-28 20:05:09 +00:00
|
|
|
SRC_UTF8PROC="../src/utf8proc/utf8proc.c"
|
|
|
|
BLD_SOURCES="../src/ccextractor.c $SRC_CCX $SRC_GPAC $SRC_ZLIB $SRC_ZVBI $SRC_LIBPNG $SRC_HASH $SRC_PROTOBUF $SRC_UTF8PROC"
|
2017-05-25 11:27:57 +00:00
|
|
|
BLD_LINKER="-lm -zmuldefs -l tesseract -l lept"
|
2015-08-27 10:50:55 +00:00
|
|
|
|
2016-05-22 07:44:55 +00:00
|
|
|
./pre-build.sh
|
2016-12-15 17:07:29 +00:00
|
|
|
|
2017-05-25 11:27:57 +00:00
|
|
|
out=$((LC_ALL=C gcc $BLD_FLAGS $BLD_INCLUDE -o ccextractor $BLD_SOURCES $BLD_LINKER)2>&1)
|
2016-12-15 17:07:29 +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
|
2016-12-15 19:32:17 +00:00
|
|
|
echo "Compilation successful";
|