Salome HOME
Ensure cmake_build_type is used in SALOME 9.12.0
[tools/sat_salome.git] / products / compil_scripts / med.sh
index 04813540ebb6884eb939e694a8ebe80218d9f3c5..5716a07ad06f0f82a9abf54c1bd92e5d7cb32462 100755 (executable)
@@ -5,54 +5,44 @@ echo "med" $VERSION
 echo "##########################################################################"
 
 
+CONFIGURE_FLAGS=
+CONFIGURE_FLAGS+=' CFLAGS=-m64 CXXFLAGS=-m64'
+CONFIGURE_FLAGS+=' --enable-python=no'
+echo $HDF5_VERSION
 
-CONFIGURE_FLAGS=$CONFIGURE_FLAGS'CFLAGS=-m64 CXXFLAGS=-m64' 
-# OP 06/02/2017
-# Putting option enable-python=no 
-# Reason : compilation failure of python interface modules on FD24 (generated by swig in medfile)
-# CEA decision 13/02/2017 : deactivation of the compilation of python interface modules because no need python interface
-CONFIGURE_FLAGS=$CONFIGURE_FLAGS' --enable-python=no'
+function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
 
-if [ -n "$SAT_HPC" ]
-then
-    CONFIGURE_FLAGS=$CONFIGURE_FLAGS' --enable-parallel'
+if version_ge "$HDF5_VERSION" "1.12" ; then
+    echo "WARNING: ensure compatibility with HDF 1.12"
+    CONFIGURE_FLAGS+=' CPPFLAGS=-DH5_USE_110_API'
+fi
+
+if [ -n "$SAT_HPC" ]; then
+    CONFIGURE_FLAGS+=' --enable-parallel'
 else
-    # CNC 24/01/2017
-    # the line "export F77=gfortran" is commented, as we think it is not useful.
-    # at least it should'n.
-    # If it happens to be necessary, we will correct automake procedure.
-    #
-    # SRE 27/01/2017
-    # In fact this line is necessary because when the g77 compiler exists on the machine,
-    # it is found before gfortran and it makes the compilation fail.
-    # A mail has been sent to Eric Fayolle to fix this bug.
-    # En attendant, on remet la ligne.
     export F77=gfortran
 fi
 
-if [ -n "$SALOME_USE_64BIT_IDS" ]
-then
+if [ "$SALOME_USE_64BIT_IDS" == "1" ]; then
     echo "WARNING: user requested 64 bits encoding for integers..."
-    export FFLAGS=-fdefault-integer-8
-    export FFLAGS=$FFLAGS' -g -O2 -ffixed-line-length-none'
-    CONFIGURE_FLAGS=$CONFIGURE_FLAGS' --with-med_int=long'
+    export FFLAGS='-fdefault-integer-8 -g -O2 -ffixed-line-length-none'
+    CONFIGURE_FLAGS+=' --with-med_int=long'
 else
     FFLAGS="-g -O2 -ffixed-line-length-none"
 fi
 
 echo
-echo "*** configure"
+echo "*** configure --prefix=$PRODUCT_INSTALL FFLAGS=${FFLAGS} $CONFIGURE_FLAGS"
 $SOURCE_DIR/configure --prefix=$PRODUCT_INSTALL FFLAGS="${FFLAGS}" $CONFIGURE_FLAGS
-if [ $? -ne 0 ]
-then
+if [ $? -ne 0 ]; then
     echo "ERROR on configure"
     exit 1
 fi
+
 echo
 echo "*** make" $MAKE_OPTIONS
 make $MAKE_OPTIONS
-if [ $? -ne 0 ]
-then
+if [ $? -ne 0 ]; then
     echo "ERROR on make"
     exit 2
 fi
@@ -60,12 +50,30 @@ fi
 echo
 echo "*** make install"
 make install
-if [ $? -ne 0 ]
-then
+if [ $? -ne 0 ]; then
     echo "ERROR on make install"
     exit 3
 fi
 
+# post-build action in case devtoolset-8 is used
+LINUX_DISTRIBUTION="$DIST_NAME$DIST_VERSION"
+case $LINUX_DISTRIBUTION in
+    CO7)
+       if [ -n "$X_SCLS" ]
+       then
+           X_SCLSVALUE=$(echo $X_SCLS)
+           if [ $X_SCLSVALUE == "devtoolset-8" ]; then
+               echo "WARNING: devtoolset-8 is installed on ${LINUX_DISTRIBUTION} - libgfortran will be embedded..."
+               cp -RP /usr/lib64/libgfortran.so.5* $PRODUCT_INSTALL/lib/
+           fi
+       else
+           echo "INFO: X_SCLS does not seem to be set. skipping..."
+       fi
+       ;;
+    *)
+        ;;
+esac
+
 echo
 echo "########## END"