1#!/bin/sh 2# 3# This script will automates the steps used to producing a static win32 4# package of SoX. 5# 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. 9# 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. 14# 15# Various notes: 16# 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. 19# 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). 27# 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 (""). 31# 32# The following command lines were used to generate the static external 33# libraries SoX ships with. 34# 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 40# 41# cd ../wavpack-4.60.1 42# ./configure --disable-shared --enable-static;make;sudo make install 43# 44# cd ../flac-1.2.1 45# ./configure --disable-shared --enable-static;make;sudo make install 46# 47# cd ../libogg-1.1.3 48# ./configure --disable-shared --enable-static;make;sudo make install 49# 50# cd ../libvorbis-1.2.0 51# ./configure --disable-shared --enable-static;make;sudo make install 52# 53# cd ../libsndfile-1.0.20 54# ./configure --disable-shared --enable-static;make;sudo make install 55# 56# cd ../libid3tag-0.15.1b 57# ./configure --disable-shared --enable-static;make;sudo make install 58# 59# To get MP3 header files used to enable MP3 support (no libraries used): 60# 61# cd ../libmad 62# ./configure --enable-shared --disable-static;make;sudo make install 63 64[ ! -x configure ] && autoreconf -i 65 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. 72if [ $# -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" \ 81 $* 82fi 83 84make -s all pdf txt || exit 1 85 86dir=sox-`grep Version: sox.pc | cut -d ' ' -f 2` 87rm -rf $dir $dir-cygwin32.zip 88mkdir -p $dir 89 90for f in ChangeLog LICENSE.GPL README README.win32; do 91 cp -p $f $dir/$f.txt 92 unix2dos $dir/$f.txt 93done 94 95binaries=src/sox 96 97[ ! -r "../wget-1.11.4/wget.exe" -a -r /usr/bin/wget ] && binaries+=" /usr/bin/wget" 98 99binaries=$(for f in `cygcheck $binaries|dos2unix` 100 do cygpath -u $f; done|sort|uniq|grep -v ^/cygdrive/) 101 102cp -p \ 103 $binaries \ 104 sox.pdf \ 105 soxformat.pdf \ 106 soxi.pdf \ 107 scripts/batch-example.bat \ 108 $dir 109 110unix2dos $dir/batch-example.bat 111 112if 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 115else 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 119 fi 120fi 121 122zip -r $dir-cygwin32.zip $dir 123rm -rf $dir 124