Handle installing Qt 4.x.
authorGuy Harris <guy@alum.mit.edu>
Sun, 11 Oct 2015 21:35:47 +0000 (14:35 -0700)
committerGuy Harris <guy@alum.mit.edu>
Sun, 11 Oct 2015 21:36:18 +0000 (21:36 +0000)
Or, at least, 4.8.6.  I guess they had to do an updated build or
something, as the actual dmg has "4.8.6-1", so handle that extra
versioning.

Clean up some white space while we're at it.

Change-Id: I62b99dd99e7e5cb84cca68bdc59b02e4bf65411f
Reviewed-on: https://code.wireshark.org/review/10943
Reviewed-by: Guy Harris <guy@alum.mit.edu>
macosx-setup.sh

index 3735b588457833fb985a31875ecdf7b8a8c263f1..23263ad79da0dcb0fd536f129917759542a22fcd 100755 (executable)
@@ -103,6 +103,7 @@ if [ "$QT_VERSION" ]; then
     QT_MINOR_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
     QT_DOTDOT_VERSION="`expr $QT_VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`"
     QT_MAJOR_MINOR_VERSION=$QT_MAJOR_VERSION.$QT_MINOR_VERSION
+    QT_MAJOR_MINOR_DOTDOT_VERSION=$QT_MAJOR_VERSION.$QT_MINOR_VERSION.$QT_DOTDOT_VERSION
 fi
 
 # In case we want to build GTK *and* we don't have Apple's X11 SDK installed
@@ -365,7 +366,7 @@ install_cmake() {
             #    3) it can't be run from the command line;
             #
             # so we do it ourselves.
-           #
+            #
             for i in ccmake cmake cmake-gui cmakexbuild cpack ctest
             do
                 sudo ln -s /Applications/CMake.app/Contents/bin/$i /usr/local/bin/$i
@@ -608,14 +609,31 @@ install_qt() {
         # What you get for this URL might just be a 302 Found reply, so use
         # -L so we get redirected.
         #
-        [ -f qt-opensource-mac-x64-clang-$QT_VERSION.dmg ] || curl -L -O http://download.qt.io/archive/qt/$QT_MAJOR_MINOR_VERSION/$QT_VERSION/qt-opensource-mac-x64-clang-$QT_VERSION.dmg || exit 1
-        sudo hdiutil attach qt-opensource-mac-x64-clang-$QT_VERSION.dmg || exit 1
+        if [ "$QT_MAJOR_VERSION" -ge 5 ]
+        then
+            QT_VOLUME=qt-opensource-mac-x64-clang-$QT_VERSION
+        else
+            QT_VOLUME=qt-opensource-mac-$QT_VERSION
+        fi
+        [ -f $QT_VOLUME.dmg ] || curl -L -O http://download.qt.io/archive/qt/$QT_MAJOR_MINOR_VERSION/$QT_MAJOR_MINOR_DOTDOT_VERSION/$QT_VOLUME.dmg || exit 1
+        sudo hdiutil attach $QT_VOLUME.dmg || exit 1
 
-        #
-        # Run the executable directly, so that we wait for it to finish.
-        #
-        /Volumes/qt-opensource-mac-x64-clang-$QT_VERSION/qt-opensource-mac-x64-clang-$QT_VERSION.app/Contents/MacOS/qt-opensource-mac-x64-clang-$QT_VERSION
-        sudo hdiutil detach /Volumes/qt-opensource-mac-x64-clang-$QT_VERSION
+        if [ "$QT_MAJOR_VERSION" -ge 5 ]
+        then
+            #
+            # Run the installer executable directly, so that we wait for
+            # it to finish.  Then unmount the volume.
+            #
+            /Volumes/$QT_VOLUME/$QT_VOLUME.app/Contents/MacOS/$QT_VOLUME
+            sudo hdiutil detach /Volumes/$QT_VOLUME
+        else
+            #
+            # Open the installer package; use -W, so that we wait for
+            # the installer to finish.  Then unmount the volume.
+            #
+            open -W "/Volumes/Qt $QT_MAJOR_MINOR_DOTDOT_VERSION/Qt.mpkg"
+            sudo hdiutil detach "/Volumes/Qt $QT_MAJOR_MINOR_DOTDOT_VERSION"
+        fi
 
         #
         # Versions 5.3.x through 5.5.0, at least, have bogus .pc files.