Make the SVR4 package checkinstall script work with GTK1 or GTK2 (previously it only...
authormorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 8 Apr 2008 22:03:42 +0000 (22:03 +0000)
committermorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 8 Apr 2008 22:03:42 +0000 (22:03 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24852 f5534014-38df-0310-8fa8-9805f1628bb7

packaging/svr4/checkinstall.in

index 34cd46ba823dfe849130fb3b1ce0b82f57f570d8..51625c52ac51c9a696eb5ba58211b6b6f205b97c 100755 (executable)
@@ -6,53 +6,75 @@
 # The original is at http://metalab.unc.edu/pub/packages/solaris/sparc/html/creating.solaris.packages.html .
 
 GTK_CONFIG=@GTK_CONFIG@
+PKG_CONFIG=@PKG_CONFIG@
 
-gtk_major_needed="1"
-gtk_minor_needed="2"
-
-host_cpu="@host_cpu@"
-host_os="@host_os@"
-
-release=`uname -r`
 platform=`uname -p`
 
 expected_platform="@host_cpu@"
 
-if [ -x "$GTK_CONFIG" ] ; then
-  # First try the GTK location that was used to build wireshark.  This
-  # is probably the safest bet.
-  gtk_installed=`$GTK_CONFIG --version`
-  gtk_major_installed=`echo $gtk_installed | cut -f1 -d.`
-  gtk_minor_installed=`echo $gtk_installed | cut -f2 -d.`
-elif gtk_installed=`gtk-config --version 2>&-`; then
-  # Punt! 
-  # If gtk-config is in the $PATH then wireshark should install fine.
-  # Some modifications to $LD_LIBRARY_PATH (or non Solaris equivalent)
-  # may be required by the user.  Should there be a warning here?
-  gtk_major_installed=`echo $gtk_installed | cut -f1 -d.`
-  gtk_minor_installed=`echo $gtk_installed | cut -f2 -d.`
-else
-  gtk_major_installed="0"
-  gtk_minor_installed="0"
-fi
-
-#
 if [ ${platform} != ${expected_platform} ]; then
   echo "\n\n\n\tThis package must be installed on a ${expected_platform} architecture\n"
   echo "\tAborting installation.\n\n\n"
   exit 1
 fi
-# if [ ${release} != ${expected_release} ]; then
-#     echo "\n\n\n\tThis package must be installed on a ${expected_release} machine\n"
-#     echo "\tAborting installation.\n\n\n"
-#     exit 1
-# fi
-
-if [ "$gtk_major_installed" -lt "$gtk_major_needed" -a \
-     "$gtk_minor_installed" -lt "$gtk_minor_needed" ] ; then
-  echo "\n\n\n\tThis package requires gtk+ version >= $gtk_major_needed.$gtk_minor_needed installed in `dirname ${GTK_CONFIG}`."
-  echo "\tAborting installation.\n\n\n"
-  exit 1
+
+if [ -n "$GTK_CONFIG" ]
+then
+       # We were build with GTK1
+       gtk_major_needed="1"
+       gtk_minor_needed="2"
+
+       if [ -x "$GTK_CONFIG" ]
+       then
+               # First try the GTK location that was used to build wireshark.  This
+               # is probably the safest bet.
+               gtk_installed=`$GTK_CONFIG --version`
+               gtk_major_installed=`echo $gtk_installed | cut -f1 -d.`
+               gtk_minor_installed=`echo $gtk_installed | cut -f2 -d.`
+       elif gtk_installed=`gtk-config --version 2>&-`
+       then
+               # Punt!
+               # If gtk-config is in the $PATH then wireshark should install fine.
+               # Some modifications to $LD_LIBRARY_PATH (or non Solaris equivalent)
+               # may be required by the user.  Should there be a warning here?
+               gtk_major_installed=`echo $gtk_installed | cut -f1 -d.`
+               gtk_minor_installed=`echo $gtk_installed | cut -f2 -d.`
+       else
+               gtk_major_installed="0"
+               gtk_minor_installed="0"
+       fi
+
+       # This if statement should be more complicated but this code is only
+       # for GTK1 so the major version is guaranteed to be 1.
+       if [ "$gtk_major_installed" -lt "$gtk_major_needed" -o \
+            "$gtk_minor_installed" -lt "$gtk_minor_needed" ]
+       then
+               echo "\n\n\n\tThis package requires gtk+ version >= $gtk_major_needed.$gtk_minor_needed installed in `dirname ${GTK_CONFIG}`."
+               echo "\tAborting installation.\n\n\n"
+               exit 1
+       fi
+else
+       # We were built with GTK2
+       gtk_version_needed="2.0"
+
+       if [ ! -x "$PKG_CONFIG" ]
+       then
+               # We couldn't find GTK in the location that was used to build
+               # Wireshark.
+               # Punt!
+               # If gtk-config is in the $PATH then wireshark should install fine.
+               # Some modifications to $LD_LIBRARY_PATH (or non Solaris equivalent)
+               # may be required by the user.  Should there be a warning here?
+               PKG_CONFIG=pkg-config
+       fi
+
+       $PKG_CONFIG gtk+-2.0 --atleast-version=$gtk_version_needed
+       if [ $? != 0 ]
+       then
+               echo "\n\n\n\tThis package requires gtk+-2 version >= $gtk_version_needed installed in `dirname ${PKG_CONFIG}`."
+               echo "\tAborting installation.\n\n\n"
+               exit 1
+       fi
 fi
 
 exit 0