fix possible null pointer deref in lsx_make_lpf() (CVE-2019-8357)
[sox.git] / osxbuild
bloba61ede354c3fc86eb3797253de7728dd2ebd7639
1 #!/bin/sh
3 # This script will automates the steps used to producing a static osx
4 # package of SoX.
6 # It requires to already have several external libraries already installed
7 # under /usr/local/10.9. The external libraries must be static only or else
8 # it will expect dylib versions to already exist on external boxes.
10 # This goes out of its way to use the oldest available SDK for greater
11 # compatibility.
13 # Various notes:
15 # The following command lines were used to generate the static external
16 # libraries SoX ships with.
18 # brew install libtool
20 # cd libpng-1.6.15
21 # ./configure --prefix=/usr/local/10.9 CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" LDFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" --disable-shared --enable-static;make;sudo make install
23 # cd ../wavpack-4.70.0
24 # ./configure --prefix=/usr/local/10.9 CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" LDFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" --disable-shared --enable-static;make;sudo make install
26 # cd ../flac-1.3.1
27 # ./configure --prefix=/usr/local/10.9 CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" CXXFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" LDFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9" --disable-shared --enable-static;make;sudo make install
29 # cd ../libogg-1.3.2
30 # ./configure --prefix=/usr/local/10.9 CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" LDFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" --disable-shared --enable-static;make;sudo make install
32 # cd ../libvorbis-1.3.4
33 # ./configure --prefix=/usr/local/10.9 CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" LDFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" --disable-shared --enable-static;make;sudo make install
35 # When compiling with newer versions of OS X, Carbon.h does not exist and
36 # doesn't need to be included by app. Edit programs/sndfile-play.c and
37 # delete/comment out line 61.
38 # cd ../libsndfile-1.0.25
39 # ./configure --disable-sqlite --prefix=/usr/local/10.9 CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" CXXFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" LDFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9" --disable-shared --enable-static;make;sudo make install
41 # cd ../libid3tag-0.15.1b
42 # ./configure --prefix=/usr/local/10.9 CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" LDFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" --disable-shared --enable-static;make;sudo make install
44 # To get MP3 header files used to enable MP3 support (no libraries used):
46 # brew install mad
48 # or compile and install:
50 # cd ../libmad-0.15.1b
51 # ./configure CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" LDFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" --enable-shared --disable-static;make;sudo make install
54 MacOSXSDK=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
56 [ ! -x configure ] && autoreconf -i
58 # Some versions of autoconf (2.63?) seem to get easily confused about
59 # CPP variable. If you see warning messages about header files
60 # rejected by preprocessor then its most likely from that.
61 # Force the value of CPP=cpp works around that bug.
62 if [ $# -ne 0 -o ! -r Makefile ]; then
63 ./configure \
64 --disable-shared \
65 --with-libltdl \
66 --enable-dl-lame --enable-dl-mad \
67 --enable-dl-amrnb --enable-dl-amrwb \
68 CPP=cpp\
69 CPPFLAGS="-I/usr/local/10.9/include -I/usr/local/include" \
70 CFLAGS="-isysroot ${MacOSXSDK}" \
71 LDFLAGS="-L/usr/local/10.9/lib -isysroot ${MacOSXSDK}" \
75 make -s all txt || exit 1
77 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`
79 # Make sure we are only relying on OS dynamic libraries. If not
80 # then app won't run unless user's box looks just like this one
81 # (unlikely). We could ship some dylibs but that would require
82 # using rpath just right (@loader_path) and thats not easy to
83 # get right.
84 if [ ! "${dylib_need_to_ship}x" = "x" ]; then
85 echo "Non-OS dylib's detected:${dylib_need_to_ship}"
86 exit 1
89 dir=sox-`grep Version: sox.pc | cut -d ' ' -f 2`
90 rm -rf $dir $dir-macosx.zip
91 mkdir -p $dir
93 # Judgement call. If filename ends in .txt then user can view
94 # by double clicking in Finder.
95 for f in LICENSE.GPL README.osx; do
96 cp -p $f $dir/$f.txt
97 done
99 for f in ChangeLog README; do
100 cp -p $f $dir/$f
101 done
103 binaries=src/sox
105 # TODO: Distribute wget binary
106 #[ -r "../wget-1.11.4/wget" ] && binaries+=" ../wget-1.11.4/wget"
108 cp -p \
109 $binaries \
110 sox.txt \
111 soxformat.txt \
112 soxi.txt \
113 libsox.txt \
114 $dir
116 (cd $dir; ln -s sox soxi; ln -s sox play; ln -s sox rec)
118 #if test -r "../wget-1.11.4/wget"; then
119 # cp ../wget-1.11.4/wget.ini $dir
122 zip --symlinks -r $dir-macosx.zip $dir
123 rm -rf $dir