-
Notifications
You must be signed in to change notification settings - Fork 3
/
get_xerces.sh
executable file
·79 lines (68 loc) · 1.41 KB
/
get_xerces.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
#!/usr/bin/env bash
set -o pipefail
set -o errexit
set -o nounset
echo get_xerces.sh ============================================================
source setenv.sh
intre='^[0-9]+$'
if [[ ! $api =~ $intre ]]
then
echo 'for get_xerces.sh $api must be defined' 1>&2
exit 1
fi
need_iconv=true
if [[ $api -ge 28 ]]
then
need_iconv=false
fi
function get {
if [ ! -d "$ourname" ]
then
if [ ! \( -f $tarname -o -L $tarname \) ]
then
if [ -f ../$tarname -o -L ../$tarname ]
then
ln -s "../$tarname" "$tarname"
elif [ -f ../../$tarname -o -L ../../$tarname ]
then
ln -s "../../$tarname" "$tarname"
else
download_file "$url"
fi
fi
if ! ${JUST_CACHE_SOURCES:-false}
then
tar -xzf "$tarname"
mv "$basename" "$ourname"
rm -f "$tarname"
fi
fi
}
# Get GNU libiconv
if $need_iconv
then
basename="libiconv-1.16"
tarname="$basename.tar.gz"
url="https://ftp.gnu.org/pub/gnu/libiconv/$tarname"
ourname="iconv_source"
get
fi
# Get Xerces
basename="xerces-c-3.2.2"
tarname="$basename.tar.gz"
url="https://archive.apache.org/dist/xerces/c/3/sources/$tarname"
ourname="xerces_source"
get
if ${JUST_CACHE_SOURCES:-false}
then
exit 0
fi
# Patch Xerces To Use Our Libiconv
if $need_iconv
then
if ! md5sum -c "${basename}.md5" --status
then
patch -s -p0 -d ${ourname} < ${basename}.patch
md5sum -c "${basename}.md5"
fi
fi