Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
paperless-baremetal/tesseract.build.sh
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
104 lines (73 sloc)
1.79 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
{ | |
set -x | |
set -e | |
set -u | |
. build.profile | |
. ${PREFIX}/${BUILD_sqlite}/profile | |
. ${PREFIX}/${BUILD_python}/profile | |
. ${PREFIX}/${BUILD_leptonica}/profile | |
BUILD_PKG=${BUILD_tesseract} | |
function B_TESSERACT { | |
PREFIX=${PREFIX}/${BUILD_PKG} | |
mkdir -p $PREFIX | |
cat >$PREFIX/profile <<-EOF | |
PATH=$PREFIX/bin:\$PATH | |
EOF | |
if [[ -e ${BUILD_PKG}.tar ]]; then | |
tar -xf ${BUILD_PKG}.tar | |
fi | |
if [[ ! -d ${BUILD_PKG} ]]; then | |
git clone https://github.com/tesseract-ocr/tesseract.git --branch ${BUILD_PKG##*-} --single-branch ${BUILD_PKG} | |
fi | |
if [[ ! -e ${BUILD_PKG}.tar ]]; then | |
tar cf ${BUILD_PKG}.tar ${BUILD_PKG} | |
fi | |
pushd ${BUILD_PKG} | |
local _conf=( | |
--prefix "${PREFIX}" | |
) | |
./autogen.sh | |
PKG_CONFIG_PATH=${PKG_CONFIG_PATH} \ | |
./configure "${_conf[@]}" | |
make -j "${NPROC}" install | |
popd | |
} | |
function B_TESSDATA { | |
PREFIX=${PROJECT}/${BUILD_PKG} | |
##### | |
if [[ -e tessdata.tar ]]; then | |
tar -xf tessdata.tar | |
fi | |
if [[ ! -d tessdata/.git ]]; then | |
git clone https://github.com/tesseract-ocr/tessdata_best.git --single-branch tessdata | |
fi | |
if [[ ! -e tessdata.tar ]]; then | |
tar cf tessdata.tar tessdata | |
fi | |
##### | |
if [[ -e tessconfigs.tar ]]; then | |
tar -xf tessconfigs.tar | |
fi | |
if [[ ! -d tessconfigs/.git ]]; then | |
git clone https://github.com/tesseract-ocr/tessconfigs.git --single-branch tessconfigs | |
fi | |
if [[ ! -e tessconfigs.tar ]]; then | |
tar cf tessconfigs.tar tessconfigs | |
fi | |
rm -rf ${PREFIX}/share/tessdata | |
mkdir -vp ${PREFIX}/share | |
# tessdata/tessconfigs/ empty | |
# tessdata/pdf.ttf -> tessconfigs/pdf.ttf | |
# tessdata/configs -> tessconfigs/configs | |
# tessconfigs/tessconfigs/* | |
# tessconfigs/pdf.ttf | |
# tessconfigs/configs/* | |
tar xf tessdata.tar --exclude=.git -C ${PREFIX}/share | |
tar xf tessconfigs.tar --exclude=.git -C ${PREFIX}/share/tessdata | |
} | |
pushd "${BUILD_DIR}" | |
B_TESSERACT | |
B_TESSDATA | |
popd | |
} |