-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild-travis.sh
executable file
·140 lines (103 loc) · 3.76 KB
/
build-travis.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/bin/bash
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BUILD_DIR="$BASE_DIR"/build
SRC_DIR="$BASE_DIR"/src
TESSERACT_DIR="$BASE_DIR"/tesseract
mkdir $SRC_DIR
mkdir $BUILD_DIR
echo
echo '################################################################'
echo '# Building ZLib #'
echo '################################################################'
# Clean up old files
cd $SRC_DIR/zlib
git clean -fx
./configure --solo --static
make install prefix=$BUILD_DIR
if [ ! -f $BUILD_DIR/include/zlib.h ]; then
echo "ZLib build failed. Exiting."
exit 1
fi
echo
echo '################################################################'
echo '# Building LibJPEG #'
echo '################################################################'
cd $SRC_DIR/libjpeg
git clean -fx
./configure --disable-shared --prefix=$BUILD_DIR
make install
if [ ! -f $BUILD_DIR/include/jpeglib.h ]; then
echo "LibJPEG build failed. Exiting."
exit 1
fi
echo
echo '################################################################'
echo '# Building LibPNG #'
echo '################################################################'
cd $SRC_DIR/libpng
git clean -fx
./autogen.sh
./configure --disable-shared --disable-static --prefix=$BUILD_DIR \
CXXFLAGS="-I$BUILD_DIR/include" \
CPPFLAGS="-I$BUILD_DIR/include"
make check
make install
if [ ! -f "$BUILD_DIR/include/libpng16/png.h" ]; then
echo "LibPNG build failed. Exiting."
exit 1
fi
echo
echo '################################################################'
echo '# Building LibTiff #'
echo '################################################################'
cd $SRC_DIR/libtiff
git clean -fx
./autogen.sh
./configure --disable-shared --disable-static --prefix=$BUILD_DIR \
CXXFLAGS="-I$BUILD_DIR/include" \
CPPFLAGS="-I$BUILD_DIR/include"
make check
make install
if [ ! -f "$BUILD_DIR/lib/libtiff.a" ]; then
echo "LibPNG build failed. Exiting."
exit 1
fi
echo
echo '################################################################'
echo '# Building Leptionica #'
echo '################################################################'
cd $SRC_DIR/leptonica
git clean -fx
./autobuild
./configure --disable-shared --disable-static --prefix=$BUILD_DIR --without-giflib --without-libwebp --without-libopenjpeg \
LDFLAGS="-L$BUILD_DIR/lib" \
CXXFLAGS="-I$BUILD_DIR/include -I$BUILD_DIR/include/libpng16" \
CPPFLAGS="-I$BUILD_DIR/include -I$BUILD_DIR/include/libpng16"
make install
if [ ! -f $SRC_DIR/leptonica/src/.libs/liblept.a ]; then
echo 'Leptonica build failed. Exiting.'
exit 1
fi
echo
echo '################################################################'
echo '# Building Tesseract #'
echo '################################################################'
cd $SRC_DIR/tesseract
git clean -fx
rm -rf $TESSERACT_DIR
mkdir $TESSERACT_DIR
./autogen.sh
./configure --disable-shared --disable-static --prefix=$TESSERACT_DIR --with-extra-libraries=$BUILD_DIR/lib \
CXXFLAGS="-I$BUILD_DIR/include -I$BUILD_DIR/include/libpng16 -I$BUILD_DIR/include/leptonica" \
CPPFLAGS="-I$BUILD_DIR/include -I$BUILD_DIR/include/libpng16 -I$BUILD_DIR/include/leptonica" \
LDFLAGS="-L$BUILD_DIR/lib" \
PKG_CONFIG_LIBDIR=$BUILD_DIR/lib/pkgconfig
make install
if [ ! -x $TESSERACT_DIR/bin/tesseract ]; then
echo "Tesseract build failed. Exiting."
exit 1
fi
echo
echo '################################################################'
echo '# Tesseract successfully built #'
echo '################################################################'