From e9ed10bc409dcfc080022072e30e9e5cfb16bef5 Mon Sep 17 00:00:00 2001
From: Pietro Incardona <incardon@mpi-cbg.de>
Date: Fri, 14 Jul 2017 11:23:52 +0200
Subject: [PATCH] Fixing OpenBLAS compilation on OSX

---
 script/install_OPENBLAS.sh | 22 +++++++++++++++++-----
 script/remove_old          | 18 ++++++++++++++++++
 2 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/script/install_OPENBLAS.sh b/script/install_OPENBLAS.sh
index 8f01385ee..52adba33e 100755
--- a/script/install_OPENBLAS.sh
+++ b/script/install_OPENBLAS.sh
@@ -7,15 +7,27 @@ if [ -d "$1/OPENBLAS" ]; then
   exit 0
 fi
 
-wget http://ppmcore.mpi-cbg.de/upload/OpenBLAS-0.2.15.tar.gz
-rm -rf OpenBLAS-0.2.15
-tar -xf OpenBLAS-0.2.15.tar.gz
-cd OpenBLAS-0.2.15
+wget http://ppmcore.mpi-cbg.de/upload/OpenBLAS-0.2.19.tar.gz
+rm -rf OpenBLAS-0.2.19
+tar -xf OpenBLAS-0.2.19.tar.gz
+cd OpenBLAS-0.2.19
+
+wget http://ppmcore.mpi-cbg.de/upload/openblas.diff
+patch -p1 < openblas.diff
 
 # configuration
 
 make CC=gcc CXX=g++
 mkdir $1/OPENBLAS
 make install PREFIX=$1/OPENBLAS
-rm -rf OpenBLAS-0.2.15
+
+
+# if empty remove the folder
+if [ ! "$(ls -A $1/OPENBLAS)" ]; then
+   rm -rf $1/OPENBLAS
+else
+   rm -rf OpenBLAS-0.2.19
+   echo 1 > $1/OPENBLAS/version
+   exit 0
+fi
 
diff --git a/script/remove_old b/script/remove_old
index 1159c8654..9cbecfe21 100755
--- a/script/remove_old
+++ b/script/remove_old
@@ -148,6 +148,24 @@ function remove_old()
         fi
     fi
 
+
+    if [ -d $1/OPENBLAS ]; then
+        version=$(cat $1/OPENBLAS/version)
+        if [ x"$version" != x"1"  ]; then
+                echo -e "\033[1;34;5m  ---------------------------------------------------------------------- \033[0m"
+                echo -e "\033[1;34;5m  OPENBLAS has been updated, the component will be updated automatically    \033[0m"
+                echo -e "\033[1;34;5m  ---------------------------------------------------------------------- \033[0m"
+                sleep 5
+                rm -rf $1/EIGEN
+                rm -rf $1/PETSC
+		rm -rf $1/SUITESPARSE
+		rm -rf $1/SCALAPACK
+		rm -rf $1/SUPERLU_DIST
+		rm -rf $1/TRILINOS
+		rm -rf $1/HYPRE
+        fi
+    fi
+
 }
 
 
-- 
GitLab