aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-06-27 10:30:33 +0000
committerGuy Harris <guy@alum.mit.edu>2013-06-27 10:30:33 +0000
commitf3f156073b7fed7db2e8a7a7364873675dbfb097 (patch)
tree0d64ad4a52cc734d6bf52d01b9197b629c52f2d6
parent9334a49cb1ed8548e49f02bba5df73be3193f68a (diff)
Don't assume the system include files are under /usr/include; trick the
compiler into saying where they are, and use that. Patch a bug in PortAudio pa_stable_v19_20111121 that clang found. svn path=/trunk/; revision=50186
-rw-r--r--Makefile.am1
-rwxr-xr-xmacosx-setup.sh21
-rw-r--r--macosx-support-lib-patches/portaudio-pa_mac_core.c.patch11
3 files changed, 30 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am
index cd9da78cf7..04be30ba21 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -929,6 +929,7 @@ EXTRA_DIST = \
macosx-support-lib-patches/glib-pkgconfig.patch \
macosx-support-lib-patches/gnutls-pkgconfig.patch \
macosx-support-lib-patches/portaudio-pa_mac_core.h.patch \
+ macosx-support-lib-patches/portaudio-pa_mac_core.c.patch \
make-version.pl \
manuf \
manuf.tmpl \
diff --git a/macosx-setup.sh b/macosx-setup.sh
index 543a469e10..c130edc2bf 100755
--- a/macosx-setup.sh
+++ b/macosx-setup.sh
@@ -327,12 +327,22 @@ if [ ! -f glib-$GLIB_VERSION-done ] ; then
# While we're at it, suppress -Wformat-nonliteral to avoid a clang
# bug where it issues bogus warnings.
#
- if grep -qs '#define.*MACOSX' /usr/include/ffi/fficonfig.h
+ # First, determine where the system include files are. (It's not
+ # necessarily /usr/include.)
+ #
+ testfile=/tmp/test$$.c
+ trap "rm -f $testfile" 0
+ echo "#include <ffi/ffi.h>" > $testfile
+ includedir=`gcc -M $testfile | sed -n -e 's;[\\];;' -e 's/^ *//' -e 's/ *$//' -e 's;/ffi/ffi\.h;;p'`
+ rm -f $testfile
+ if grep -qs '#define.*MACOSX' $includedir/ffi/fficonfig.h
then
# It's defined, nothing to do
- CFLAGS="$CFLAGS -Wno-format-nonliteral" LIBFFI_CFLAGS="$CFLAGS -I/usr/include/ffi" LIBFFI_LIBS="$LDFLAGS -lffi" ./configure || exit 1
+ CFLAGS="$CFLAGS -Wno-format-nonliteral" LIBFFI_CFLAGS="$CFLAGS -I$includedir/ffi" LIBFFI_LIBS="$LDFLAGS -lffi" ./configure || exit 1
+ CFLAGS="$CFLAGS -Wno-format-nonliteral" LIBFFI_CFLAGS="$CFLAGS -I$includedir/ffi" LIBFFI_LIBS="$LDFLAGS -lffi" env | egrep LIBFFI_CFLAGS
else
- CFLAGS="$CFLAGS -DMACOSX -Wno-format-nonliteral" LIBFFI_CFLAGS="$CFLAGS -I/usr/include/ffi" LIBFFI_LIBS="LDFLAGS-lffi" ./configure || exit 1
+ CFLAGS="$CFLAGS -DMACOSX -Wno-format-nonliteral" LIBFFI_CFLAGS="$CFLAGS -I$includedir/ffi" LIBFFI_LIBS="LDFLAGS-lffi" ./configure || exit 1
+ CFLAGS="$CFLAGS -DMACOSX -Wno-format-nonliteral" LIBFFI_CFLAGS="$CFLAGS -I$includedir/ffi" LIBFFI_LIBS="LDFLAGS-lffi" env | egrep LIBFFI_CFLAGS
fi
make $MAKE_BUILD_OPTS || exit 1
# Apply patch: we depend on libffi, but pkg-config doesn't get told.
@@ -663,6 +673,11 @@ if [ "$PORTAUDIO_VERSION" -a ! -f portaudio-done ] ; then
#
patch -p0 include/pa_mac_core.h <../../macosx-support-lib-patches/portaudio-pa_mac_core.h.patch
#
+ # Fix a bug that showed up with clang (but is a bug with any
+ # compiler).
+ #
+ patch -p0 src/hostapi/coreaudio/pa_mac_core.c <../../macosx-support-lib-patches/portaudio-pa_mac_core.c.patch
+ #
# Disable fat builds - the configure script doesn't work right
# with Xcode 4 if you leave them enabled, and we don't build
# any other libraries fat (GLib, for example, would be very
diff --git a/macosx-support-lib-patches/portaudio-pa_mac_core.c.patch b/macosx-support-lib-patches/portaudio-pa_mac_core.c.patch
new file mode 100644
index 0000000000..26354ee056
--- /dev/null
+++ b/macosx-support-lib-patches/portaudio-pa_mac_core.c.patch
@@ -0,0 +1,11 @@
+--- macosx-support-libs/portaudio/src/hostapi/coreaudio/pa_mac_core.c.dist 2011-10-20 02:40:12.000000000 -0700
++++ macosx-support-libs/portaudio/src/hostapi/coreaudio/pa_mac_core.c 2013-06-27 03:13:57.000000000 -0700
+@@ -629,7 +629,7 @@
+
+ VVDBUG(("InitializeDeviceInfo(): macCoreDeviceId=%ld\n", macCoreDeviceId));
+
+- memset(deviceInfo, 0, sizeof(deviceInfo));
++ memset(deviceInfo, 0, sizeof(*deviceInfo));
+
+ deviceInfo->structVersion = 2;
+ deviceInfo->hostApi = hostApiIndex;