forked from onesocialweb/asmack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.bash
executable file
·111 lines (100 loc) · 2.4 KB
/
build.bash
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
#!/bin/bash
echo "## Step 00: initialize"
(
if ! [ -d build ]; then
mkdir build
mkdir build/src
mkdir build/src/trunk
fi
)
fetch() {
(
cd src
if ! [ -f "${2}/.svn/entries" ]; then
mkdir "${2}"
cd "${2}"
svn co --non-interactive --trust-server-cert "${1}" "."
else
cd "${2}"
svn cleanup
svn up
fi
)
}
gitfetch() {
(
cd src
if ! [ -f "${2}/.git/config" ]; then
git clone "${1}" "${2}"
else
cd "${2}"
git pull
fi
)
}
fetchall() {
gitfetch "git://github.com/rtreffer/smack.git" "smack"
fetch "http://svn.apache.org/repos/asf/qpid/trunk/qpid/java/management/common/src/main/" "qpid"
fetch "http://svn.apache.org/repos/asf/harmony/enhanced/java/trunk/classlib/modules/auth/src/main/java/common/" "harmony"
fetch "https://dnsjava.svn.sourceforge.net/svnroot/dnsjava/trunk" "dnsjava"
fetch "https://kenai.com/svn/jbosh~main/trunk/jbosh/src/main/java" "jbosh"
}
copyfolder() {
(
(
cd "${1}"
tar -cSsp --exclude-vcs "${3}"
) | (
cd "${2}"
tar -xSsp
)
)
}
buildsrc() {
echo "## Step 20: creating build/src"
rm -rf build/src
mkdir build/src
mkdir build/src/trunk
copyfolder "src/smack/source/" "build/src/trunk" "."
copyfolder "src/qpid/java" "build/src/trunk" "org/apache/qpid/management/common/sasl"
copyfolder "src/novell-openldap-jldap" "build/src/trunk" "."
copyfolder "src/dnsjava" "build/src/trunk" "org"
copyfolder "src/harmony" "build/src/trunk" "."
copyfolder "src/custom" "build/src/trunk" "."
copyfolder "src/jbosh" "build/src/trunk" "."
}
patchsrc() {
echo "## Step 21: patch build/src"
(
cd build/src/trunk/
for PATCH in `(cd "../../../${1}" ; find -maxdepth 1 -type f)|sort` ; do
if echo $PATCH | grep '\.sh$'; then
if [ -f "../../../${1}/$PATCH" ]; then "../../../${1}/$PATCH" || exit 1 ; fi
fi
if echo $PATCH | grep '\.patch$'; then
if [ -f "../../../${1}/$PATCH" ]; then patch -p0 < "../../../${1}/$PATCH" || exit 1 ; fi
fi
done
)
}
build() {
echo "## Step 30: compile"
ant -Dbuild.all=true
}
buildcustom() {
for dir in `find patch -maxdepth 1 -mindepth 1 -type d`; do
buildsrc
patchsrc "patch"
patchsrc "${dir}"
ant -Djar.suffix=`echo ${dir}|sed 's:patch/:-:'`
done
}
fetchall
buildsrc
patchsrc "patch"
build
buildcustom
if which advzip; then
find build/*.jar -exec advzip -z4 '{}' ';'
find build/*.zip -exec advzip -z4 '{}' ';'
fi