conan-install.sh file for macos
As macos readlink and sed diff with gnu readlink and sed,
One can install readlinke and sed by homebrew, but the command should be greadlink and gsed
macos apple-clang remove libstdc++ to libc++.
Author:
Committer:
Parent: 19b0fce707a2ee08c3014c2d47bd317e5d9d60e6 (Merge branch '685-improvements-for-conan2-build-system' into 'master')
Branch:
Follows:
Precedes:
Local uncommitted changes, not checked in to index
------------------------------- conan-install.sh -------------------------------
index 5331b109..811993f9 100755
@@ -27,7 +27,7 @@ echo " "
SOURCE=${BASH_SOURCE[0]}
while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
- SOURCE=$(readlink "$SOURCE")
+ SOURCE=$(greadlink "$SOURCE")
[[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
@@ -50,7 +50,7 @@ while [ ! -z "$1" ]; do
case "$1" in
--source-directory|-s)
shift
- CORSIKA_DIR=$(readlink -e ${1})
+ CORSIKA_DIR=$(greadlink -e ${1})
CORSIKA_DIR_INFORMED=${1}
;;
--debug|-d)
@@ -102,7 +102,7 @@ else
fi
# Conan2 variabes
-CONAN2_HOME=$(readlink -e `conan config home`)
+CONAN2_HOME=$(greadlink -e `conan config home`)
CONAN2_PROFILE_NAME="corsika8"
printf "[ conan-install | info > conan2 home: ${CONAN2_HOME}\n"
@@ -130,7 +130,7 @@ printf "\n\n[ conan-install | info > Editing '${CONAN2_PROFILE_NAME}' profile\n"
#========== cppstd setting ============
STD_NUMBER=`grep -n -m 1 "compiler.cppstd=" ${CONAN2_HOME}/profiles/${CONAN2_PROFILE_NAME} | cut -d: -f1`
-SED_STD_COMMAND="sed -i '${STD_NUMBER}s/.*/compiler.cppstd=gnu17/' ${CONAN2_HOME}/profiles/${CONAN2_PROFILE_NAME}"
+SED_STD_COMMAND="gsed -i '${STD_NUMBER}s/.*/compiler.cppstd=gnu17/' ${CONAN2_HOME}/profiles/${CONAN2_PROFILE_NAME}"
eval $SED_STD_COMMAND
if [ ! $? -eq 0 ]; then
@@ -140,7 +140,7 @@ fi
#========== libcxx setting ============
CXX_NUMBER=`grep -n -m 1 "compiler.libcxx=" ${CONAN2_HOME}/profiles/${CONAN2_PROFILE_NAME} | cut -d: -f1`
-SED_CXX_COMMAND="sed -i '${CXX_NUMBER}s/.*/compiler.libcxx=libstdc++11/' ${CONAN2_HOME}/profiles/${CONAN2_PROFILE_NAME}"
+SED_CXX_COMMAND="gsed -i '${CXX_NUMBER}s/.*/compiler.libcxx=libc++/' ${CONAN2_HOME}/profiles/${CONAN2_PROFILE_NAME}"
eval $SED_CXX_COMMAND
if [ ! $? -eq 0 ]; then
Maybe add a system condition is better.
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "This is macOS"
SED_COMMAND="gsed"
else
SED_COMMAND="sed"
fi
$SED_COMMAND 's/old_text/new_text/g' your_file.txt