From 886e81b296da4a38e102c1d15006e5938a859ebe Mon Sep 17 00:00:00 2001 From: crouzet Date: Tue, 25 Oct 2005 14:15:48 +0000 Subject: [PATCH] C like comments treatment Bug in ghxx2salome with csh environment -> don't source .csh anymore --- scripts/hxx2salome | 66 +++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/scripts/hxx2salome b/scripts/hxx2salome index 77187ed..1e3575c 100755 --- a/scripts/hxx2salome +++ b/scripts/hxx2salome @@ -157,7 +157,7 @@ generate_module_source() # ------------------------- parse hxx file and generate code --------------------------------------- # echo -e "\n-> Extract public functions\n" - cat ${hxx_file} | awk -f ${gene_dir}/parse1.awk > ${CLASS_NAME}_public_functions + cat ${hxx_file} | awk -f ${gene_dir}/parse01.awk | awk -f ${gene_dir}/parse1.awk > ${CLASS_NAME}_public_functions cat ${CLASS_NAME}_public_functions if [ ! -s ${CLASS_NAME}_public_functions ] then @@ -276,7 +276,7 @@ update_environment() if [ $res == 1 ] then echo -e "###\n#------ ${CLASS_NAME}-Src ------" >> ${ENVIRON_FILE} - echo -e "setenv ${CLASS_NAME}_BASE ${INSTALL_DIR}\n" >> ${ENVIRON_FILE} + echo -e "setenv ${CLASS_NAME}_BASE ${INSTALL_DIR}" >> ${ENVIRON_FILE} echo -e "setenv ${CLASS_NAME}_SRC_DIR \${${CLASS_NAME}_BASE}/${CLASS_NAME}_SRC\n" >> ${ENVIRON_FILE} fi @@ -285,7 +285,7 @@ update_environment() if [ $res == 1 ] then echo -e "###\n#------ ${CLASS_NAME}-Bin ------" >> ${ENVIRON_FILE} - echo -e "setenv ${CLASS_NAME}_ROOT_DIR \${${CLASS_NAME}_BASE}/${CLASS_NAME}_INSTALL\n" >> ${ENVIRON_FILE} + echo -e "setenv ${CLASS_NAME}_ROOT_DIR \${${CLASS_NAME}_BASE}/${CLASS_NAME}_INSTALL" >> ${ENVIRON_FILE} echo -e "setenv ${CLASS_NAME}_CPP_ROOT ${CPP_ROOT_DIR}" >> ${ENVIRON_FILE} echo -e "setenv LD_LIBRARY_PATH \${${CLASS_NAME}_CPP_ROOT}${lib_dir#${CPP_ROOT_DIR}}:\${LD_LIBRARY_PATH}" >> ${ENVIRON_FILE} fi @@ -297,7 +297,7 @@ update_environment() if [ $res == 1 ] then echo -e "###\n#------ ${CLASS_NAME}-Src ------" >> ${ENVIRON_FILE} - echo -e "export ${CLASS_NAME}_BASE=${INSTALL_DIR}\n" >> ${ENVIRON_FILE} + echo -e "export ${CLASS_NAME}_BASE=${INSTALL_DIR}" >> ${ENVIRON_FILE} echo -e "export ${CLASS_NAME}_SRC_DIR=\${${CLASS_NAME}_BASE}/${CLASS_NAME}_SRC\n" >> ${ENVIRON_FILE} fi @@ -306,7 +306,7 @@ update_environment() if [ $res == 1 ] then echo -e "###\n#------ ${CLASS_NAME}-Bin ------" >> ${ENVIRON_FILE} - echo -e "export ${CLASS_NAME}_ROOT_DIR=\${${CLASS_NAME}_BASE}/${CLASS_NAME}_INSTALL\n" >> ${ENVIRON_FILE} + echo -e "export ${CLASS_NAME}_ROOT_DIR=\${${CLASS_NAME}_BASE}/${CLASS_NAME}_INSTALL" >> ${ENVIRON_FILE} echo -e "export ${CLASS_NAME}_CPP_ROOT=${CPP_ROOT_DIR}" >> ${ENVIRON_FILE} echo -e "export LD_LIBRARY_PATH=\${${CLASS_NAME}_CPP_ROOT}${lib_dir#${CPP_ROOT_DIR}}:\${LD_LIBRARY_PATH}" \ >> ${ENVIRON_FILE} @@ -362,7 +362,7 @@ compile_module() fi \rm -rf ${NEW_COMPONENT_ROOT_DIR}/* ${NEW_COMPONENT_BUILD_DIR}/* - source ${ENVIRON_FILE} +# source ${ENVIRON_FILE} echo echo -e "\n-> Build Configure" cd ${NEW_COMPONENT_SRC_DIR} @@ -440,36 +440,41 @@ then csh) SHELL_EXT=csh;; sh) SHELL_EXT=sh;; esac - if [ "${SHELL_EXT}" == "csh" ] - then - # source csh environment and retrieve it in bash father shell - cp ${ENVIRON_FILE} __tmp__env.csh - cat >>__tmp__env.csh<<-EOF -setenv | awk -F= '{print "export " \$1 "=\"" \$2 "\""}' >__tmp__env.sh -EOF - csh __tmp__env.csh - . __tmp__env.sh - rm -f __tmp__env.csh - rm -f __tmp__env.sh - else - source ${ENVIRON_FILE} - fi +fi + +if [ ${KERNEL_ROOT_DIR} ] && [ -d ${KERNEL_ROOT_DIR} ] && [ ${OMNIORBDIR} ] && [ -d ${OMNIORBDIR} ] +then + # if KERNEL_ROOT_DIR ans OMNIORBDIR are defined, we consider that environment is set + echo -e "\n Environment already set" else - echo -e "\nSorry - Cannot compile : Environment file shoud be set up for compiling!\n" - do_compile=0 + # if KERNEL_ROOT_DIR is not defined : + # - sh file : we source environment file + # - csh file : we do not compile + if [ "${SHELL_EXT}" == "sh" ] && [ ${ENVIRON_FILE} ] && [ -f ${ENVIRON_FILE} ] + then + echo -e "\n Environment not set : source ${ENVIRON_FILE}" + source ${ENVIRON_FILE} + else + if [ $do_compile -eq 1 ] + then + echo -e "\n Warning - Cannot compile : Environment shoud be set up for compiling!\n" + do_compile=0 + fi + fi fi + # if [ ${HXX2SALOME_ROOT_DIR} ] && [ -d ${HXX2SALOME_ROOT_DIR} ] then gene_dir=${HXX2SALOME_ROOT_DIR} else - if [ ! -f parse1.awk -o ! -f parse2.awk ] - then - echo -e "\nError : Variable HXX2SALOME_ROOT_DIR shoud be set, or hxx2salome should be launched localy" - usage - else - gene_dir=`pwd` # case where hxx2salome was launched from HXX2SALOME directory - fi + gene_dir=`pwd` # case where hxx2salome was launched from HXX2SALOME directory +fi +echo " hxx2salome directory : $gene_dir" +if [ ! -f ${gene_dir}/parse1.awk -o ! -f ${gene_dir}/parse2.awk ] # check if script are found +then + echo -e "\nError : Variable HXX2SALOME_ROOT_DIR shoud be set, or hxx2salome should be launched localy from bin directory" + usage fi # # get class name @@ -508,7 +513,8 @@ create_component_tree # ---------------------- Modification of Salome environment file ------------------------------------------- # update_environment -export `echo ${SOURCE_NAME}`_ROOT_DIR=${NEW_COMPONENT_ROOT_DIR} # to avoid resource env for compiling and launching salome +export `echo ${CLASS_NAME}`_ROOT_DIR=${NEW_COMPONENT_ROOT_DIR} # to avoid resource env for compiling and launching salome +export `echo ${CLASS_NAME}`_CPP_ROOT=${CPP_ROOT_DIR} # idem # # ---------------------- Copy the generated source from temp dir ------------------------------------------- # -- 2.39.2