forked from intel/ocr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·92 lines (68 loc) · 1.41 KB
/
install.sh
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/sh
#
# Defining some variables
#
PROJECT_NAME=ocr
check_error()
{
if [ $# -gt 2 ]; then
echo "Error in check_error call";
exit 1;
fi;
ERRCODE="$1";
if [ "$ERRCODE" = "0" ]; then
return 0;
fi;
if [ $# -eq 2 ]; then
ERRMESSAGE="$2";
else
ERRMESSAGE="Error";
fi;
echo "[${PROJECT_NAME}] $ERRMESSAGE";
exit $ERRCODE;
}
#
# Bootstrap, Configure, Make and Install
#
if [ -z "$NPROC" ]; then
NPROC=1
fi
#
# Bootstrap
#
# if install root has been specified, add --prefix option to configure
if [ -n "${INSTALL_ROOT}" ]; then
INSTALL_ROOT="--prefix=${INSTALL_ROOT}"
else
INSTALL_ROOT="--prefix=${PWD}/ocr-install"
fi
echo "[${PROJECT_NAME}] Bootstrap..."
./bootstrap.sh
check_error "$?" "Bootstrap failed";
#
# Configure
#
echo "[${PROJECT_NAME}]] Configure..."
COMPTREE=$PWD/compileTree
if [ ! -d "${COMPTREE}" ]; then
mkdir ${COMPTREE}
fi
cd ${COMPTREE}
# Distribute ocr-lib.h header
OCR_CONF_OPTS="${OCR_CONF_OPTS} --enable-ocrlib"
../configure ${INSTALL_ROOT} ${OCR_CONF_OPTS}
check_error "$?" "Configure failed";
#
# Make
#
echo "[${PROJECT_NAME}]] Make..."
make -j${NPROC}
check_error "$?" "Build failed";
#
# Make install
#
# if install root has been specified, perform make install
echo "[${PROJECT_NAME}]] Make install... to ${INSTALL_ROOT}"
make -j${NPROC} install
check_error "$?" "Installation failed";
echo "[${PROJECT_NAME}]] Installation complete."