Convert a few more dissectors to wmem
[metze/wireshark/wip.git] / macosx-setup.sh
index 84cff9642ddec54c714d6ba8907d8ef5eb109c54..34040830bef8e25177218d88a831feb393a140f9 100755 (executable)
@@ -8,7 +8,17 @@
 # http://nplab.fh-muenster.de/groups/wiki/wiki/fb7a4/Building_Wireshark_on_SnowLeopard.html
 #
 
-DARWIN_MAJOR_VERSION=`uname -r | sed 's/\([0-9]*\).*/\1/'`
+#
+# To set up a GTK3 environment
+GTK3=1
+# To build cmake
+# CMAKE=1
+#
+# To build all libraries as 32-bit libraries uncomment the following three lines.
+# export CFLAGS="$CFLAGS -arch i386"
+# export CXXFLAGS="$CXXFLAGS -arch i386"
+# export LDFLAGS="$LDFLAGS -arch i386"
+#
 
 #
 # Versions to download and install.
@@ -69,6 +79,8 @@ PORTAUDIO_VERSION=pa_stable_v19_20111121
 #
 GEOIP_VERSION=1.4.8
 
+DARWIN_MAJOR_VERSION=`uname -r | sed 's/\([0-9]*\).*/\1/'`
+
 #
 # GNU autotools; they're provided with releases up to Snow Leopard, but
 # not in later releases.
@@ -345,6 +357,21 @@ else
     DO_RM="sudo rm"
 fi
 
+#
+# 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.
+#
+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:
 #
@@ -390,17 +417,6 @@ if [[ $DARWIN_MAJOR_VERSION -le 9 ]]; then
     exit 1
 fi
 
-# To set up a GTK3 environment
-GTK3=1
-# To build cmake
-# CMAKE=1
-#
-# To build all libraries as 32-bit libraries uncomment the following three lines.
-# export CFLAGS="$CFLAGS -arch i386"
-# export CXXFLAGS="$CXXFLAGS -arch i386"
-# export LDFLAGS="$LDFLAGS -arch i386"
-#
-
 # if no make options are present, set default options
 if [ -z "$MAKE_BUILD_OPTS" ] ; then
     # by default use 1.5x number of cores for parallel build
@@ -408,18 +424,15 @@ if [ -z "$MAKE_BUILD_OPTS" ] ; then
 fi
 
 #
-# Was a minimum target release specified?
+# 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.
 #
 if [ ! -z "$min_osx_target" ]
 then
-    #
-    # Look for the SDK for that release, 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
@@ -540,7 +553,7 @@ then
         # 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
+        # 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.
         #
@@ -999,7 +1012,7 @@ if [ ! -f gtk+-$GTK_VERSION-done ] ; then
         # just ignore unknown --enable/--disable and --with/--without
         # options (at least they've always do so up to now).
         #
-        CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-cups--without-libtiff --without-libjpeg || exit 1
+        CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --disable-cups --without-libtiff --without-libjpeg || exit 1
     else
         CFLAGS="$CFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" LDFLAGS="$LDFLAGS $VERSION_MIN_FLAGS $SDKFLAGS" ./configure --without-libtiff --without-libjpeg || exit 1
     fi