-
Notifications
You must be signed in to change notification settings - Fork 19
/
fetch_sources.sh
executable file
·389 lines (332 loc) · 8.35 KB
/
fetch_sources.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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
#!/bin/sh
CDDB_VERSION="1.3.2"
CUETOOLS_VERSION="1.3.1"
DISCID_VERSION="0.3.0"
DUMB_VERSION="0.9.3"
OGG_VERSION="1.3.0"
FLAC_VERSION="1.2.1"
LAME_VERSION="3.99.5"
MAC_VERSION="416"
MAD_VERSION="0.15.1b"
MP4V2_GIT_HASH="6e1d4755c44f927d0a180a5352fdc0e273ccb325"
MPG123_VERSION="1.14.4"
MUSEPACK_VERSION="r475"
MUSICBRAINZ3_VERSION="3.0.3"
NEON_VERSION="0.29.5"
OFA1_VERSION="0.9.3"
OPUS_VERSION="1.1.2"
OPUSFILE_VERSION="0.7"
SNDFILE_VERSION="1.0.25"
SPEEX_VERSION="1.2rc1"
TTA_VERSION="2.1"
TTA_PLUS_PLUS_VERSION="2.1"
TAGLIB_GIT_HASH="821ff14a43da1c9d6094bd75a10c417bcdf7eafe"
VORBIS_VERSION="1.3.3"
WAVPACK_VERSION="4.60.1"
ZLIB_GIT_HASH="50893291621658f355bc5b4d450a8d06a563053d"
function _fetch_github_hash
{
DIRECTORY=$1
NAME=$2
TEAM=$3
PROJECT=$4
HASH=$5
_fetch_http "${DIRECTORY}" "${NAME}" "${HASH}" "https://github.com/${TEAM}/${PROJECT}/archive/${HASH}.tar.gz"
}
function _fetch_http
{
DIRECTORY=$1
NAME=$2
VERSION=$3
URL=$4
_fetch_http_named "${DIRECTORY}" \
"${NAME}-${VERSION}" \
"${NAME}-src" \
"${VERSION}" \
"${URL}"
}
function _fetch_http_named
{
DIRECTORY=$1
INPUT_NAME=$2
OUTPUT_NAME=$3
VERSION=$4
URL=$5
echo "Fetching ${DIRECTORY} (${VERSION}): $URL"
curl -sL "${URL}" | tar -xj -C "${DIRECTORY}"
mv "${DIRECTORY}/${INPUT_NAME}/" "${DIRECTORY}/${OUTPUT_NAME}/"
}
function _fetch_svn
{
DIRECTORY=$1
NAME=$2
REVISION=$3
URL=$4
echo "SVN exporting ${DIRECTORY} (${REVISION}): $URL"
svn export -qr "${REVISION}" "${URL}" "${DIRECTORY}/${NAME}-src"
}
function _fix_cr
{
FILE=$1
perl -i -pe's/\R/\n/g' "${FILE}"
}
function _patch
{
DIRECTORY=$1
NAME=$2
echo "..patching ${DIRECTORY} (${NAME})"
cd "${DIRECTORY}"
patch -p0 < "${NAME}"
cd ".."
}
function clean
{
rm -rf "cddb/libcddb-src"
rm -rf "cuetools/cuetools-src"
rm -rf "discid/libdiscid-src"
rm -rf "dumb/dumb-src"
rm -rf "ogg/libogg-src"
rm -rf "flac/flac-src"
rm -rf "lame/lame-src"
rm -rf "mad/libmad-src"
rm -rf "mp4v2/mp4v2-src"
rm -rf "mpg123/mpg123-src"
rm -rf "musepack/musepack-src"
rm -rf "musicbrainz3/libmusicbrainz-src"
rm -rf "musicbrainz3/neon-src"
rm -rf "ofa1/libofa-src"
rm -rf "sndfile/libsndfile-src"
rm -rf "speex/speex-src"
rm -rf "taglib/taglib-src"
rm -rf "tta/libtta-c-src"
rm -rf "tta++/libtta++-src"
rm -rf "vorbis/libvorbis-src"
rm -rf "wavpack/wavpack-src"
rm -rf "id3tag/libid3tag-src"
rm -rf "opus/opus-src"
rm -rf "opus/opusfile-src"
rm -rf "zlib/zlib-src"
rm -rf "mac/mac-src"
# ignore these, as they're stored in git and not downloaded
# "cdparanoia/cdparanoia-src"
# "shorten/shorten-src"
}
function fetch_cddb
{
_fetch_http "cddb" \
"libcddb" \
"${CDDB_VERSION}" \
"http://prdownloads.sourceforge.net/libcddb/libcddb-${CDDB_VERSION}.tar.bz2"
}
function fetch_cuetools
{
_fetch_http "cuetools" \
"cuetools" \
"${CUETOOLS_VERSION}" \
"http://prdownloads.sourceforge.net/cuetools.berlios/cuetools-${CUETOOLS_VERSION}.tar.gz"
}
function fetch_discid
{
_fetch_http "discid" \
"libdiscid" \
"${DISCID_VERSION}" \
"http://ftp.musicbrainz.org/pub/musicbrainz/libdiscid/libdiscid-${DISCID_VERSION}.tar.gz"
}
function fetch_dumb
{
_fetch_http "dumb" \
"dumb" \
"${DUMB_VERSION}" \
"http://prdownloads.sourceforge.net/dumb/dumb-${DUMB_VERSION}.tar.gz"
_patch "dumb" \
"dumb.patch"
}
function fetch_flac
{
# note: >= 1.3.0 uses .tar.xz instead of .tar.gz
_fetch_http "flac" \
"flac" \
"${FLAC_VERSION}" \
"http://downloads.xiph.org/releases/flac/flac-${FLAC_VERSION}.tar.gz"
}
function fetch_lame
{
_fetch_http "lame" \
"lame" \
"${LAME_VERSION}" \
"http://prdownloads.sourceforge.net/lame/lame-${LAME_VERSION}.tar.gz"
}
function fetch_mac
{
URL="http://monkeysaudio.com/files/MAC_SDK_${MAC_VERSION}.zip"
echo "Fetching mac (${MAC_VERSION}): $URL"
mkdir -p "mac/mac-src"
curl -sL "${URL}" | tar -xj -C "mac/mac-src"
_fix_cr "mac/mac-src/Source/Shared/All.h"
_patch "mac" \
"mac.patch"
}
function fetch_mad
{
_fetch_http "mad" \
"libmad" \
"${MAD_VERSION}" \
"http://prdownloads.sourceforge.net/mad/libmad-${MAD_VERSION}.tar.gz"
_patch "mad" \
"mad.patch"
}
function fetch_mp4v2
{
_fetch_github_hash "mp4v2" \
"mp4v2" \
"pcwalton" \
"mp4v2" \
"${MP4V2_GIT_HASH}"
}
function fetch_mpg123
{
_fetch_http "mpg123" \
"mpg123" \
"${MPG123_VERSION}" \
"http://prdownloads.sourceforge.net/mpg123/mpg123-${MPG123_VERSION}.tar.bz2"
}
function fetch_musepack
{
_fetch_http_named "musepack" \
"musepack_src_${MUSEPACK_VERSION}" \
"musepack-src" \
"${MPG123_VERSION}" \
"http://files.musepack.net/source/musepack_src_${MUSEPACK_VERSION}.tar.gz"
_patch "musepack" \
"mpc.patch"
}
function fetch_musicbrainz3
{
_fetch_http "musicbrainz3" \
"libmusicbrainz" \
"${MUSICBRAINZ3_VERSION}" \
"http://ftp.musicbrainz.org/pub/musicbrainz/libmusicbrainz-${MUSICBRAINZ3_VERSION}.tar.gz"
_fetch_http "musicbrainz3" \
"neon" \
"${NEON_VERSION}" \
"http://www.webdav.org/neon/neon-${NEON_VERSION}.tar.gz"
}
function fetch_ofa1
{
_fetch_http "ofa1" \
"libofa" \
"${OFA1_VERSION}" \
"https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/musicip-libofa/libofa-${OFA1_VERSION}.tar.gz"
_patch "ofa1" \
"ofa1.patch"
}
function fetch_opus
{
_fetch_http "opus" \
"opus" \
"${OPUS_VERSION}" \
"http://downloads.xiph.org/releases/opus/opus-${OPUS_VERSION}.tar.gz"
_fetch_http "opus" \
"opusfile" \
"${OPUSFILE_VERSION}" \
"http://downloads.xiph.org/releases/opus/opusfile-${OPUSFILE_VERSION}.tar.gz"
}
function fetch_ogg
{
_fetch_http "ogg" \
"libogg" \
"${OGG_VERSION}" \
"http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz"
}
function fetch_sndfile
{
_fetch_http "sndfile" \
"libsndfile" \
"${SNDFILE_VERSION}" \
"http://www.mega-nerd.com/libsndfile/files/libsndfile-${SNDFILE_VERSION}.tar.gz"
}
function fetch_speex
{
_fetch_http "speex" \
"speex" \
"${SPEEX_VERSION}" \
"http://downloads.xiph.org/releases/speex/speex-${SPEEX_VERSION}.tar.gz"
}
function fetch_taglib
{
_fetch_github_hash "taglib" \
"taglib" \
"taglib" \
"taglib" \
"${TAGLIB_GIT_HASH}"
}
function fetch_tta
{
_fetch_http_named "tta" \
"libtta-${TTA_VERSION}" \
"libtta-c-src" \
"${TTA_VERSION}" \
"http://prdownloads.sourceforge.net/tta/libtta-${TTA_VERSION}.tar.gz"
# angry carriage return situation breaks `patch`.
# `patch -l` doesn't resolve it, so..:
_fix_cr "tta/libtta-c-src/filter.h"
_fix_cr "tta/libtta-c-src/libtta.h"
_fix_cr "tta/libtta-c-src/libtta.c"
_patch "tta" \
"tta.patch"
}
function fetch_tta_plus_plus
{
_fetch_http "tta++" \
"libtta++" \
"${TTA_PLUS_PLUS_VERSION}" \
"http://prdownloads.sourceforge.net/tta/libtta++-${TTA_PLUS_PLUS_VERSION}.tar.gz"
_patch "tta++" \
"tta++.patch"
}
function fetch_vorbis
{
_fetch_http "vorbis" \
"libvorbis" \
"${VORBIS_VERSION}" \
"http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz"
}
function fetch_wavpack
{
_fetch_http "wavpack" \
"wavpack" \
"${WAVPACK_VERSION}" \
"http://www.wavpack.com/wavpack-${WAVPACK_VERSION}.tar.bz2"
}
function fetch_zlib
{
_fetch_github_hash "zlib" \
"zlib" \
"madler" \
"zlib" \
"${ZLIB_GIT_HASH}"
}
clean
fetch_cddb
fetch_cuetools
fetch_discid
fetch_dumb
fetch_flac
fetch_lame
fetch_mac
fetch_mad
fetch_mp4v2
fetch_mpg123
fetch_musepack
fetch_musicbrainz3
fetch_ofa1
fetch_ogg
fetch_opus
fetch_sndfile
fetch_speex
fetch_taglib
fetch_tta
fetch_tta_plus_plus
fetch_vorbis
fetch_wavpack
fetch_zlib