[Bio] / FigCommon / configure Repository:
ViewVC logotype

View of /FigCommon/configure

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (download) (annotate)
Tue Sep 23 03:49:33 2008 UTC (11 years, 2 months ago) by parrello
Branch: MAIN
CVS Tags: mgrast_dev_08112011, rast_rel_2009_05_18, mgrast_dev_08022011, rast_rel_2014_0912, mgrast_dev_05262011, rast_rel_2008_12_18, mgrast_dev_04082011, rast_rel_2010_0928, rast_2008_0924, mgrast_version_3_2, mgrast_dev_12152011, help, mgrast_dev_06072011, rast_rel_2008_09_30, rast_rel_2009_0925, rast_rel_2010_0526, rast_rel_2014_0729, mgrast_dev_02212011, rast_rel_2010_1206, mgrast_release_3_0, mgrast_dev_03252011, rast_rel_2010_0118, mgrast_rel_2008_0924, mgrast_rel_2008_1110_v2, rast_rel_2009_02_05, rast_rel_2011_0119, mgrast_rel_2008_0625, mgrast_release_3_0_4, mgrast_release_3_0_2, mgrast_release_3_0_3, mgrast_release_3_0_1, mgrast_dev_03312011, mgrast_release_3_1_2, mgrast_release_3_1_1, mgrast_release_3_1_0, mgrast_dev_04132011, rast_rel_2008_10_09, mgrast_dev_04012011, rast_release_2008_09_29, mgrast_rel_2008_0923, rast_rel_2009_07_09, rast_rel_2010_0827, mgrast_rel_2008_1110, myrast_33, rast_rel_2011_0928, rast_rel_2008_09_29, rast_rel_2008_10_29, mgrast_dev_04052011, mgrast_dev_02222011, rast_rel_2009_03_26, mgrast_dev_10262011, rast_rel_2008_11_24, HEAD
Changes since 1.7: +1 -1 lines
*** empty log message ***

#!/bin/sh
#
# Copyright (c) 2003-2006 University of Chicago and Fellowship
# for Interpretations of Genomes. All Rights Reserved.
#
# This file is part of the SEED Toolkit.
# 
# The SEED Toolkit is free software. You can redistribute
# it and/or modify it under the terms of the SEED Toolkit
# Public License. 
#
# You should have received a copy of the SEED Toolkit Public License
# along with this program; if not write to the University of Chicago
# at info@ci.uchicago.edu or the Fellowship for Interpretation of
# Genomes at veronika@thefig.info or download a copy from
# http://www.theseed.org/LICENSE.TXT.
#

#
# SEED configuration bootstrap script.
#
# The responsibility of this script is to determine the bare 
# minimum configuration required to run a Perl interpreter,
# and then move to FigCommon/bootstrap.pl to complete the
# environment configuration task.
#
# This script expects to be given an argument which defines the environment
# that we're configuring for.
#
# The FigCommon package defines configuration information for
# the environments. The environments themselves are built 
# separately from the CVS tree, and are included in the
# env directory at the toplevel of a FIGdisk.
#
# Each environment is in a directory FIGdisk/env/<env-name>
#
# Inside the <env-name> directory is a file PREFIX which
# specifies the directory in which the environment tree expects to be
# installed. If it cannot be installed there, the perl and
# python environments will need to be configured to allow
# perl and python scripts to find their libraries.
#
# This script also reads the DEFAULT_RELEASE file which 
# specifies the release number that should be used for
# bootstrapping the configuration. The files for that 
# release will be found in dist/releases/<release_number>
#

if [ ! -f DEFAULT_RELEASE -o ! -d env ] ; then
    cat <<EOF
Please run the SEED configuration script from the top level
of a SEED disk (the directory in which you found this
configuration script).
EOF

    exit
fi

#
# We define FIG_HOME to be the current directory or the second parameter
#

if [ $# -eq 2 ] ; then
    FIG_HOME=$2
else
    FIG_HOME=`pwd`
fi


release=`cat DEFAULT_RELEASE`
release_dir="$FIG_HOME/dist/releases/$release"

#
# This defines where we find our environment configuration
# scripts. It's not in one of the install directories 
# under the release since we might be installing against
# a tree that doesn't have an install already.
#

env_config_location=$release_dir/FigCommon

if [ ! -d $release_dir ] ; then
    #
    # We couldn't find the release directory.
    #
    
    echo "Error: Cannot find release directory $release_dir"
    exit 1
fi

#
# Determine what environments are present.
#

AvailableEnvironments=""
for d in $FIG_HOME/env/* ; do
    e=`basename $d`
    AvailableEnvironments="$AvailableEnvironments $e"

    envscript=$env_config_location/env.$e.pl
    if [ ! -f "$envscript" ] ; then
	echo "Warning: Environment configuration script $envscript not found for environment $e"
    fi
done


#
# Sanity-check the environment name the user passed 
# in. Need to ensure that there is an env/<envname> directory and
# that there is also a <release_dir>/FigCommon/env.<envname>.pl script available.
#

if [ $# -lt 1 ] ; then
    echo "Usage: $0 environment-name (dir)"
    echo "Available environments: $AvailableEnvironments"
    exit
fi

#
# Check to see if the user picked a valid environment.
#

if [ -f "$FIG_HOME/env/$1" ] ; then
    env_config_file=$FIG_HOME/env/$1
    env_type="config_file"
    env="common"
elif [ -d "$FIG_HOME/env/$1" ] ; then
    env=$1
    env_type="dir"
else
    echo "Invalid environment name $1"
    echo "Available environments: $AvailableEnvironments"
    exit
fi

shift

hosttype=$HOSTTYPE

#
# If we are using a config-file environment, find our environment
# directory from it.
#

if [ $env_type = "config_file" ] ; then
    cmd="\$1 == \"$HOSTNAME\" { print \$2 }"
    env_dir=`awk "$cmd" $env_config_file`
    if [ "$env_dir" = "" ] ; then
	cmd="\$1 == \"$HOSTTYPE\" { print \$2 }"
	env_dir=`awk "$cmd" $env_config_file`
    fi
else
    env_dir=$FIG_HOME/env/$env
    env_config=$env_config_location/env.$env.pl
fi

if [ ! -d $env_dir ] ; then
    echo "Environment directory $env_dir does not exist, exiting"
    exit
fi

#
# We have enough information now to bootstrap into the Perl 
# environment.
#
# Note that if the perl tree has been relocated, that we may not
# yet have access to the full perl library until we set the
# appropriate search paths.
# 

perl=$env_dir/bin/perl

if [ ! -x $perl ] ; then
    echo "Error: could not find an executable perl at $perl"
    exit
fi

#
# Set the environment that we're going to pass to perl
#

export FIG_HOME
export FIGCONFIG_ENV=$env
export FIGCONFIG_ENV_DIR=$env_dir
export FIGCONFIG_ENV_CONFIG_TYPE=$env_type
if [ $env_type = "config_file" ] ; then
    export FIGCONFIG_ENV_CONFIG_FILE=$env_config_file
fi
export FIGCONFIG_RELEASE=$release
export FIGCONFIG_RELEASE_DIR=$release_dir

#
# Ugh. Perl might be linked against a libperl.so, so we need to include the 
# directory holding that so in our LD_LIBRARY_PATH.
#

libperl_dir=`echo $env_dir/lib/perl5/*/*/CORE`

ld_path="$env_dir/lib"

if [ ! -d $libperl_dir  ] ; then
    echo "Warning: Couldn't find a libperl dir" 2>&1
else
    if [ -f $libperl_dir/libperl.so ] ; then
	echo "Perl is dynamically linked"
	ld_path="$env_dir/lib:$libperl_dir"
    fi
fi

if [ "$LD_LIBRARY_PATH" = "" ] ; then
    export LD_LIBRARY_PATH=$ld_path
else
    export LD_LIBRARY_PATH="${ld_path}:$LD_LIBRARY_PATH"
fi

#
# And bootstrap in perl.
#

echo "L: $LD_LIBRARY_PATH"
$perl $release_dir/FigCommon/bootstrap.pl "$@"

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3