]> https://gitweb.dealii.org/ - candi.git/commitdiff
candi.sh: optimised macOS support (detects 10.12 and 10.11)
authorUwe Köcher <koecher@hsu-hamburg.de>
Fri, 5 May 2017 21:42:03 +0000 (23:42 +0200)
committerUwe Köcher <koecher@hsu-hamburg.de>
Fri, 5 May 2017 21:42:03 +0000 (23:42 +0200)
candi.sh

index 5585b30ed87f290b1bf2bb2bf23b01950b3a52be..67d9f2e0c3d38747d34ac5fb5f773c242986ec4d 100755 (executable)
--- a/candi.sh
+++ b/candi.sh
@@ -550,9 +550,6 @@ guess_platform() {
     # Try to guess the name of the platform we're running on
     if [ -f /usr/bin/cygwin1.dll ]; then
         echo cygwin
-    
-    elif [[ "$OSTYPE" == "darwin"* ]]; then
-       echo macosx
 
     elif [ -f /etc/fedora-release ]; then
         local FEDORANAME=`gawk '{if (match($0,/\((.*)\)/,f)) print f[1]}' /etc/fedora-release`
@@ -578,11 +575,8 @@ guess_platform() {
     elif [ -x /usr/bin/sw_vers ]; then
         local MACOSVER=$(sw_vers -productVersion)
         case ${MACOSVER} in
-            10.4*)    echo tiger;;
-            10.5*)    echo leopard;;
-            10.6*)    echo snowleopard;;
-            10.7*)    echo lion;;
-            10.8*)    echo mountainlion;;
+                   10.11*)   echo macosx;;
+            10.12*)   echo sierra;;
         esac
     
     elif [ -x /usr/bin/lsb_release ]; then
@@ -605,6 +599,40 @@ guess_platform() {
     fi
 }
 
+guess_ostype() {
+    # Try to guess the operating system type (ostype)
+    if [ -f /usr/bin/cygwin1.dll ]; then
+        echo cygwin
+
+    elif [ -f /etc/fedora-release ]; then
+           echo linux
+    
+    elif [ -f /etc/redhat-release ]; then
+        echo linux
+    
+    elif [ -x /usr/bin/sw_vers ]; then
+        echo macos
+    
+    elif [ -x /usr/bin/lsb_release ]; then
+        local DISTRO=$(lsb_release -i -s)
+        local CODENAME=$(lsb_release -c -s)
+        local DESCRIPTION=$(lsb_release -d -s)
+        case ${DISTRO}:${CODENAME}:${DESCRIPTION} in
+            *:*:*Ubuntu*\ 12*)     echo linux;;
+            *:*:*Ubuntu*\ 14*)     echo linux;;
+            *:*:*Ubuntu*\ 15*)     echo linux;;
+            *:xenial*:*Ubuntu*)    echo linux;;
+            *:Tikanga*:*)          echo linux;;
+            *:Santiago*:*)         echo linux;;
+            Scientific:Carbon*:*)  echo linux;;
+            *:*:*CentOS*\ 5*)      echo linux;;
+            *:*:*CentOS*\ 6*)      echo linux;;
+            *:*:*openSUSE\ 12*)    echo linux;;
+            *:*:*openSUSE\ 13*)    echo linux;;
+        esac
+    fi
+}
+
 guess_architecture() {
     # Try to guess the architecture of the platform we are running on
     ARCH=unknown
@@ -722,6 +750,41 @@ else
         exit 1
     fi
 fi
+echo
+
+# Guess the operating system type -> PLATFORM_OSTYPE
+PLATFORM_OSTYPE=`guess_ostype`
+if [ -z "${PLATFORM_OSTYPE}" ]; then
+    cecho ${WARN} "WARNING: could not determine your Operating System Type (assuming linux)"
+    PLATFORM_OSTYPE=linux
+fi
+
+cecho ${INFO} "Operating System Type detected as: ${PLATFORM_OSTYPE}"
+
+if [ -z "${PLATFORM_OSTYPE}" ]; then
+    # check if PLATFORM_OSTYPE is set and not empty failed
+    cecho ${BAD} "Error: (internal) could not set PLATFORM_OSTYPE"
+       exit 1
+fi
+
+# Guess dynamic shared library file extension -> LDSUFFIX
+if [ ${PLATFORM_OSTYPE} == "linux" ]; then
+    LDSUFFIX=so
+
+elif [ ${PLATFORM_OSTYPE} == "macos" ]; then
+    LDSUFFIX=dylib
+
+elif [ ${PLATFORM_OSTYPE} == "cygwin" ]; then
+    LDSUFFIX=dll
+fi
+
+cecho ${INFO} "Dynamic shared library file extension detected as: *.${LDSUFFIX}"
+
+if [ -z "${LDSUFFIX}" ]; then
+    # check if PLATFORM_OSTYPE is set and not empty failed
+    cecho ${BAD} "Error: (internal) could not set LDSUFFIX"
+       exit 1
+fi
 
 # Source default PACKAGES variables, if none were given so far
 if [ -z "${PACKAGES}" ]; then

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.