Skip to content
Snippets Groups Projects
Commit f59ef93f authored by Guillaume Samson's avatar Guillaume Samson :snowman2:
Browse files

Merge branch...

Merge branch '178-makenemo-from-main-branch-does-not-compile-anymore-on-apple-darwin-architecture' into 'main'

Resolve "makenemo from main branch does not compile anymore on apple/darwin architecture"

Closes #178

See merge request nemo/nemo!253
parents 93d09b9a 24b06abd
No related branches found
No related tags found
No related merge requests found
...@@ -313,7 +313,7 @@ else ...@@ -313,7 +313,7 @@ else
echo echo
fi fi
if [[ -n "${x_d}" || ${DO_NEW:-0} -eq 1 ]]; then if [[ -n "${x_d}" || ${DO_NEW:-0} -eq 1 ]]; then
[ -f ${CFG_DIR}/work_cfgs.txt ] && sed -i "/^${CUR_CONF} /d" ${CFG_DIR}/work_cfgs.txt [ -f ${CFG_DIR}/work_cfgs.txt ] && sed -i'' -e "/^${CUR_CONF} /d" ${CFG_DIR}/work_cfgs.txt
echo ${CUR_CONF} "${NEM_SUBDIR[*]}" >> ${CFG_DIR}/work_cfgs.txt echo ${CUR_CONF} "${NEM_SUBDIR[*]}" >> ${CFG_DIR}/work_cfgs.txt
fi fi
...@@ -343,7 +343,7 @@ fi ...@@ -343,7 +343,7 @@ fi
# CPP keys check # CPP keys check
if [ $chk_key -eq 1 ] ; then if [ $chk_key -eq 1 ] ; then
for kk in $( sed -n "s/bld::tool::fppkeys \+//p" ${NEMO_TDIR}/${CUR_CONF}/cpp_${CUR_CONF}.fcm ); do for kk in $( sed -n -e "s/bld::tool::fppkeys \+//p" ${NEMO_TDIR}/${CUR_CONF}/cpp_${CUR_CONF}.fcm ); do
if ! grep -q $kk ${NEMO_TDIR}/${CUR_CONF}/BLD/full_key_list.txt; then if ! grep -q $kk ${NEMO_TDIR}/${CUR_CONF}/BLD/full_key_list.txt; then
echo echo
echo "E R R O R : key "$kk" is not found in ${NEMO_TDIR}/${CUR_CONF}/WORK routines..." echo "E R R O R : key "$kk" is not found in ${NEMO_TDIR}/${CUR_CONF}/WORK routines..."
......
...@@ -69,7 +69,7 @@ for i in ${2} ; do ...@@ -69,7 +69,7 @@ for i in ${2} ; do
if [ "$(cat ${1}/cpp_$(basename ${1}).fcm | grep -c "\<$i\>" )" -ne 0 ] ; then if [ "$(cat ${1}/cpp_$(basename ${1}).fcm | grep -c "\<$i\>" )" -ne 0 ] ; then
echo "key $i already present in cpp_$(basename ${1}).fcm" echo "key $i already present in cpp_$(basename ${1}).fcm"
else else
sed -i "s/$/ ${i}/" ${1}/cpp_$(basename ${1}).fcm sed -i'' -e "s/$/ ${i}/" ${1}/cpp_$(basename ${1}).fcm
echo "added key $i in $(basename ${1})" echo "added key $i in $(basename ${1})"
fi fi
done done
...@@ -222,11 +222,11 @@ if [ -n "${4}" ]; then ...@@ -222,11 +222,11 @@ if [ -n "${4}" ]; then
exit 1 exit 1
fi fi
# duplicate the lines starting with %DEBUG_XXX and replace, in the duplicated line, %DEBUG_XXX by %XXX # duplicate the lines starting with %DEBUG_XXX and replace, in the duplicated line, %DEBUG_XXX by %XXX
sed -i "/^%DEBUG_/{p;s/^%DEBUG_\([^ ]*\)/%\1/;}" $1 sed -i'' -e "/^%DEBUG_/{p;s/^%DEBUG_\([^ ]*\)/%\1/;}" $1
else else
if (! grep -q "^%PROD_FCFLAGS" $1 ); then if (! grep -q "^%PROD_FCFLAGS" $1 ); then
echo "WARNING: '%PROD_FCFLAGS' not defined in your arch file, makenemo will use '%FCFLAGS' instead" echo "WARNING: '%PROD_FCFLAGS' not defined in your arch file, makenemo will use '%FCFLAGS' instead"
fi fi
# duplicate the lines starting with %PROD_XXX and replace, in the duplicated line, %PROD_XXX by %XXX # duplicate the lines starting with %PROD_XXX and replace, in the duplicated line, %PROD_XXX by %XXX
sed -i "/^%PROD_/{p;s/^%PROD_\([^ ]*\)/%\1/;}" $1 sed -i'' -e "/^%PROD_/{p;s/^%PROD_\([^ ]*\)/%\1/;}" $1
fi fi
...@@ -73,12 +73,12 @@ else ...@@ -73,12 +73,12 @@ else
echo " " echo " "
echo "Are you sure that you want to remove this directory $CONF? [y/n] " echo "Are you sure that you want to remove this directory $CONF? [y/n] "
read answer read answer
answer=`echo $answer | sed 's/^[y].*$/y/'` answer=`echo $answer | sed -e 's/^[y].*$/y/'`
if [ -z "$answer" -o "x$answer" = "xy" ]; then if [ -z "$answer" -o "x$answer" = "xy" ]; then
rm -rf ${CONFIG_DIR}/${CONF} rm -rf ${CONFIG_DIR}/${CONF}
sed -i "/^${CONF} /d" ${CONFIG_DIR}/work_cfgs.txt > ${CONFIG_DIR}/work_cfgs.tmp sed -i'' -e "/^${CONF} /d" ${CONFIG_DIR}/work_cfgs.txt > ${CONFIG_DIR}/work_cfgs.tmp
echo "${CONF} configuration REMOVED" echo "${CONF} configuration REMOVED"
else else
......
...@@ -64,9 +64,9 @@ echo "Removing keys ${2} in : ${1}" ...@@ -64,9 +64,9 @@ echo "Removing keys ${2} in : ${1}"
for i in ${2} ; do for i in ${2} ; do
if [ "$(echo ${i} | grep -c key_nproc )" -gt 0 ]; then if [ "$(echo ${i} | grep -c key_nproc )" -gt 0 ]; then
sed -i "s/key_nproc[ij]=.* //" ${1}/cpp_$(basename ${1}).fcm sed -i'' -e "s/key_nproc[ij]=.* //" ${1}/cpp_$(basename ${1}).fcm
elif [ "$(cat ${1}/cpp_$(basename ${1}).fcm | grep -c "$i")" -gt 0 ]; then elif [ "$(cat ${1}/cpp_$(basename ${1}).fcm | grep -c "$i")" -gt 0 ]; then
sed -i "s/\b${i}\b//" ${1}/cpp_$(basename ${1}).fcm sed -i'' -e "s/\b${i}\b//" ${1}/cpp_$(basename ${1}).fcm
echo "deleted key $i in $(basename ${1})" echo "deleted key $i in $(basename ${1})"
fi fi
done done
...@@ -58,7 +58,7 @@ set -o posix ...@@ -58,7 +58,7 @@ set -o posix
archfile_loop() { archfile_loop() {
for file in $( ls $1/*.fcm ); do for file in $( ls $1/*.fcm ); do
zvar1=$( basename $file | sed 's/arch-\(.*\).fcm/\1/' ) zvar1=$( basename $file | sed -e 's/arch-\(.*\).fcm/\1/' )
zvar2=$( head -1 $file | tr -d '#' ) zvar2=$( head -1 $file | tr -d '#' )
printf "%-30s %-s\n" ${zvar1} "${zvar2}" printf "%-30s %-s\n" ${zvar1} "${zvar2}"
done done
......
...@@ -54,9 +54,29 @@ set -o posix ...@@ -54,9 +54,29 @@ set -o posix
# * creation # * creation
# #
#- #-
# function to mimic "readlink -f" command (not available on MacOS)
# source: https://stackoverflow.com/a/1116890
rlf ()
{
TARGET_FILE=$1;
cd `dirname $TARGET_FILE`;
TARGET_FILE=`basename $TARGET_FILE`;
while [ -L "$TARGET_FILE" ]; do
TARGET_FILE=`readlink $TARGET_FILE`;
cd `dirname $TARGET_FILE`;
TARGET_FILE=`basename $TARGET_FILE`;
done;
PHYS_DIR=`pwd -P`;
RESULT=$PHYS_DIR/$TARGET_FILE;
echo $RESULT
}
[ ! -d ${1} ] && \mkdir -p ${1} [ ! -d ${1} ] && \mkdir -p ${1}
# CPP
[ "${2}" != "${1}" ] && \cp -n ${2}/cpp_${2##*/}.fcm ${1}/cpp_${1##*/}.fcm [ "${2}" != "${1}" ] && \cp -n ${2}/cpp_${2##*/}.fcm ${1}/cpp_${1##*/}.fcm
#
# EXP00
if [ ! -d ${1}/EXP00 ] if [ ! -d ${1}/EXP00 ]
then then
echo " Creating ${1}/EXP00" echo " Creating ${1}/EXP00"
...@@ -64,20 +84,21 @@ then ...@@ -64,20 +84,21 @@ then
echo " -> Copying existing xml, namelist and AGRIF_FixedGrids.in files from ${2}/EXPREF to ${1}/EXP00" echo " -> Copying existing xml, namelist and AGRIF_FixedGrids.in files from ${2}/EXPREF to ${1}/EXP00"
for f in $( ls -1 ${2}/EXPREF/*.xml ${2}/EXPREF/*namelist* ${2}/EXPREF/AGRIF_FixedGrids.in 2>/dev/null ) for f in $( ls -1 ${2}/EXPREF/*.xml ${2}/EXPREF/*namelist* ${2}/EXPREF/AGRIF_FixedGrids.in 2>/dev/null )
do do
if [[ -L ${f} && $( readlink -f ${f} ) =~ "SHARED" ]] if [[ -L ${f} && $( rlf ${f} ) =~ "SHARED" ]]
then then
# create absolute(relative) symlinks if config directory is outside(inside) nemo directory # create absolute(relative) symlinks if config directory is outside(inside) nemo directory
if [[ $(dirname ${1}) != $(dirname ${2}) ]]; then if [[ $(dirname ${1}) != $(dirname ${2}) ]]; then
\ln -sf $( readlink -f ${f} ) ${1}/EXP00/$( basename ${f} ) # keep link from SHARED \ln -sf $( rlf ${f} ) ${1}/EXP00/$( basename ${f} ) # keep link from SHARED
else else
(cd ${1}/EXP00; \ln -sf ../../../cfgs/SHARED/$(basename $(readlink -f ${f}) ) $( basename ${f} )) (cd ${1}/EXP00; \ln -sf ../../../cfgs/SHARED/$(basename $(rlf ${f}) ) $( basename ${f} ))
fi fi
else else
\cp ${f} ${1}/EXP00/. \cp ${f} ${1}/EXP00/.
fi fi
done done
fi fi
#
# MY_SRC
if [ ! -d ${1}/MY_SRC ] if [ ! -d ${1}/MY_SRC ]
then then
if [ -d ${2}/MY_SRC ] if [ -d ${2}/MY_SRC ]
......
...@@ -55,7 +55,7 @@ set -o posix ...@@ -55,7 +55,7 @@ set -o posix
if [ "$2" == "YES" ]; then if [ "$2" == "YES" ]; then
echo -n " $1 [Y/n] " echo -n " $1 [Y/n] "
read answer read answer
answer=`echo $answer | sed 's/^[yY].*$/y/'` answer=`echo $answer | sed -e 's/^[yY].*$/y/'`
if [ -z "$answer" -o "x$answer" = "xy" ]; then if [ -z "$answer" -o "x$answer" = "xy" ]; then
TAB[$ind]="$1" TAB[$ind]="$1"
let ind=ind+1 let ind=ind+1
...@@ -69,7 +69,7 @@ if [ "$2" == "YES" ]; then ...@@ -69,7 +69,7 @@ if [ "$2" == "YES" ]; then
else else
echo -n " $1 [y/N] " echo -n " $1 [y/N] "
read answer read answer
answer=`echo $answer | sed 's/^[nN].*$/N/'` answer=`echo $answer | sed -e 's/^[nN].*$/N/'`
if [ "x$answer" = "xy" ]; then if [ "x$answer" = "xy" ]; then
TAB[$ind]="$1" TAB[$ind]="$1"
let ind=ind+1 let ind=ind+1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment