-
Notifications
You must be signed in to change notification settings - Fork 0
/
mingwbuild
executable file
·144 lines (128 loc) · 4.51 KB
/
mingwbuild
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
#!/bin/sh
#
# This script will automates the steps used to producing a win32 package
# of SoX.
#
# It is used on a Fedora box with mingw32 cross compiler and wine to
# test.
#
# It will optionally package up VC++ version of wget if found in
# ../wget-1.11.4.
#
# Various notes:
#
# The following command lines were used to generate the external libraries
# SoX ships with.
#
# Needed for libltdl support.
# FIXME: Install
# cd libtool-2.4.2
# mingw32-configure --disable-shared --enable-static;mingw32-make;sudo mingw32-make install
#
# yum install ming32-libpng mingw32-libpng-static
# or
# cd libpng-1.6.15
# mingw32-configure --disable-shared --enable-static;mingw32-make;sudo mingw32-make install
#
# yum install mingw32-wavpack
# or
# cd ../wavpack-4.70.0
# mingw32-configure --disable-shared --enable-static;mingw32-make;sudo mingw32-make install
#
# yum install mingw32-flac
# or
# Need to disable optional ogg support to prevent duplicate symbols during
# link.
# Edited Makefile and removed "examples" from SUBDIRS.
# cd ../flac-1.3.1
# mingw32-configure --disable-ogg --disable-shared --enable-static;mingw32-make;sudo mingw32-make install
#
# yum install mingw32-libogg
# or
# cd ../libogg-1.3.2
# mingw32-configure --disable-shared --enable-static;mingw32-make;sudo mingw32-make install
#
# yum install mingw32-libvorbis
# or
# cd ../libvorbis-1.3.4
# mingw32-configure --disable-shared --enable-static;mingw-32-make;sudo mingw32-make install
#
# FIXME: Install libsndfile
# Compile libsndfile after FLAC and ogg vorbis so that it will include
# support for that.
# MINGW work around: Can either add -lwsock32 to end of *_LDADD for any
# failed program links or modify top leve Makefile and remove
# "programs", "examples", "regtests", and "tests" from SUBDIRS.
# cd ../libsndfile-1.0.25
# mingw32-configure --disable-shared --enable-static;mingw32-make;sudo mingw32-make install
#
# yum install mingw32-libid3tag
# or
# libid3tag does not like to be compiled shared on mingw32 cross compiler.
# cd ../libid3tag-0.15.1b
# mingw32-configure --disable-shared --enable-static;mingw32-make;sudo mingw32-make install
#
# To get MP3 header files used to enable MP3 support (no libraries used):
#
# yum install mingw32-libmad
# or
# MINGW work around: Edit Makefile and remove -fforce-mem from CFLAGS
# cd ../libmad-0.15.1b
# mingw32-configure --enable-shared --disable-static;mingw32-make;sudo mingw32-make install
[ ! -x configure ] && autoreconf -i
SYS_ROOT="/usr/i686-w64-mingw32/sys-root"
CONFIGURE=mingw32-configure
DOC_TARGETS="pdf"
DOCS="sox.pdf soxformat.pdf soxi.pdf"
TMP_SNDFILE_LIBS="-lsndfile -lFLAC -lvorbisenc -lvorbisfile -lvorbis -logg"
STRIP=i686-pc-mingw32-strip
# Some versions of autoconf (2.63?) seem to get easily confused about
# CPP variable. If you see warning messages about header files
# rejected by preprocessor then its most likely from that.
# Force the value of CPP=cpp works around that bug.
# static versions of libsndfile do not advertise when they have
# FLAC or ogg vorbis support. Need to force the link ourselves.
if [ $# -ne 0 -o ! -r Makefile ]; then
$CONFIGURE \
--with-libltdl \
--enable-dl-lame --enable-dl-mad --enable-dl-amrnb --enable-dl-amrwb \
LDFLAGS="-L/usr/local/lib" CPPFLAGS=-I/usr/local/include \
SNDFILE_LIBS="${TMP_SNDFILE_LIBS}" \
$*
fi
# Reduce total size of sox.exe by over half.
make -s all txt $DOC_TARGETS || exit 1
${STRIP} src/.libs/sox.exe
dir=sox-`grep Version: sox.pc | cut -d ' ' -f 2`
rm -rf $dir $dir-win32.zip
mkdir -p $dir
for f in ChangeLog LICENSE.GPL README README.win32; do
cp -p $f $dir/$f.txt
unix2dos $dir/$f.txt
done
binaries=src/.libs/sox.exe
dlls=`/usr/i686-w64-mingw32/bin/objdump -p src/.libs/libsox-3.dll | grep "DLL Name:" | sed "s|DLL Name: |${SYS_ROOT}/mingw/bin/|" | grep -v KERNEL32.dll | grep -v msvcrt.dll | grep -v USER32.dll | grep -v WINMM.DLL`
dlls="$dlls src/.libs/libsox-3.dll"
dlls="$dlls ${SYS_ROOT}/mingw/bin/libwinpthread-1.dll"
cp -p \
$binaries \
$dlls \
$DOCS \
scripts/batch-example.bat \
$dir
# Special case fixup for nsiswrapper. Rename libFLAC-8.dll to libflac-8.dll.
mv $dir/libFLAC-8.dll $dir/libflac-8.dll
unix2dos $dir/batch-example.bat
if test -r "../wget-1.11.4/wget.exe"; then
cp ../wget-1.11.4/wget.exe $dir
cp ../wget-1.11.4/wget.ini $dir
fi
zip -r $dir-win32.zip $dir
# Optionally, create windows installer if nsiswrapper exists.
if test -r "/usr/bin/nsiswrapper"; then
cd ${dir}
export PATH=$PATH:.
nsiswrapper --run --name $dir --outfile ../${dir}-win32.exe *.exe *.dll *.ini *.txt *.pdf *.bat
cd ..
fi
rm -rf $dir