ref: db0575accc266107088ade7ebaa2bfcd9e5bc051
parent: 3320a3593e8e480e7e18df7ef8cdd489f3d7d831
author: cbagwell <cbagwell>
date: Wed May 27 23:13:56 EDT 2009
Automate building osx package like we do with cygwin.
--- a/INSTALL
+++ b/INSTALL
@@ -126,7 +126,8 @@
Alternatively, you can make use of the "cygbuild" script distributed
with SoX source that is used to automate all steps of building
-a win32 package.
+a win32 package. "osxbuild" script is used to automate all steps
+of building a MacOS X package.
Newer versions of SoX include support for loading libraries for
file formats at runtime. The main usage of this feature is to
--- /dev/null
+++ b/README.osx
@@ -1,0 +1,90 @@
+SoX
+---
+
+This file contains information specific to the MacOS X version of SoX.
+Please refer to the README file for general information.
+
+The sox executable can be installed anywhere you desire. It is a
+self-contained statically linked executable.
+
+If the sox executable is invoked with an executable name of soxi, play,
+or rec it will perform the functions of those applications as defined
+in included documents.
+
+Symlinks can be created for this purpose; such as:
+
+ln -s sox soxi
+ln -s sox play
+ln -s sox rec
+
+This also roughly equates to invoking sox with following options:
+
+soxi: sox --info [input files and options]
+play: sox [input files and options] -d [effects]
+rec: sox -d [output file and options] [effects]
+
+wget
+----
+
+SoX can make use of the wget command line utility to load files over
+the internet or list to shoutcast streams. It only needs to be
+somewhere in your path to be used by SoX.
+
+Please consult wget's homepage for access to source code as well
+as further instructions on configuring and installing.
+
+http://www.gnu.org/software/wget
+
+Acknowledgements
+----------------
+
+The sox exectables included in this package makes use of the following projects:
+
+ SoX - http://sox.sourceforge.net
+
+ Ogg Vorbis - http://www.vorbis.com
+
+ FLAC - http://flac.sourceforge.net
+
+ libsndfile - http://www.mega-nerd.com/libsndfile
+
+ WavPack - http://www.wavpack.com
+
+ PNG - http://www.libpng.org/pub/png
+
+Enjoy,
+The SoX Development Team
+
+Appendix - MP3 Support
+----------------------
+
+SoX contains support for reading and writing MP3 files but does not ship
+with the DLL's that perform decoding and encoding of MP3 data because
+of patent restrictions. For further details, refer to:
+
+http://en.wikipedia.org/wiki/MP3#Licensing_and_patent_issues
+
+MP3 support can be enabled by placing Lame encoding library and/or
+MAD decoding library into a standard library search location such
+as /usr/lib or /usr/local/lib..
+These can be compiled yourself, may turn up on searches of the internet
+or may be included with other MP3 applications already installed
+on your system. Try searching for libmp3lame.dylib and libmad.dylib.
+
+Obtain the latest Lame and MAD source code from approprate locations.
+
+Lame MP3 encoder http://lame.sourceforge.net
+MAD MP3 decoder http://www.underbit.com/products/mad
+
+If your system is setup to compile software, then the following commands
+can be used:
+
+cd lame-398-2
+./configure
+make
+sudo make install
+
+cd libmad-0.15.1b
+./configure
+make
+sudo make install
--- a/README.win32
+++ b/README.win32
@@ -117,8 +117,6 @@
gcc -shared -Wl,-export-all -Wl,--out-implib=libmad.dll.a -o cygmad-0.dll version.o fixed.o bit.o timer.o stream.o frame.o synth.o decoder.o layer12.o layer3.o huffman.o
cp cygmad-0.dll /path/to/sox/libmad.dll
-gcc -shared .libs/version.o .libs/fixed.o .libs/bit.o .libs/timer.o .libs/stream.o .libs/frame.o .libs/synth.o .libs/decoder.o .libs/layer12.o .libs/layer3.o .libs/huffman.o -march=i486 -o .libs/cygmad-0.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libmad.dll.a
-
Alternatively, the MAD configure script can be patched to allow building and
installing libmad under standard cygwin directories.
--- a/cygbuild
+++ b/cygbuild
@@ -42,6 +42,14 @@
#
# cd ../libsndfile-1.0.19
#./configure --disable-shared --enable-static;make;make install
+#
+# To get MP3 header files used to enable MP3 support (no libraries used):
+#
+# cd ../lame-398-2
+#./configure --enable-shared --disable-static;make;sudo make install
+#
+# cd ../libmad
+#./configure --enable-shared --disable-static;make;sudo make install
[ ! -x configure ] && autoreconf -i
@@ -63,7 +71,7 @@
make -s all pdf txt || exit 1
dir=sox-`grep Version: sox.pc | cut -d ' ' -f 2`
-rm -rf $dir $dir.zip
+rm -rf $dir $dir-win32.zip
mkdir -p $dir
for f in ChangeLog LICENSE.GPL README README.win32; do
@@ -98,5 +106,5 @@
fi
fi
-zip -r $dir.zip $dir
+zip -r $dir-win32.zip $dir
rm -rf $dir
--- /dev/null
+++ b/osxbuild
@@ -1,0 +1,92 @@
+#!/bin/sh
+#
+# This script will automates the steps used to producing a static osx
+# package of SoX.
+#
+# It requires to already have several external libraries already installed
+# under /usr/local. The external libraries must be static only or else
+# it will expect dylib versions to already exist on external boxes.
+#
+# Various notes:
+#
+# The following command lines were used to generate the static external
+# libraries SoX ships with.
+#
+# cd libpng-1.2.32
+#./configure --disable-shared --enable-static;make;sudo make install
+#
+# cd ../wavpack-4.50.1
+#./configure --disable-shared --enable-static;make;sudo make install
+#
+# FIXME: Won't build static
+# cd ../flac-1.2.1
+#./configure --disable-shared --enable-static;make;sudo make install
+#
+# cd ../libogg-1.1.3
+#./configure --disable-shared --enable-static;make;sudo make install
+#
+# cd ../libvorbis-1.2.0
+#./configure --disable-shared --enable-static;make;sudo make install
+#
+# cd ../libsndfile-1.0.19
+#./configure --disable-shared --enable-static;make;sudo make install
+#
+#
+# To get MP3 header files used to enable MP3 support (no libraries used):
+#
+# cd ../lame-398-2
+#./configure --enable-shared --disable-static;make;sudo make install
+#
+# cd ../libmad
+#./configure --enable-shared --disable-static;make;sudo make install
+
+[ ! -x configure ] && autoreconf -i
+
+# 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.
+if [ $# -ne 0 -o ! -r Makefile ]; then
+ ./configure \
+ --disable-shared \
+ --with-libltdl \
+ --enable-dl-lame --enable-dl-mad \
+ CPP=cpp\
+ CPPFLAGS=-I/usr/local/include \
+ LDFLAGS="-L/usr/local/lib" \
+ $*
+fi
+
+make -s all txt || exit 1
+
+dir=sox-`grep Version: sox.pc | cut -d ' ' -f 2`
+rm -rf $dir $dir-macosx.zip
+mkdir -p $dir
+
+for f in ChangeLog LICENSE.GPL README README.osx; do
+ cp -p $f $dir/$f.txt
+done
+
+binaries=src/sox
+
+#[ ! -r "../wget-1.11.4/wget.exe" -a -r /usr/bin/wget ] && binaries+=" /usr/bin/wget"
+
+cp -p \
+ $binaries \
+ sox.txt \
+ soxformat.txt \
+ soxi.txt \
+ libsox.txt \
+ $dir
+
+#if test -r "../wget-1.11.4/wget.exe"; then
+# cp ../wget-1.11.4/wget.ini $dir
+#else
+# if test -r /usr/bin/wget -a -r /etc/wgetrc; then
+# cp -p /etc/wgetrc $dir/wget.ini
+# chmod +r $dir/wget.ini
+# fi
+#fi
+
+zip -r $dir-macosx.zip $dir
+rm -rf $dir
--- a/src/sgetopt.h
+++ b/src/sgetopt.h
@@ -17,7 +17,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef _GETOPT_H
+#ifndef _SGETOPT_H
#if defined __GNUC__
#pragma GCC system_header
#elif defined __SUNPRO_CC