2
# This script can be used to build static libraries for the Windows and Mac
3
# versions of Kid3. Linux and BSD users do not need it because the libraries
4
# can be installed from their repositories.
6
# First you have to install the necessary tools:
8
# For Windows: MinGW/MSYS with development tools, Qt, xsltproc,
9
# html\docbook.xsl. Set the environment variables MSYSDIR, XSLTPROCDIR,
10
# DOCBOOKDIR to the install directories. They are used in win32/buildkit3.bat.
12
# For Mac: XCode, Qt, html\docbook.xsl. XCode and Qt should be installed at
13
# the default location, docbook.xsl in
14
# $HOME/docbook-xsl-1.72.0/html/docbook.xsl.
16
# The source code for the libraries is downloaded from Debian and Ubuntu
17
# repositories. If the files are no longer available, use a later version,
18
# it should still work.
20
# buildlibs.sh will download, build and install zlib, libogg, libvorbis,
21
# flac, id3lib, taglib and mp4v2. You are then ready to build Kid3 from
22
# the win32 or macosx directories by starting buildkid3.bat (Windows) or
23
# buildkid3.sh (Mac). A binary package can be created using createpkg.bat,
24
# or createpkg.sh respectively.
28
test -d source || mkdir source
31
test -f faad2_2.0.0+cvs20040908+mp4v2+bmp-0ubuntu3.6.06.1.diff.gz ||
32
wget http://archive.ubuntu.com/ubuntu/pool/multiverse/f/faad2/faad2_2.0.0+cvs20040908+mp4v2+bmp-0ubuntu3.6.06.1.diff.gz
33
test -f faad2_2.0.0+cvs20040908+mp4v2+bmp.orig.tar.gz ||
34
wget http://archive.ubuntu.com/ubuntu/pool/multiverse/f/faad2/faad2_2.0.0+cvs20040908+mp4v2+bmp.orig.tar.gz
36
test -f flac_1.2.1-1.2.diff.gz ||
37
wget http://ftp.de.debian.org/debian/pool/main/f/flac/flac_1.2.1-1.2.diff.gz
38
test -f flac_1.2.1.orig.tar.gz ||
39
wget http://ftp.de.debian.org/debian/pool/main/f/flac/flac_1.2.1.orig.tar.gz
41
test -f id3lib3.8.3_3.8.3-7.2.diff.gz ||
42
wget http://ftp.de.debian.org/debian/pool/main/i/id3lib3.8.3/id3lib3.8.3_3.8.3-7.2.diff.gz
43
test -f id3lib3.8.3_3.8.3.orig.tar.gz ||
44
wget http://ftp.de.debian.org/debian/pool/main/i/id3lib3.8.3/id3lib3.8.3_3.8.3.orig.tar.gz
46
test -f libogg_1.1.3-2.diff.gz ||
47
wget http://ftp.de.debian.org/debian/pool/main/libo/libogg/libogg_1.1.3-2.diff.gz
48
test -f libogg_1.1.3.orig.tar.gz ||
49
wget http://ftp.de.debian.org/debian/pool/main/libo/libogg/libogg_1.1.3.orig.tar.gz
51
test -f libvorbis_1.2.0.dfsg-3.1.diff.gz ||
52
wget http://ftp.de.debian.org/debian/pool/main/libv/libvorbis/libvorbis_1.2.0.dfsg-3.1.diff.gz
53
test -f libvorbis_1.2.0.dfsg.orig.tar.gz ||
54
wget http://ftp.de.debian.org/debian/pool/main/libv/libvorbis/libvorbis_1.2.0.dfsg.orig.tar.gz
56
test -f taglib_1.5-6.diff.gz ||
57
wget http://ftp.de.debian.org/debian/pool/main/t/taglib/taglib_1.5-6.diff.gz
58
test -f taglib_1.5.orig.tar.gz ||
59
wget http://ftp.de.debian.org/debian/pool/main/t/taglib/taglib_1.5.orig.tar.gz
61
test -f zlib_1.2.3-13.diff.gz ||
62
wget http://ftp.de.debian.org/debian/pool/main/z/zlib/zlib_1.2.3-13.diff.gz
63
test -f zlib_1.2.3.orig.tar.gz ||
64
wget http://ftp.de.debian.org/debian/pool/main/z/zlib/zlib_1.2.3.orig.tar.gz
69
test -f faad2_2.0.0_mac.patch ||
70
cat >faad2_2.0.0_mac.patch <<"EOF"
71
diff -ru faad2.orig/common/mp4v2/mp4util.h faad2/common/mp4v2/mp4util.h
72
--- faad2.orig/common/mp4v2/mp4util.h 2003-06-29 23:41:00.000000000 +0200
73
+++ faad2/common/mp4v2/mp4util.h 2009-04-18 07:37:27.000000000 +0200
75
#ifndef __MP4_UTIL_INCLUDED__
76
#define __MP4_UTIL_INCLUDED__
79
+#include <sys/time.h>
84
diff -ru faad2.orig/common/mp4v2/systems.h faad2/common/mp4v2/systems.h
85
--- faad2.orig/common/mp4v2/systems.h 2009-04-22 22:38:40.000000000 +0200
86
+++ faad2/common/mp4v2/systems.h 2009-04-18 07:59:13.000000000 +0200
88
#include <win32_ver.h>
90
#define NEED_SDL_VIDEO_IN_MAIN_THREAD
91
+#elif defined __APPLE__
93
+#define PACKAGE "mpeg4ip"
96
+#define VERSION "0.9.8.6"
98
+#define HAVE_STDINT_H
104
test -f faad2_2.0.0_mingw.patch ||
105
cat >faad2_2.0.0_mingw.patch <<"EOF"
106
diff -ru faad2.orig/common/mp4ff/mp4ff_int_types.h faad2/common/mp4ff/mp4ff_int_types.h
107
--- faad2.orig/common/mp4ff/mp4ff_int_types.h Fri Nov 2 06:37:08 2007
108
+++ faad2/common/mp4ff/mp4ff_int_types.h Sun Nov 4 12:10:52 2007
110
#ifndef _MP4FF_INT_TYPES_H_
111
#define _MP4FF_INT_TYPES_H_
114
+#if defined(_WIN32) && !defined(__MINGW32__)
117
typedef unsigned char uint8_t;
123
\ No newline at end of file
125
diff -ru faad2.orig/common/mp4v2/systems.h faad2/common/mp4v2/systems.h
126
--- faad2.orig/common/mp4v2/systems.h Fri Nov 2 06:40:12 2007
127
+++ faad2/common/mp4v2/systems.h Sun Nov 4 12:11:32 2007
130
#define HAVE_IN_PORT_T
131
#define HAVE_SOCKLEN_T
134
+#define PACKAGE "mpeg4ip"
137
+#define VERSION "0.9.8.6"
140
#include <win32_ver.h>
142
#define NEED_SDL_VIDEO_IN_MAIN_THREAD
152
+typedef unsigned __int64 u_int64_t;
153
+typedef unsigned __int32 u_int32_t;
154
+typedef unsigned __int16 u_int16_t;
155
+typedef unsigned __int8 u_int8_t;
157
typedef unsigned __int64 uint64_t;
158
typedef unsigned __int32 uint32_t;
159
typedef unsigned __int16 uint16_t;
161
typedef unsigned short in_port_t;
162
typedef int socklen_t;
165
#define snprintf _snprintf
166
#define strncasecmp _strnicmp
167
#define strcasecmp _stricmp
173
#define PATH_MAX MAX_PATH
175
#define MAX_UINT64 -1
182
-#if !__STDC__ && _INTEGRAL_MAX_BITS >= 64
183
+#if (!__STDC__ || defined __MINGW32__) && _INTEGRAL_MAX_BITS >= 64
184
#define VAR_TO_FPOS(fpos, var) (fpos) = (var)
185
#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)(_FPOSOFF(fpos))
187
diff -ru faad2.orig/libfaad/common.h faad2/libfaad/common.h
188
--- faad2.orig/libfaad/common.h Fri Nov 2 06:37:08 2007
189
+++ faad2/libfaad/common.h Sun Nov 4 12:10:12 2007
192
#elif (defined(__i386__) && defined(__GNUC__))
194
+#if !defined __MINGW32__ && !defined __APPLE__
195
// from http://www.stereopsis.com/FPU.html
196
static INLINE int lrintf(float f)
208
test -f faad2-mkinstalldirs.diff ||
209
cat >faad2-mkinstalldirs.diff <<"EOF"
210
diff -ruN faad2.orig/mkinstalldirs faad2/mkinstalldirs
211
--- faad2.orig/mkinstalldirs Thu Jan 1 00:00:00 1970
212
+++ faad2/mkinstalldirs Mon Mar 3 23:26:04 2008
215
+# mkinstalldirs --- make directory hierarchy
216
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
217
+# Created: 1993-05-16
220
+# $Id: mkinstalldirs,v 1.1 1999/11/01 04:12:39 scott Exp $
226
+ set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
232
+ pathcomp="$pathcomp$d"
233
+ case "$pathcomp" in
234
+ -* ) pathcomp=./$pathcomp ;;
237
+ if test ! -d "$pathcomp"; then
238
+ echo "mkdir $pathcomp"
240
+ mkdir "$pathcomp" || lasterr=$?
242
+ if test ! -d "$pathcomp"; then
247
+ pathcomp="$pathcomp/"
253
+# mkinstalldirs ends here
256
test -f fink_flac.patch ||
257
cat >fink_flac.patch <<"EOF"
258
diff -ruN flac-1.2.1/patches/fixrpath.sh flac-1.2.1.new/patches/fixrpath.sh
259
--- flac-1.2.1/patches/fixrpath.sh 1969-12-31 19:00:00.000000000 -0500
260
+++ flac-1.2.1.new/patches/fixrpath.sh 2008-02-18 10:51:07.000000000 -0500
263
+# $Id: fixrpath,v 1.1 2004/05/27 10:48:25 kobras Exp $
264
+# libtool -rpath workaround based on a suggestion by Yann Dirson
265
+# <dirson@debian.org>
267
+# It is supposed to be inserted in configure.in, but I didn't want
268
+# to re-run autoconf (since that bloats the Debian diff unnecessarily),
269
+# so I just patch libtool after running configure. -- Richard Braakman
272
+# The version of libtool included with LessTif unfortunately insists on
273
+# linking with -rpath, i.e. hardwiring locations. This is not desirable.
275
+# The dummy define is improbable enough not to conflict with anything; it is
276
+# just here to fool libtool by making it believe it gave some useful info to
279
+# This will also patch the generated libtool to explicitly
280
+# link libraries against the libraries they depend on. (particularly libc)
282
+for i in libtool libtool-disable-static; do
284
+ -e 's/^hardcode_libdir_flag_spec.*$/hardcode_libdir_flag_spec=" -D__LIBTOOL_IS_A_FOOL__ "/' \
285
+ -e '/^archive_cmds="/s/"$/ \$deplibs"/'
290
diff -ruN flac-1.2.1/patches/ltmain.sh.patch flac-1.2.1.new/patches/ltmain.sh.patch
291
--- flac-1.2.1/patches/ltmain.sh.patch 1969-12-31 19:00:00.000000000 -0500
292
+++ flac-1.2.1.new/patches/ltmain.sh.patch 2008-02-18 10:48:01.000000000 -0500
294
+--- ltmain.sh.orig Fri Feb 4 21:22:19 2005
295
++++ ltmain.sh Wed Feb 23 19:09:37 2005
296
+@@ -2280,7 +2280,7 @@
297
+ { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
298
+ if test "$installed" = no; then
299
+ notinst_deplibs="$notinst_deplibs $lib"
303
+ # This is a shared library
305
diff -ruN flac-1.2.1/patches/nasm.h.patch flac-1.2.1.new/patches/nasm.h.patch
306
--- flac-1.2.1/patches/nasm.h.patch 1969-12-31 19:00:00.000000000 -0500
307
+++ flac-1.2.1.new/patches/nasm.h.patch 2007-01-25 21:34:54.000000000 -0500
309
+--- src/libFLAC/ia32/nasm.h~ 2005-01-25 13:14:22.000000000 +0900
310
++++ src/libFLAC/ia32/nasm.h 2006-03-15 18:07:23.000000000 +0900
312
+ %idefine code_section section .text align=16
313
+ %idefine data_section section .data align=32
314
+ %idefine bss_section section .bss align=32
315
++%elifdef OBJ_FORMAT_macho
316
++ %define FLAC__PUBLIC_NEEDS_UNDERSCORE
317
++ %idefine code_section section .text
318
++ %idefine data_section section .data
319
++ %idefine bss_section section .bss
321
+ %error unsupported object format!
323
diff -ruN flac-1.2.1/src/plugin_xmms/Makefile.in flac-1.2.1.new/src/plugin_xmms/Makefile.in
324
--- flac-1.2.1/src/plugin_xmms/Makefile.in 2007-09-16 16:05:18.000000000 -0400
325
+++ flac-1.2.1.new/src/plugin_xmms/Makefile.in 2008-02-18 19:48:45.000000000 -0500
327
$(top_builddir)/src/share/replaygain_synthesis/libreplaygain_synthesis.la \
328
$(top_builddir)/src/share/utf8/libutf8.la \
329
$(top_builddir)/src/libFLAC/libFLAC.la \
330
- -L$(top_builddir)/src/libFLAC/.libs \
336
test -f flac_1.2.1_size_t_max_patch.diff ||
337
cat >flac_1.2.1_size_t_max_patch.diff <<"EOF"
338
diff -ru flac-1.2.1.orig/include/share/alloc.h flac-1.2.1/include/share/alloc.h
339
--- flac-1.2.1.orig/include/share/alloc.h Wed Sep 12 06:32:22 2007
340
+++ flac-1.2.1/include/share/alloc.h Mon Mar 3 18:57:14 2008
343
#include <stdlib.h> /* for size_t, malloc(), etc */
345
+#if defined __MINGW32__ && !defined SIZE_T_MAX
346
+# define SIZE_T_MAX UINT_MAX
354
test -f id3lib-3.8.3_mingw.patch ||
355
cat >id3lib-3.8.3_mingw.patch <<"EOF"
356
diff -ru id3lib-3.8.3.orig/configure.in id3lib-3.8.3/configure.in
357
--- id3lib-3.8.3.orig/configure.in Sun Mar 2 00:23:00 2003
358
+++ id3lib-3.8.3/configure.in Thu Oct 11 08:55:26 2007
359
@@ -249,10 +249,10 @@
360
AM_CONDITIONAL(ID3_NEEDGETOPT_LONG, test x$ac_cv_func_getopt_long = xno)
362
AC_CHECK_FUNCS(mkstemp)
365
- ,,AC_MSG_ERROR([Missing a vital function for id3lib])
369
+# ,,AC_MSG_ERROR([Missing a vital function for id3lib])
372
dnl Checks for typedefs, structures, and compiler characteristics.
374
Only in id3lib-3.8.3: configure.in~
375
diff -ru id3lib-3.8.3.orig/include/id3/globals.h id3lib-3.8.3/include/id3/globals.h
376
--- id3lib-3.8.3.orig/include/id3/globals.h Sun Mar 2 00:23:00 2003
377
+++ id3lib-3.8.3/include/id3/globals.h Thu Oct 11 08:56:28 2007
379
* we prefix variable declarations so they can
380
* properly get exported in windows dlls.
384
# define LINKOPTION_STATIC 1 //both for use and creation of static lib
385
# define LINKOPTION_CREATE_DYNAMIC 2 //should only be used by prj/id3lib.dsp
386
# define LINKOPTION_USE_DYNAMIC 3 //if your project links id3lib dynamic
389
test -f taglib-1.5-no_declspec.diff ||
390
cat >taglib-1.5-no_declspec.diff <<"EOF"
391
diff -ru taglib-1.5.orig/taglib/taglib_export.h taglib-1.5/taglib/taglib_export.h
392
--- taglib-1.5.orig/taglib/taglib_export.h Mon Feb 4 15:14:46 2008
393
+++ taglib-1.5/taglib/taglib_export.h Mon Mar 3 20:07:58 2008
395
#ifndef TAGLIB_EXPORT_H
396
#define TAGLIB_EXPORT_H
398
-#if defined(_WIN32) || defined(_WIN64)
399
+#if (defined(_WIN32) || defined(_WIN64)) && !defined __MINGW32__
400
#ifdef MAKE_TAGLIB_LIB
401
#define TAGLIB_EXPORT __declspec(dllexport)
408
# Extract and patch sources
412
if ! test -d zlib-1.2.3; then
413
tar xzf source/zlib_1.2.3.orig.tar.gz
415
gunzip -c ../source/zlib_1.2.3-13.diff.gz | patch -p1
416
tar xzf upstream/tarballs/zlib-1.2.3.tar.gz
418
for f in ../debian/patches/*; do patch -p1 <$f; done
424
if ! test -d libogg-1.1.3; then
425
tar xzf source/libogg_1.1.3.orig.tar.gz
427
gunzip -c ../source/libogg_1.1.3-2.diff.gz | patch -p1
428
for f in debian/patches/*.diff; do patch -p0 <$f; done
434
if ! test -d libvorbis-1.2.0; then
435
tar xzf source/libvorbis_1.2.0.dfsg.orig.tar.gz
437
gunzip -c ../source/libvorbis_1.2.0.dfsg-3.1.diff.gz | patch -p1
438
for f in debian/patches/*.diff; do patch -p1 <$f; done
444
if ! test -d flac-1.2.1; then
445
tar xzf source/flac_1.2.1.orig.tar.gz
447
gunzip -c ../source/flac_1.2.1-1.2.diff.gz | patch -p1
448
for f in debian/patches/*.dpatch; do patch -p1 <$f; done
449
patch -p1 <../source/flac_1.2.1_size_t_max_patch.diff
450
if test $(uname) = "Darwin"; then
451
patch -p1 <../source/fink_flac.patch
452
patch -p0 <patches/ltmain.sh.patch
453
patch -p0 <patches/nasm.h.patch
460
if ! test -d id3lib-3.8.3; then
461
tar xzf source/id3lib3.8.3_3.8.3.orig.tar.gz
463
gunzip -c ../source/id3lib3.8.3_3.8.3-7.2.diff.gz | patch -p1
464
patch -p1 <../source/id3lib-3.8.3_mingw.patch
470
if ! test -d taglib-1.5; then
471
tar xzf source/taglib_1.5.orig.tar.gz
473
gunzip -c ../source/taglib_1.5-6.diff.gz | patch -p1
474
for f in debian/patches/general/*.diff; do patch -p1 <$f; done
475
patch -p1 <../source/taglib-1.5-no_declspec.diff
481
if ! test -d faad2; then
482
tar xzf source/faad2_2.0.0+cvs20040908+mp4v2+bmp.orig.tar.gz
484
gunzip -c ../source/faad2_2.0.0+cvs20040908+mp4v2+bmp-0ubuntu3.6.06.1.diff.gz | patch -p1
485
patch -p1 <debian/patches/01_systems.h.diff
486
patch -p1 <debian/patches/04_mp4ff.h_fix.diff
487
patch -p1 <debian/patches/06_pure_virtual_fix.diff
488
patch -p1 <debian/patches/07_remove_static.diff
489
patch -p0 <debian/patches/09_amd64.diff
490
patch -p1 <../source/faad2_2.0.0_mingw.patch
491
patch -p1 <../source/faad2-mkinstalldirs.diff
492
patch -p1 <../source/faad2_2.0.0_mac.patch
499
test -d bin || mkdir bin
503
cd zlib-1.2.3/zlib-1.2.3
504
test -f Makefile || ./configure
506
mkdir -p inst/usr/local
507
make install prefix=`pwd`/inst/usr/local
509
tar czf ../../../bin/zlib-1.2.3.tgz usr
515
test -f Makefile || ./configure --enable-shared=no --enable-static=yes
518
make install DESTDIR=`pwd`/inst
520
tar czf ../../bin/libogg-1.1.3.tgz usr
526
test -f Makefile || ./configure --enable-shared=no --enable-static=yes --with-ogg=/usr/local
529
make install DESTDIR=`pwd`/inst
531
tar czf ../../bin/libvorbis-1.2.0.tgz usr
537
test -f Makefile || ./configure --enable-shared=no --enable-static=yes --with-ogg=/usr/local
540
make install DESTDIR=`pwd`/inst
542
tar czf ../../bin/flac-1.2.1.tgz usr
549
test -f Makefile || CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./configure --enable-shared=no --enable-static=yes
552
make install DESTDIR=`pwd`/inst
554
tar czf ../../bin/id3lib-3.8.3.tgz usr
560
test -f Makefile || CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./configure --enable-shared=no --enable-static=yes
563
make install DESTDIR=`pwd`/inst
565
tar czf ../../bin/taglib-1.5.tgz usr
574
if ! test -f configure.orig; then
575
mv configure configure.orig
576
sed 's/ PKG_CHECK_MODULES(BMP, bmp)/# PKG_CHECK_MODULES(BMP, bmp)/' configure.orig >configure
579
test -f Makefile || ./configure --with-mp4v2 --without-xmms --without-bmp --enable-shared=no --enable-static=yes
582
make install DESTDIR=`pwd`/inst
584
tar czf ../../bin/faad2-2.0.0.tgz usr
588
# Install to root directory
590
if test $(uname) = "Darwin"; then
591
sudo chmod go+w /usr/local
594
tar xzf bin/zlib-1.2.3.tgz -C /
595
tar xzf bin/libogg-1.1.3.tgz -C /
596
tar xzf bin/libvorbis-1.2.0.tgz -C /
597
tar xzf bin/flac-1.2.1.tgz -C /
598
tar xzf bin/id3lib-3.8.3.tgz -C /
599
tar xzf bin/taglib-1.5.tgz -C /
600
tar xzf bin/faad2-2.0.0.tgz -C /
602
if test $(uname) = "Darwin"; then
603
sudo chmod go-w /usr/local