From: crouzet Date: Tue, 25 Oct 2005 14:12:14 +0000 (+0000) Subject: tools for creating a c++ component tree for compilation X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e8947de20941db67bf3db49327a1d20138a71268;p=tools%2Fhxx2salome.git tools for creating a c++ component tree for compilation --- diff --git a/scripts/SA_new_cpp_component b/scripts/SA_new_cpp_component new file mode 100755 index 0000000..e59c54c --- /dev/null +++ b/scripts/SA_new_cpp_component @@ -0,0 +1,85 @@ +#!/bin/bash + +usage() +{ + echo + echo Usage : + echo + echo " SA_new_cpp_component Name" + echo + echo " -> create the tree to compile a new C++ component linked with MED libs" + echo + exit 1 +} + +rename_dir() +{ + # Rename the first directory containing $oldName in their file name + liste=`find . -type d -name "*${oldName}*"` + for file in $liste + do + newFile=`echo $file | sed "s/${oldName}/${newName}/g"` + echo "mv -f $file $newFile" + mv -f $file $newFile + return 1 + done + return 0 +} + +if [ $# -ne 1 ] +then + usage +fi + +tar xvfz ${HXX2SALOME_ROOT_DIR}/cpp_compo_template.tgz +moduleName=${1}_CPP_SRC +mv template_SRC ${moduleName} + +oldName=template +newName=$1 + +today=`date +%d%m%y` +cd ${moduleName} +echo +echo Renamed Directories: +echo + +# rename directories one by one +rename_dir +while [ $? -eq 1 ] +do + rename_dir +done + +# rename files containing ${oldName} in their name +echo +echo Renamed Files: +echo +liste=`find . -name "*${oldName}*"` +for file in $liste +do + newFile=`echo $file | sed "s/${oldName}/${newName}/g"` + echo "mv -f $file $newFile" + mv -f $file $newFile +done + +echo +echo Modified Files: +echo +# modify all files containing $oldName, replace occurences by $newName +liste=`find -name "*"` +for file in $liste +do + if [ -f $file ] + then + grep $oldName $file > /dev/null 2>&1 + if [ $? -eq 0 ] + then + echo $file + cat $file | sed "s/${oldName}/${newName}/g" > fic_temp_${today} + cp -f fic_temp_${today} $file + fi + fi +done +rm -f fic_temp_${today} +cd - diff --git a/scripts/cpp_compo_template.tgz b/scripts/cpp_compo_template.tgz new file mode 100644 index 0000000..86bdd4d Binary files /dev/null and b/scripts/cpp_compo_template.tgz differ