From e48fee173d0e91ea8bf64fb501861fcf66c477e1 Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 7 Jun 2006 11:09:40 +0000 Subject: [PATCH] Improve build.csh script --- config_files/build.csh | 84 +++++++++++++++++++++++++++++++----------- 1 file changed, 62 insertions(+), 22 deletions(-) diff --git a/config_files/build.csh b/config_files/build.csh index 7b8ea28..43d80bc 100755 --- a/config_files/build.csh +++ b/config_files/build.csh @@ -1,4 +1,4 @@ -#! /bin/csh -f +#!/bin/csh -f ################################################################################################## # Name : build.csh # Description: Build and install SALOME modules from sources @@ -48,7 +48,7 @@ while ( ${%1} > 0 ) set params="$params $1" else set b_params="$b_params $1" - echo "Warning: Unknown module: $1. Skipping." + echo "\!\!\! Warning \!\!\! Unknown module: $1. Skipping." endif endif shift @@ -129,7 +129,7 @@ else endif endif -echo "The following SALOME packages will be built:" +echo ">>> The following SALOME packages will be built:" echo $modules ######################################################### @@ -140,15 +140,40 @@ if ( ! -e $env_script ) then set env_script=`dirname $0`/env_products.csh endif if ( -e $env_script ) then - echo "Setting environment" + echo ">>> Setting environment" source $env_script else - echo "Warning! Environment is not set: file env_products.csh is not found." + echo "\!\!\! Warning \!\!\! Environment is not set: file env_products.csh is not found." endif set BUILD_DIR=${PWD} set LOG_DIR=${BUILD_DIR}/LOGS +######################################################### +# define installation prefix +######################################################### +if ( "$prefix" == "" ) then + set prefix=${BUILD_DIR}/INSTALL + if ( $is_install == 1 ) then + echo "\!\!\! Warning \!\!\! Installation directory is not set." + echo "All the modules will be installed to the $prefix" + else + set is_kernel=`echo ${modules} | grep KERNEL` + if ( "$is_kernel" != "" ) then + echo "\!\!\! Warning \!\!\! KERNEL module requires install step to be performed." + echo "For this module -i option will be forced." + echo "The module(s) will be installed to the $prefix" + endif + endif +else + set is_absolute=`echo $prefix | grep -e "^/"` + if ( "$is_absolute" == "" ) then + set prefix=${BUILD_DIR}/$prefix + echo "\!\!\! Warning \!\!\! Relative prefix is used." + echo "All the modules will be installed to the $prefix" + endif +endif + ######################################################### # create log directory ######################################################### @@ -158,13 +183,13 @@ endif echo "===========================================================================" echo "Starting SALOME build at `date`" +echo "===========================================================================" ######################################################### # loop for all given modules ######################################################### foreach module (${modules}) - echo "===========================================================================" - echo "Processing ${module} module" + echo ">>> Processing ${module} module" set module_src=`printenv ${module}_SRC_DIR` set module_build=${BUILD_DIR}/${module}_BUILD @@ -176,7 +201,7 @@ foreach module (${modules}) # check if sources directory exists ######################################################### if ( ! -e ${module_src} ) then - echo "Error! Can't find sources directory: ${module_src} does not exist." + echo "\!\!\! Error \!\!\! Can't find sources directory: ${module_src} does not exist." continue endif ######################################################### @@ -191,12 +216,12 @@ foreach module (${modules}) # configure script does not exist (first compilation?) ######################################################### if ( $is_build_configure == 1 || $cfg_exist == 0 ) then - echo "------- Build configure ---------" + echo "... Performing build_configure" ######################################################### # check if build_configure script exists ######################################################### if ( ! -e ${module_src}/build_configure ) then - echo "Warning! Can not find build_configure script in ${module_src}." + echo "\!\!\! Warning \!\!\! Can not find build_configure script in ${module_src}." else ######################################################### # call build_configure @@ -215,7 +240,7 @@ foreach module (${modules}) # deleting build directory if -d flag is given ######################################################### if ( -e ${module_build} && $is_delete == 1 ) then - echo "Deleting ${module_build}" + echo "... Removing ${module_build}" rm -rf ${module_build} endif ######################################################### @@ -233,13 +258,28 @@ foreach module (${modules}) if ( -e ${module_build}/Makefile ) then set mkfile_exist=1 endif + ######################################################### + # check if configure options are changed from the + # previous launch + ######################################################### + set opts_changed=0 +## if ( -f ${module_build}/config.log ) then +## set old_prefix=`grep -e '^prefix=' ${module_build}/config.log | sed -e "s%^prefix='\(.*\)'%\1%"` +## if ( "$old_prefix" != "$prefix" ) then +## set opts_changed=1 +## endif +## endif ######################################################### # define installation directory (by using module's version # number); default is a build directory ######################################################### set vx="" - if ( -e ${module_src}/bin/VERSION ) then - set vx=`awk -F: '{ if (NF > 1) print $NF; }' ${module_src}/bin/VERSION | tr -d '[:space:]'` + set cfg_file=configure.ac + if ( ! -e ${module_src}/${cfg_file} ) then + set cfg_file=configure.in.base + endif + if ( -e ${module_src}/${cfg_file} ) then + set vx=`grep -e "^VERSION=" ${module_src}/${cfg_file} | awk -F= '{ if (NF>1) print $NF; }' | tr -d '[:space:]'` endif set px=${BUILD_DIR}/${module} if ( "$prefix" != "" ) then @@ -252,13 +292,13 @@ foreach module (${modules}) # perform configure if -c flag is given or if # Makefile does not exist (first compilation?) ######################################################### - if ( $is_configure == 1 || $mkfile_exist == 0) then - echo "------- Configure ---------------" + if ( $is_configure == 1 || $mkfile_exist == 0 || $opts_changed == 1 ) then + echo "... Performing configure" ######################################################### # check if configure script exists ######################################################### if ( ! -e ${module_src}/configure ) then - echo "Warning! Can not find configure script in ${module_src}." + echo "\!\!\! Warning \!\!\! Can not find configure script in ${module_src}." else if ( "${module}" == "NETGENPLUGIN" && ($?NETGENHOME) ) then set add_keys="--with-netgen=${NETGENHOME}" @@ -278,7 +318,7 @@ foreach module (${modules}) ######################################################### # perform make ######################################################### - echo "------- Make --------------------" + echo "... Performing make" ######################################################### # first clear dependencies ######################################################### @@ -312,13 +352,13 @@ foreach module (${modules}) ######################################################### # perform make if -i or -p flags are given ######################################################### - if ( $is_install == 1 && $sts == 0 ) then - echo "------- Make install ------------" + if ( $is_install == 1 && $sts == 0 || "${module}" == "KERNEL" ) then + echo "... Performing make install" ######################################################### # deleting build directory if -d flag is given ######################################################### if ( -e $px && $is_delete == 1 ) then - echo "Deleting $px" + echo "... Removing $px" rm -rf $px endif make install >& ${LOG_DIR}/make_install_${module}.log @@ -331,9 +371,9 @@ foreach module (${modules}) setenv ${module}_ROOT_DIR $px endif endif - echo "" + echo ">>> Finished ${module} module" else - echo "Error! Can't find module sources. ${module}_SRC_DIR environment variable is not set." + echo "\!\!\! Error \!\!\! Can't find module sources. ${module}_SRC_DIR environment variable is not set." endif end ######################################################### -- 2.39.2