-#! /bin/csh -f
+#!/bin/csh -f
##################################################################################################
# Name : build.csh
# Description: Build and install SALOME modules from sources
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
endif
endif
-echo "The following SALOME packages will be built:"
+echo ">>> The following SALOME packages will be built:"
echo $modules
#########################################################
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
#########################################################
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
# 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
#########################################################
# 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
# 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
#########################################################
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
# 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}"
#########################################################
# perform make
#########################################################
- echo "------- Make --------------------"
+ echo "... Performing make"
#########################################################
# first clear dependencies
#########################################################
#########################################################
# 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
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
#########################################################