-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmakeAll.sh
executable file
·249 lines (215 loc) · 7.27 KB
/
makeAll.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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
#!/bin/sh
#
# This script will produce all the DMDirc packages
#
# DMDirc - Open Source IRC Client
# Copyright (c) 2006-2017 DMDirc Developers
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
showHelp() {
echo "This will generate a DMDirc debian package."
echo "The following command line arguments are known:"
echo "---------------------"
echo "-h, --help Help information"
echo "-j, --jar <jar> What jar to use for the package (requires --version)"
echo "-v, --version <version> What version is this package."
echo "-e, --extra <extra> Extra tagging on output file."
echo "-p, --packagename <name> Name for output (rather than DMDirc-<version>"
echo "-c, --channel <channel> Channel to pass to ant (if not passed, 'NONE', if passed without a value, 'STABLE')"
echo " (only applicable when building a fresh jar)"
echo " --upload Upload output files to google code."
echo "---------------------"
exit 0;
}
JAR=""
VERSION=""
finalTag=""
UPLOAD="0"
CHANNEL="NONE"
PACKAGENAME=""
while test -n "$1"; do
case "$1" in
--jar|-j)
shift
JAR="${1}"
;;
--version|-v)
shift
VERSION="${1}"
;;
--help|-h)
showHelp;
;;
--packagename|-p)
shift
PACKAGENAME="${1}"
;;
--extra|-e)
shift
finalTag="${1}"
;;
--upload)
UPLOAD="1"
;;
--channel|-c)
PASSEDPARAM=`echo "${2}" | grep -v ^- | grep -v " "`
if [ "${PASSEDPARAM}" != "" ]; then
shift
CHANNEL="${PASSEDPARAM}";
else
CHANNEL="STABLE";
fi;
;;
esac
shift
done
# Directory to clone DMDirc to if needed.
BUILDDIR=""
# Find out where we are
BASEDIR=$(cd "${0%/*}" 2>/dev/null; echo $PWD)
cd "${BASEDIR}"
OUTPUT="${BASEDIR}/output"
rm -Rf "${OUTPUT}"
mkdir -p ${OUTPUT}
if [ "${JAR}" != "" -a "${VERSION}" = "" ]; then
echo "When providing a jar, you must also provide a version."
echo ""
echo "Providing neither will make a fresh checkout of the current source and"
echo "build that."
exit 1;
fi;
# Final name for the jar.
# The given (or compiled) jar will be copied here, and then the build scripts
# will be given this file name to build from.
if [ "${JAR}" = "" -o ! -e "${JAR}" ]; then
echo "No jar given, or jar does not exist. Building."
# By default the source is located 2 directories above us.
SOURCEDIR="../../";
# Do we have a valid source directory above us?
if [ ! -e "${SOURCEDIR}/.git" -o ! -e "${SOURCEDIR}/build.xml" ]; then
# If not, lets create one here to use.
BUILDDIR=`mktemp -d "--tmpdir=${BASEDIR}"`
git clone git://dmdirc.com/client "${BUILDDIR}"
cd "${BUILDDIR}"
git submodule init
git submodule update
cd "${BASEDIR}"
SOURCEDIR="${BUILDDIR}"
fi;
# Do we have a valid source directory to build in now?
if [ -e "${SOURCEDIR}/.git" -a -e "${SOURCEDIR}/build.xml" ]; then
cd ${SOURCEDIR};
VERSION=`git describe --tags --always`
ant -Dchannel=${CHANNEL} clean jar
if [ ! -e "dist/DMDirc.jar" ]; then
echo "Unable to build DMDirc.jar, aborting."
cd "${BASEDIR}"
if [ "${BUILDDIR}" != "" ]; then
rm -Rfv "${BUILDDIR}"
fi;
exit 1;
fi
else
echo "Unable to build DMDirc.jar, aborting."
cd "${BASEDIR}"
if [ "${BUILDDIR}" != "" ]; then
rm -Rfv "${BUILDDIR}"
fi;
exit 1;
fi;
# Return to base dir after building.
cd "${BASEDIR}"
# Copy the DMDirc.jar to the final location
cp "${SOURCEDIR}/dist/DMDirc.jar" "${OUTPUT}/DMDirc.jar"
if [ "${BUILDDIR}" != "" ]; then
rm -Rfv "${BUILDDIR}"
fi;
else
cp "${JAR}" "${OUTPUT}/DMDirc.jar"
fi;
if [ "${PACKAGENAME}" = "" ]; then
FINALNAME="DMDirc-${VERSION}"
else
FINALNAME="${PACKAGENAME}"
fi
if [ "${finalTag}" != "" ]; then
FINALNAME="${FINALNAME}-${finalTag}"
fi;
FINALNAME="${FINALNAME}.jar"
mv "${OUTPUT}/DMDirc.jar" "${OUTPUT}/${FINALNAME}"
JAR="${OUTPUT}/${FINALNAME}"
echo "================================================================"
echo "Making Deb"
echo "================================================================"
./makeDEB.sh --jar "${JAR}" --version "${VERSION}" --extra "${finalTag}" --packagename "${PACKAGENAME}"
echo "================================================================"
echo "================================================================"
echo "Making EXE"
echo "================================================================"
./makeNSIS.sh --jar "${JAR}" --version "${VERSION}" --extra "${finalTag}" --packagename "${PACKAGENAME}"
echo "================================================================"
echo "================================================================"
echo "Making DMG"
echo "================================================================"
./makeDMG.sh --jar "${JAR}" --version "${VERSION}" --extra "${finalTag}" --packagename "${PACKAGENAME}"
echo "================================================================"
echo "================================================================"
echo "Creating Stop-Gap Packages"
echo "================================================================"
# Use alien to create rpm and tgz packages from the deb package.
# These need to be changed in future to create independantly on their own
# When we understand these package formats more.
ALIEN=`which alien`
FAKEROOT=`which fakeroot`
if [ "${ALIEN}" != "" -a "${FAKEROOT}" != "" ]; then
CURDIR=`pwd`
cd ${OUTPUT}
if [ "${PACKAGENAME}" = "" ]; then
OUTNAME="DMDirc-${VERSION}"
else
OUTNAME="${PACKAGENAME}"
fi
if [ "${finalTag}" != "" ]; then
OUTNAME="${OUTNAME}-${finalTag}"
fi;
# Theres no point passing --scripts here as the scripts expect debian
# parameters. which won't be given.
#
# The scripts only make us a protocol handler for irc, so missing them
# isn't really a huge issu.
${FAKEROOT} ${ALIEN} --to-rpm "${OUTNAME}.deb"
# Slackware ftl, tgz files may be confusing to some people not expecting
# a strange package format.
echo "Creating TGZ"
${FAKEROOT} ${ALIEN} --to-tgz "${OUTNAME}.tgz"
mv dmdirc-*.rpm "${OUTNAME}.rpm"
mv dmdirc-*.tgz "${OUTNAME}.tgz"
cd ${CURDIR}
fi;
echo "================================================================"
ls ${OUTPUT}
echo "Done."
if [ "${UPLOAD}" = "1" ]; then
echo "================================================================"
echo "Uploading to GoogleCode"
echo "================================================================"
cd gcode
sh uploads_release.sh -v ${VERSION}
fi;
exit 0;