[Bio] / FigCommon / configure Repository:
ViewVC logotype

View of /FigCommon/configure

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (download) (annotate)
Mon Dec 5 19:10:06 2005 UTC (14 years, 5 months ago) by olson
Branch: MAIN
CVS Tags: caBIG-05Apr06-00, caBIG-13Feb06-00
Changes since 1.3: +17 -0 lines
Added license words.

#!/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.
#

FIG_HOME=`pwd`


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 [ $# -ne 1 ] ; then
    echo "Usage: $0 environment-name"
    echo "Available environments: $AvailableEnvironments"
    exit
fi

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

if [ ! -d "$FIG_HOME/env/$1" ] ; then
    echo "Invalid environment name $1"
    echo "Available environments: $AvailableEnvironments"
    exit
fi

env=$1
shift
env_dir=$FIG_HOME/env/$env
env_config=$env_config_location/env.$env.pl

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_DIR=$env_dir
export FIGCONFIG_ENV=$env
export FIGCONFIG_RELEASE=$release
export FIGCONFIG_RELEASE_DIR=$release_dir
export FIGCONFIG_ENV_CONFIG=$env_config

#
# 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