To handle the hypothetical case of an OS X release offering a choice of

installing command-line developer tools with no SDKs but with a standard
UN*Xy /usr/include or of installing Full Frontal Xcode, check to see
whether we *have* any SDKs and, if not, don't try to find the
appropriate SDK for the release and use it.

svn path=/trunk/; revision=51499
This commit is contained in:
Guy Harris 2013-08-23 23:27:07 +00:00
parent 1e9a678477
commit 9becffea08
1 changed files with 156 additions and 144 deletions

View File

@ -358,10 +358,19 @@ else
fi
#
# The default target OS is the major version of the one we're running;
# get that and strip off the third component.
# If we have SDKs available, the default target OS is the major version
# of the one we're running; get that and strip off the third component.
#
min_osx_target=`sw_vers -productVersion | sed 's/\([[0-9]]*\).\([[0-9]]*\).[[0-9]]*/\1.\2/'`
for i in /Developer/SDKs \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
/Library/Developer/CommandLineTools/SDKs
do
if [ -d "$i" ]
then
min_osx_target=`sw_vers -productVersion | sed 's/\([[0-9]]*\).\([[0-9]]*\).[[0-9]]*/\1.\2/'`
break
fi
done
#
# Parse command-line flags:
@ -415,167 +424,170 @@ if [ -z "$MAKE_BUILD_OPTS" ] ; then
fi
#
# Look for the SDK for the target release, and build libraries against
# it rather than against the headers and, more importantly,
# If we have a target release, look for its SDK, and build libraries
# against it rather than against the headers and, more importantly,
# libraries that come with the OS, so that we don't end up with
# support libraries that only work on the OS version on which
# we built them, not earlier versions of the same release, or
# earlier releases if the minimum is earlier.
#
for i in /Developer/SDKs \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
/Library/Developer/CommandLineTools/SDKs
do
if [ -d "$i"/"MacOSX$min_osx_target.sdk" ]
if [ ! -z "$min_osx_target" ]
then
for i in /Developer/SDKs \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
/Library/Developer/CommandLineTools/SDKs
do
if [ -d "$i"/"MacOSX$min_osx_target.sdk" ]
then
SDKPATH="$i"/"MacOSX$min_osx_target.sdk"
break
fi
done
if [ -z "$SDKPATH" ]
then
SDKPATH="$i"/"MacOSX$min_osx_target.sdk"
break
echo "macosx-setup.sh: Couldn't find the SDK for OS X $min_osx_target" 1>&2
exit 1
fi
done
if [ -z "$SDKPATH" ]
then
echo "macosx-setup.sh: Couldn't find the SDK for OS X $min_osx_target" 1>&2
exit 1
fi
#
# Make sure there are links to /usr/local/include and /usr/local/lib
# in the SDK's usr/local.
#
if [ ! -e $SDKPATH/usr/local/include ]
then
if [ ! -d $SDKPATH/usr/local ]
#
# Make sure there are links to /usr/local/include and /usr/local/lib
# in the SDK's usr/local.
#
if [ ! -e $SDKPATH/usr/local/include ]
then
sudo mkdir $SDKPATH/usr/local
if [ ! -d $SDKPATH/usr/local ]
then
sudo mkdir $SDKPATH/usr/local
fi
sudo ln -s /usr/local/include $SDKPATH/usr/local/include
fi
sudo ln -s /usr/local/include $SDKPATH/usr/local/include
fi
if [ ! -e $SDKPATH/usr/local/lib ]
then
if [ ! -d $SDKPATH/usr/local ]
if [ ! -e $SDKPATH/usr/local/lib ]
then
sudo mkdir $SDKPATH/usr/local
if [ ! -d $SDKPATH/usr/local ]
then
sudo mkdir $SDKPATH/usr/local
fi
sudo ln -s /usr/local/lib $SDKPATH/usr/local/lib
fi
sudo ln -s /usr/local/lib $SDKPATH/usr/local/lib
fi
#
# Set the minimum OS version for which to build to the specified
# minimum target OS version, so we don't, for example, end up using
# linker features supported by the OS verson on which we're building
# but not by the target version.
#
VERSION_MIN_FLAGS="-mmacosx-version-min=$min_osx_target"
#
# Compile and link against the SDK.
#
SDKFLAGS="-isysroot $SDKPATH"
if [[ "$min_osx_target" == "10.5" ]]
then
#
# Cairo is part of Mac OS X 10.6 and later.
# The *headers* are supplied by 10.5, but the *libraries*
# aren't, so we have to build it if we're building for 10.5.
#
cairo_not_in_the_os=yes
#
# Build with older versions of the support libraries, as
# were used on the Wireshark Leopard buildbot at one
# point. (Most of these versions come from the About page
# from Wireshark 1.8.6, the last build done on that buildbot;
# the ATK version isn't reported, so this is a guess.)
# Set the minimum OS version for which to build to the specified
# minimum target OS version, so we don't, for example, end up using
# linker features supported by the OS verson on which we're building
# but not by the target version.
#
# If you want to try building with newer versions of
# the libraries, note that:
#
# The version of fontconfig that comes with Leopard doesn't
# support FC_WEIGHT_EXTRABLACK, so we can't use any version
# of Pango newer than 1.22.4.
#
# However, Pango 1.22.4 doesn't work with versions of GLib
# after 2.29.6, because Pango 1.22.4 uses G_CONST_RETURN and
# GLib 2.29.8 and later deprecate it (there doesn't appear to
# be a GLib 2.29.7). That means we'd either have to patch
# Pango not to use it (just use "const"; G_CONST_RETURN was
# there to allow code to choose whether to use "const" or not),
# or use GLib 2.29.6 or earlier.
#
# GLib 2.29.6 includes an implementation of g_bit_lock() that,
# on x86 (32-bit and 64-bit), uses asms in a fashion
# ("asm volatile goto") that requires GCC 4.5 or later, which
# is later than the compilers that come with Leopard and Snow
# Leopard. Recent versions of GLib check for that, but 2.29.6
# doesn't, so, if you want to build GLib 2.29.6 on Leopard or
# Snow Leopard, you would have to patch glib/gbitlock.c to do
# what the newer versions of GLib do:
#
# define a USE_ASM_GOTO macro that indicates whether "asm goto"
# can be used:
# #if (defined (i386) || defined (__amd64__))
# #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
# #define USE_ASM_GOTO 1
# #endif
# #endif
#
# replace all occurrences of
#
# #if defined (__GNUC__) && (defined (i386) || defined (__amd64__))
#
# with
#
# #ifdef USE_ASM_GOTO
#
# Using GLib 2.29.6 or earlier, however, means that we can't
# use a version of ATK later than 2.3.93, as those versions
# don't work with GLib 2.29.6. The same applies to gdk-pixbuf;
# versions of gdk-pixbuf after 2.24.1 won't work with GLib
# 2.29.6.
#
# Then you have to make sure that what you've build doesn't
# cause the X server that comes with Leopard to crash; at
# least one attempt at building for Leopard did.
#
# At least if building on Leopard, you might also find
# that, with various older versions of Cairo, including
# 1.6.4 and at least some 1.8.x versions, when you try to
# build it, the build fails because it can't find
# png_set_longjmp_fn(). I vaguely remember dealing with that,
# ages ago, but don't remember what I did.
#
GLIB_VERSION=2.16.3
CAIRO_VERSION=1.6.4
ATK_VERSION=1.24.0
PANGO_VERSION=1.20.2
GTK_VERSION=2.12.9
VERSION_MIN_FLAGS="-mmacosx-version-min=$min_osx_target"
#
# That version of GTK+ includes gdk-pixbuf.
# XXX - base this on the version of GTK+ requested.
# Compile and link against the SDK.
#
GDK_PIXBUF_VERSION=
SDKFLAGS="-isysroot $SDKPATH"
#
# Libgcrypt 1.5.0 fails to compile due to some problem with an
# asm in rijndael.c, at least with i686-apple-darwin10-gcc-4.2.1
# (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) when building
# 32-bit.
#
# We try libgcrypt 1.4.3 instead, as that's what shows up in
# the version from the Leopard buildbot.
LIBGCRYPT_VERSION=1.4.3
if [[ "$min_osx_target" == "10.5" ]]
then
#
# Cairo is part of Mac OS X 10.6 and later.
# The *headers* are supplied by 10.5, but the *libraries*
# aren't, so we have to build it if we're building for 10.5.
#
cairo_not_in_the_os=yes
#
# Build 32-bit while we're at it; Leopard has a bug that
# causes some BPF functions not to work with 64-bit userland
# code, so capturing won't work.
#
export CFLAGS="$CFLAGS -arch i386"
export CXXFLAGS="$CXXFLAGS -arch i386"
export LDFLAGS="$LDFLAGS -arch i386"
#
# Build with older versions of the support libraries, as
# were used on the Wireshark Leopard buildbot at one
# point. (Most of these versions come from the About page
# from Wireshark 1.8.6, the last build done on that buildbot;
# the ATK version isn't reported, so this is a guess.)
#
# If you want to try building with newer versions of
# the libraries, note that:
#
# The version of fontconfig that comes with Leopard doesn't
# support FC_WEIGHT_EXTRABLACK, so we can't use any version
# of Pango newer than 1.22.4.
#
# However, Pango 1.22.4 doesn't work with versions of GLib
# after 2.29.6, because Pango 1.22.4 uses G_CONST_RETURN and
# GLib 2.29.8 and later deprecate it (there doesn't appear to
# be a GLib 2.29.7). That means we'd either have to patch
# Pango not to use it (just use "const"; G_CONST_RETURN was
# there to allow code to choose whether to use "const" or not),
# or use GLib 2.29.6 or earlier.
#
# GLib 2.29.6 includes an implementation of g_bit_lock() that,
# on x86 (32-bit and 64-bit), uses asms in a fashion
# ("asm volatile goto") that requires GCC 4.5 or later, which
# is later than the compilers that come with Leopard and Snow
# Leopard. Recent versions of GLib check for that, but 2.29.6
# doesn't, so, if you want to build GLib 2.29.6 on Leopard or
# Snow Leopard, you would have to patch glib/gbitlock.c to do
# what the newer versions of GLib do:
#
# define a USE_ASM_GOTO macro that indicates whether "asm goto"
# can be used:
# #if (defined (i386) || defined (__amd64__))
# #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
# #define USE_ASM_GOTO 1
# #endif
# #endif
#
# replace all occurrences of
#
# #if defined (__GNUC__) && (defined (i386) || defined (__amd64__))
#
# with
#
# #ifdef USE_ASM_GOTO
#
# Using GLib 2.29.6 or earlier, however, means that we can't
# use a version of ATK later than 2.3.93, as those versions
# don't work with GLib 2.29.6. The same applies to gdk-pixbuf;
# versions of gdk-pixbuf after 2.24.1 won't work with GLib
# 2.29.6.
#
# Then you have to make sure that what you've build doesn't
# cause the X server that comes with Leopard to crash; at
# least one attempt at building for Leopard did.
#
# At least if building on Leopard, you might also find
# that, with various older versions of Cairo, including
# 1.6.4 and at least some 1.8.x versions, when you try to
# build it, the build fails because it can't find
# png_set_longjmp_fn(). I vaguely remember dealing with that,
# ages ago, but don't remember what I did.
#
GLIB_VERSION=2.16.3
CAIRO_VERSION=1.6.4
ATK_VERSION=1.24.0
PANGO_VERSION=1.20.2
GTK_VERSION=2.12.9
#
# That version of GTK+ includes gdk-pixbuf.
# XXX - base this on the version of GTK+ requested.
#
GDK_PIXBUF_VERSION=
#
# Libgcrypt 1.5.0 fails to compile due to some problem with an
# asm in rijndael.c, at least with i686-apple-darwin10-gcc-4.2.1
# (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) when building
# 32-bit.
#
# We try libgcrypt 1.4.3 instead, as that's what shows up in
# the version from the Leopard buildbot.
LIBGCRYPT_VERSION=1.4.3
#
# Build 32-bit while we're at it; Leopard has a bug that
# causes some BPF functions not to work with 64-bit userland
# code, so capturing won't work.
#
export CFLAGS="$CFLAGS -arch i386"
export CXXFLAGS="$CXXFLAGS -arch i386"
export LDFLAGS="$LDFLAGS -arch i386"
fi
fi
#