rate: add some sanity checking
[sox.git] / cygbuild
blob4fc602bf979cd9d8fb61f30b4375f6f0766fe56f
1 #!/bin/sh
3 # This script will automates the steps used to producing a static win32
4 # package of SoX.
6 # It requires cygwin with gcc and zip packages installed. Also, it
7 # requires to already have several external libraries already installed
8 # under /usr/local.
10 # And last, it will optional package a wget compiled with VC++ instead
11 # of cygwin version (which has no DLL's to distribute) if found
12 # in wget-1.11.4 directory. If not found, it will distribute the
13 # cygwin version and various DLL's it requires.
15 # Various notes:
17 # Script makes use of "-static" option to tell compiler to prefer static
18 # external libraries so that we do not need to distribute DLL's.
20 # Libtool will get confused with this flag for external libraries
21 # that have a libtool lib*.la file and support shared libraries as
22 # well as static libraries (but usually only if that library
23 # further depends on other external libraries with lib*.la files).
24 # Libtool may ignore -static option or it may link first external
25 # library as static but other dependent libraries as shared (usually
26 # because it follows $dependency_libs and that ignores -static option).
28 # Work arounds include to only install static libraries, delete the lib*.la
29 # file, or edit the lib*.la file and set dlnames and library_names variables
30 # to empty string ("").
32 # The following command lines were used to generate the static external
33 # libraries SoX ships with.
35 # libpng.la will have libtool issue because depends on libz
36 # which has a libz.la file. Must edit libpng.la to
37 # prevent needing to distribute cygzlib1.dll.
38 # cd libpng-1.2.41
39 # ./configure --disable-shared --enable-static;make;sudo make install
41 # cd ../wavpack-4.60.1
42 # ./configure --disable-shared --enable-static;make;sudo make install
44 # cd ../flac-1.2.1
45 # ./configure --disable-shared --enable-static;make;sudo make install
47 # cd ../libogg-1.1.3
48 # ./configure --disable-shared --enable-static;make;sudo make install
50 # cd ../libvorbis-1.2.0
51 # ./configure --disable-shared --enable-static;make;sudo make install
53 # cd ../libsndfile-1.0.20
54 # ./configure --disable-shared --enable-static;make;sudo make install
56 # cd ../libid3tag-0.15.1b
57 # ./configure --disable-shared --enable-static;make;sudo make install
59 # To get MP3 header files used to enable MP3 support (no libraries used):
61 # cd ../libmad
62 # ./configure --enable-shared --disable-static;make;sudo make install
64 [ ! -x configure ] && autoreconf -i
66 # Some versions of autoconf (2.63?) seem to get easily confused about
67 # CPP variable. If you see warning messages about header files
68 # rejected by preprocessor then its most likely from that.
69 # Force the value of CPP=cpp works around that bug.
70 # static versions of libsndfile do not advertise when they have
71 # FLAC or ogg vorbis support. Need to force the link ourselves.
72 if [ $# -ne 0 -o ! -r Makefile ]; then
73 ./configure \
74 --disable-shared \
75 --with-libltdl \
76 --enable-dl-lame --enable-dl-mad --enable-dl-amrnb --enable-dl-amrwb \
77 CC=gcc CPP=cpp\
78 CPPFLAGS=-I/usr/local/include \
79 LDFLAGS="-L/usr/local/lib" \
80 SNDFILE_LIBS="-lsndfile -lFLAC -lvorbisenc -lvorbisfile -lvorbis -logg" \
84 make -s all pdf txt || exit 1
86 dir=sox-`grep Version: sox.pc | cut -d ' ' -f 2`
87 rm -rf $dir $dir-cygwin32.zip
88 mkdir -p $dir
90 for f in ChangeLog LICENSE.GPL README README.win32; do
91 cp -p $f $dir/$f.txt
92 unix2dos $dir/$f.txt
93 done
95 binaries=src/sox
97 [ ! -r "../wget-1.11.4/wget.exe" -a -r /usr/bin/wget ] && binaries+=" /usr/bin/wget"
99 binaries=$(for f in `cygcheck $binaries|dos2unix`
100 do cygpath -u $f; done|sort|uniq|grep -v ^/cygdrive/)
102 cp -p \
103 $binaries \
104 sox.pdf \
105 soxformat.pdf \
106 soxi.pdf \
107 scripts/batch-example.bat \
108 $dir
110 unix2dos $dir/batch-example.bat
112 if test -r "../wget-1.11.4/wget.exe"; then
113 cp ../wget-1.11.4/wget.exe $dir
114 cp ../wget-1.11.4/wget.ini $dir
115 else
116 if test -r /usr/bin/wget -a -r /etc/wgetrc; then
117 cp -p /etc/wgetrc $dir/wget.ini
118 chmod +r $dir/wget.ini
122 zip -r $dir-cygwin32.zip $dir
123 rm -rf $dir