shithub: sox

Download patch

ref: 533fb3558f5ee48fb1df85a00206d16e2b2b9289
parent: 707b36935a3758e531ffeb03beee06da24aedb2b
author: cbagwell <cbagwell>
date: Thu Feb 17 22:29:55 EST 2011

Updates to osxbuild to force 10.5 compatibility.
Force ZIP to store symlinks.
Remove .txt extension from most txt files.

--- a/README.osx
+++ b/README.osx
@@ -27,7 +27,7 @@
 ----
 
 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 
+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
@@ -66,7 +66,8 @@
 
 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..
+as /usr/lib or /usr/local/lib (or set LTDL_LIBRARY_PATH to search
+path).
 
 These can be compiled yourself, may turn up on searches of the internet
 or may be included with other MP3 applications already installed
@@ -75,7 +76,7 @@
 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 
+MAD MP3 decoder   http://www.underbit.com/products/mad
 
 If your system is setup to compile software, then the following commands
 can be used:
@@ -93,20 +94,20 @@
 Appendix - AMR-NB/AMR-WB Support
 --------------------------------
 
-SoX contains support for reading and writing AMR-NB and AMR-WB files but 
+SoX contains support for reading and writing AMR-NB and AMR-WB files but
 does not ship with the DLL's that perform decoding and encoding of AMR
-data because of patent restrictions. 
+data because of patent restrictions.
 
 AMR-NB/AMR-WB support can be enabled by placing required libraries
 into a standard library search location such as /usr/lib or
-/usr/local/lib.
+/usr/local/lib (or set LTDL_LIBRARY_PATH to search path).
 
 These can be compiled yourself, may turn up on searches of the internet
 or may be included with other AMR applications already installed
-on your system. Try searching for libopencore-amrnb.dylib and 
+on your system. Try searching for libopencore-amrnb.dylib and
 libopencore-amrwb.dylib.
 
-Obtain the latest amrnb and amrwb source code from 
+Obtain the latest amrnb and amrwb source code from
 http://sourceforge.net/projects/opencore-amr
 
 cd opencore-amr-0.1.2
--- a/osxbuild
+++ b/osxbuild
@@ -7,6 +7,9 @@
 # under /usr/local.  The external libraries must be static only or else
 # it will expect dylib versions to already exist on external boxes.
 #
+# This goes out of its way to only compile i386 binary and to use
+# OS X 10.5 SDK for greater compatibilty.
+#
 # Various notes:
 #
 # The following command lines were used to generate the static external
@@ -13,39 +16,39 @@
 # libraries SoX ships with.
 #
 # cd libtool-2.2.6b
-#./configure CFLAGS="-m32 -arch i386" LDFLAGS="-arch i386" --disable-shared --enable-static;make;sudo make install
+#./configure CFLAGS="-m32 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" LDFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" --disable-shared --enable-static;make;sudo make install
 #
 # cd libpng-1.2.41
-#./configure CFLAGS="-m32 -arch i386" LDFLAGS="-arch i386" --disable-shared --enable-static;make;sudo make install
+#./configure CFLAGS="-m32 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" LDFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" --disable-shared --enable-static;make;sudo make install
 #
 # cd ../wavpack-4.60.1
-#./configure CFLAGS="-m32 -arch i386" LDFLAGS="-arch i386" --disable-shared --enable-static;make;sudo make install
+#./configure CFLAGS="-m32 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" LDFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" --disable-shared --enable-static;make;sudo make install
 #
 # flac won't compile without following fix.  Edit src/libFLAC/ia32/nasm.h and
 # add following to top of that file: %define FLAC__PUBLIC_NEEDS_UNDERSCORE
 # cd ../flac-1.2.1
-#./configure CXXFLAGS="-m32 -arch i386" CFLAGS="-m32 -arch i386" LDFLAGS="-arch i386" --disable-shared --enable-static;make;sudo make install
+#./configure CXXFLAGS="-m32 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" CFLAGS="-m32 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" LDFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" --disable-shared --enable-static;make;sudo make install
 #
 # cd ../libogg-1.1.4
-#./configure CFLAGS="-m32 -arch i386" LDFLAGS="-arch i386" --disable-shared --enable-static;make;sudo make install
+#./configure CFLAGS="-m32 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" LDFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" --disable-shared --enable-static;make;sudo make install
 #
 # cd ../libvorbis-1.2.3
-#./configure CFLAGS="-m32 -arch i386" LDFLAGS="-arch i386" --disable-shared --enable-static;make;sudo make install
+#./configure CPPFLAGS="-I/usr/local/include" CFLAGS="-m32 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" LDFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" --disable-shared --enable-static;make;sudo make install
 #
 # cd ../libsndfile-1.0.21
-#./configure CXXFLAGS="-m32 -arch i386" CFLAGS="-m32 -arch i386" LDFLAGS="-arch i386" --disable-shared --enable-static;make;sudo make install
+#./configure CXXFLAGS="-m32 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" CFLAGS="-m32 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" LDFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" --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 CFLAGS="-m32 -arch i386" LDFLAGS="-arch i386" --enable-shared --disable-static;make;sudo make install
+#./configure CFLAGS="-m32 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" LDFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" --enable-shared --disable-static;make;sudo make install
 #
 # cd ../libid3tag-0.15.1b
-#./configure CXXFLAGS="-m32 -arch i386" CFLAGS="-m32 -arch i386" LDFLAGS="-arch i386" --enable-static --disable-shared;make;sudo make install
+#./configure CXXFLAGS="-m32 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" CFLAGS="-m32 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" LDFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" --enable-static --disable-shared;make;sudo make install
 #
 # cd ../libmad-0.15.1b
-#./configure CFLAGS="-m32 -arch i386" LDFLAGS="-arch i386" --enable-shared --disable-static;make;sudo make install
+#./configure CFLAGS="-m32 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" LDFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" --enable-shared --disable-static;make;sudo make install
 
 [ ! -x configure ] && autoreconf -i
 
@@ -61,27 +64,43 @@
     --enable-dl-amrnb --enable-dl-amrwb \
     CPP=cpp\
     CPPFLAGS="-I/usr/local/include" \
-    CFLAGS="-m32 -arch i386" \
-    LDFLAGS="-L/usr/local/lib -arch i386" \
+    CFLAGS="-m32 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" \
+    LDFLAGS="-L/usr/local/lib -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" \
     $*
 fi
 
 make -s all txt || exit 1
 
+dylib_need_to_ship=`otool -L src/sox | grep -v CoreAudio.framework | grep -v libz | grep -v libiconv | grep -v libSystem | grep -v libgcc_s | grep -v src/sox`
+
+# Make sure we are only relying on OS dynamic libraries.  If not
+# then app won't run unless user's box looks just like this one
+# (unlikely).  We could ship some dylibs but that would require
+# using rpath just right (@loader_path) and thats not easy to
+# get right.
+if [ ! "${dylib_need_to_ship}x" = "x" ]; then
+    echo "Non-OS dylib's detected:${dylib_need_to_ship}"
+    exit 1
+fi
+
 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
+# Judgement call.  If filename ends in .txt then user can view
+# by double clicking in Finder.
+for f in LICENSE.GPL; do
   cp -p $f $dir/$f.txt
 done
 
-# Hint: Its easy to depend on shared libraries that are installed by development
-# toolset only and end users will not have (i.e. libltdl).  You can check what
-# is depended on by running "otool -L src/sox"
+for f in ChangeLog README README.osx; do
+  cp -p $f $dir/$f
+done
+
 binaries=src/sox
 
-#[ ! -r "../wget-1.11.4/wget.exe" -a -r /usr/bin/wget ] && binaries+=" /usr/bin/wget"
+# TODO: Distribute wget binary
+#[ -r "../wget-1.11.4/wget" ] && binaries+=" ../wget-1.11.4/wget"
  
 cp -p \
   $binaries \
@@ -93,14 +112,9 @@
 
 (cd $dir; ln -s sox soxi; ln -s sox play; ln -s sox rec)
 
-#if test -r "../wget-1.11.4/wget.exe"; then
+#if test -r "../wget-1.11.4/wget"; 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
+zip --symlinks -r $dir-macosx.zip $dir
 rm -rf $dir