-
Notifications
You must be signed in to change notification settings - Fork 70
/
install_deps.sh
executable file
·179 lines (130 loc) · 4.32 KB
/
install_deps.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#!/bin/bash
# Compilation flags
: ${CFLAGS="-fPIC"}
: ${CXX_FLAGS=${CFLAGS}}
set -e
if ! [ -x "$(command -v wget)" ]; then
echo 'Error: wget is not installed.' >&2
exit 1
fi
if ! [ -x "$(command -v cmake)" ]; then
echo 'Error: cmake is not installed.' >&2
exit 1
fi
DEP_INSTALL_DIR=install
LIBXML_URI=http://xmlsoft.org/sources/libxml2-2.9.8.tar.gz
FREETYPE_URI=https://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.gz
#ICU_URI=http://download.icu-project.org/files/icu4c/62.1/icu4c-62_1-src.tgz
ICU_URI="https://github.com/unicode-org/icu/releases/download/release-62-2/icu4c-62_2-src.tgz"
#ICU_URI=https://github.com/unicode-org/icu/releases/download/release-66-1/icu4c-66_1-src.tgz
ICU_FILENAME=$(basename "${ICU_URI}")
ICU_DIR_NAME=icu
mkdir -p $DEP_INSTALL_DIR
cd $DEP_INSTALL_DIR
if [[ "$OSTYPE" == "linux-gnu" ]]; then
if ! [ -x "$(command -v autoreconf)" ]; then
sudo apt-get install autoconf
fi
ICU_CONFIG="Linux"
LIB_INSTALL="linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
# Mac OSX
if ! [ -x "$(command -v autoreconf)" ]; then
brew install autoreconf
fi
ICU_CONFIG="MacOSX"
LIB_INSTALL="mac"
elif [[ "$OSTYPE" == "cygwin" ]]; then
# POSIX compatibility layer and Linux environment emulation for Windows
ICU_CONFIG="Cygwin"
LIB_INSTALL="windows"
#elif [[ "$OSTYPE" == "msys" ]]; then
# Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
#elif [[ "$OSTYPE" == "win32" ]]; then
# I'm not sure this can happen.
#elif [[ "$OSTYPE" == "freebsd"* ]]; then
# ...
#else
# Unknown.
fi
echo "$LIB_INSTALL"
echo 'Installing libxml2.'
#
rm -rf libxml2-2.9.8
wget -nc $LIBXML_URI
tar xvf libxml2-2.9.8.tar.gz
cd libxml2-2.9.8
autoreconf
#Once configure is produced :
./configure --disable-dependency-tracking --without-python --without-lzma --without-iconv --without-zlib
make
cd ..
echo 'libxml2 installation is finished.'
echo 'Installing freetype.'
rm -rf freetype-2.9
wget -nc $FREETYPE_URI
tar xvf freetype-2.9.tar.gz
cd freetype-2.9
mkdir _build && cd _build
cmake -G "Unix Makefiles" ../ "-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true" -DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE -DWITH_ZLIB=OFF -DWITH_BZIP2=OFF -DWITH_PNG=OFF
make
cd ../..
echo 'Freetype installation is finished.'
echo 'Installing ICU.'
rm -rf "${ICU_DIR_NAME}"
wget -nc $ICU_URI
tar xvf "${ICU_FILENAME}"
cd "${ICU_DIR_NAME}/source" && mkdir lib && mkdir bin
chmod +x runConfigureICU configure install-sh
./runConfigureICU $ICU_CONFIG --enable-static --disable-shared
make
cd ../..
echo 'ICU installation is finished.'
echo 'Installing zlib and png.'
cd ..
cd libs/image/zlib/src && cmake "-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true" && make && cd -
cd libs/image/png/src && cmake "-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true" && make && cd -
echo 'zlib and png installation is finished.'
echo 'Copying libraries into their corresponding location.'
MACHINE_TYPE=`uname -m`
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
ARCH="64"
elif [ ${MACHINE_TYPE} == 'arm64' ]; then
ARCH="arm64"
else
ARCH="32"
fi
cp libs/image/zlib/src/libzlib.a libs/image/zlib/$LIB_INSTALL/$ARCH/
cp libs/image/png/src/libpng.a libs/image/png/$LIB_INSTALL/$ARCH/
cp $DEP_INSTALL_DIR/freetype-2.9/_build/libfreetype.a libs/freetype/$LIB_INSTALL/$ARCH/
cp $DEP_INSTALL_DIR/libxml2-2.9.8/.libs/libxml2.a libs/libxml/$LIB_INSTALL/$ARCH/
if [[ "$OSTYPE" == "cygwin" ]]; then
mv $DEP_INSTALL_DIR/icu/source/lib/libsicuuc.a $DEP_INSTALL_DIR/icu/source/lib/libicuuc.a
mv $DEP_INSTALL_DIR/icu/source/lib/libsicudata.a $DEP_INSTALL_DIR/icu/source/lib/libicudata.a
fi
cp $DEP_INSTALL_DIR/icu/source/lib/libicuuc.a libs/icu/$LIB_INSTALL/$ARCH/
cp $DEP_INSTALL_DIR/icu/source/lib/libicudata.a libs/icu/$LIB_INSTALL/$ARCH/
rm -rf $DEP_INSTALL_DIR
echo 'installing additional language support packages.'
# see http://www.xpdfreader.com/download.html
mkdir -p languages && cd languages
languages=(
"arabic"
"chinese-simplified"
"chinese-traditional"
"cyrillic"
"greek"
"hebrew"
"japanese"
"korean"
"latin2"
"thai"
"turkish"
)
for language in "${languages[@]}" ; do
#language_dir="${language}"
language_url="https://dl.xpdfreader.com/xpdf-${language}.tar.gz"
wget -qO- "${language_url}" | tar xvfz -
done
cp xpdfrc ..
echo 'done.'