From 552f88f56ce6ecb1f3e166adb8030ebe54937568 Mon Sep 17 00:00:00 2001
From: sebastien masson <smasson@locean-ipsl.upmc.fr>
Date: Wed, 30 Oct 2024 15:21:33 +0100
Subject: [PATCH] gsed compatibility and add debug infomation in
 manual_build.sh

---
 manual_build.sh | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/manual_build.sh b/manual_build.sh
index 2a6a10c..751ec8e 100755
--- a/manual_build.sh
+++ b/manual_build.sh
@@ -37,8 +37,12 @@ CMP_NAM=$1
 # Default case for Linux sed, just use "-i"
 sedi=(-i)
 case "$(uname)" in
-  # For macOS, use two parameters
-  Darwin*) sedi=(-i "")
+    # For macOS, use two parameters
+    Darwin*)
+	isgnu=$( sed --version 2>/dev/null )
+	[ $( echo $? ) -eq 0 ] && isgnu=$( echo $isgnu | grep -ic gnu ) || isgnu=0
+	[ $isgnu -eq 0 ] && edi=(-i "")
+	;;
 esac
 
 ## Initialisation
@@ -47,7 +51,7 @@ esac
 # Model
 if [ "${CMP_NAM}" == 'all' ] ; then
     models="$manuals"
-elif [ "${CMP_NAM}" ==  '' ]; then
+elif [ "${CMP_NAM}" ==  '' ] ; then
     models='NEMO'
 elif [[ "${manuals}" == *"${CMP_NAM}"* ]] ; then
     models="${CMP_NAM}"
@@ -91,7 +95,16 @@ fi
 
 # Echo current font path
 fontawesome=`grep defaultfontfeatures latex/global/packages.tex | sed -e 's/.*=\(.*\)}/\1/'`
-echo "Fontawesome path is $fontawesome"
+if [ -d $fontawesome ] ; then
+    echo "Fontawesome path is $fontawesome"
+else
+    echo
+    echo "ERROR with fontawesome path : "
+    echo "  $fontawesome does not exist"
+    echo "  Define the proper path to the fonts/opentype/public/fontawesome directory in latex/global/packages.tex"
+    echo
+    exit 1
+fi
 
 # Source shared functions
 . tools/shr_func.sh
-- 
GitLab