Skip to content

Commit

Permalink
Merge pull request #22 from NASA-Tensegrity-Robotics-Toolkit/setup_re…
Browse files Browse the repository at this point in the history
…factor

Setup refactor
  • Loading branch information
PerryBhandal committed Aug 19, 2014
2 parents a1023fb + 2cbcc2c commit 78881cf
Show file tree
Hide file tree
Showing 11 changed files with 250 additions and 147 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
env
build
conf/install.conf
conf/*.conf
src/DoxyDocs
src/examples/learningSpines/TetraSpine/logs
7 changes: 3 additions & 4 deletions bin/setup/setup_boost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ local_setup_path="`dirname \"$0\"`" # relative
base_dir="`( cd \"$local_setup_path/../../\" && pwd )`" # absolutized and normalized
source "$base_dir/bin/setup/setup_common.sh"

#Source this package's configuration
source_conf "boost.conf"

# Variables
boost_pkg=`echo $BOOST_URL|awk -F/ '{print $NF}'` # get the package name from the url

# Constants
TRUE=0 # Yes, TRUE is 0 (e.g., no errors)
FALSE=1 # Ditto, FALSE is non-zero

function ensure_install_prefix_writable() {
touch "$BOOST_INSTALL_PREFIX/tensegrity.deleteme" 2>/dev/null \
|| { echo "Install prefix '$BOOST_INSTALL_PREFIX' is not writable -- please use sudo or execute as root."; exit 1; }
Expand Down
7 changes: 3 additions & 4 deletions bin/setup/setup_bullet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ local_setup_path="`dirname \"$0\"`" # relative
base_dir="`( cd \"$local_setup_path/../../\" && pwd )`" # absolutized and normalized
source "$base_dir/bin/setup/setup_common.sh"

#Source this package's configuration
source_conf "bullet.conf"

# Adding 5-20-2014 for patching bullet
SCRIPT_PATH="`dirname \"$0\"`" # relative
SCRIPT_PATH="`( cd \"$SCRIPT_PATH\" && pwd )`" # absolutized and normalized
Expand All @@ -33,10 +36,6 @@ setup_dir="$SCRIPT_PATH"
# Variables
bullet_pkg=`echo $BULLET_URL|awk -F/ '{print $NF}'` # get the package name from the url

# Constants
TRUE=0 # Yes, TRUE is 0 (e.g., no errors)
FALSE=1 # FALSE is non-zero

function ensure_install_prefix_writable() {
touch "$BULLET_INSTALL_PREFIX/tensegrity.deleteme" 2>/dev/null \
|| { echo "Install prefix '$BULLET_INSTALL_PREFIX' is not writable -- please use sudo or execute as root."; exit 1; }
Expand Down
23 changes: 14 additions & 9 deletions bin/setup/setup_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,20 @@
# Purpose: Common setup code
# Date: 2014-08-18

###############################
# Configuration
install_conf_file="$base_dir/conf/install.conf"
if [ ! -f "$install_conf_file" ]; then
echo "Missing install.conf ($install_conf_file). Please fix this and try again."
exit 1
fi
source "$install_conf_file"
###############################
function source_conf() {
conf_file_name="$base_dir/conf/$1"
if [ ! -f "$conf_file_name" ]; then
echo "Missing $conf_file_name. Please fix this and try again."
exit 1
fi
source "$conf_file_name"
}

source_conf "general.conf"

# Constants
TRUE=0 # Yes, TRUE is 0 (e.g., no errors)
FALSE=1 # Ditto, FALSE is non-zero

# Deteremine if a string contains a substring
# Usage: tf=$(str_contains "my string" "substring")
Expand Down
7 changes: 3 additions & 4 deletions bin/setup/setup_jsoncpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,16 @@ local_setup_path="`dirname \"$0\"`" # relative
base_dir="`( cd \"$local_setup_path/../../\" && pwd )`" # absolutized and normalized
source "$base_dir/bin/setup/setup_common.sh"

#Source this package's configuration
source_conf "jsoncpp.conf"

SCRIPT_PATH="`dirname \"$0\"`" # relative
SCRIPT_PATH="`( cd \"$SCRIPT_PATH\" && pwd )`" # absolutized and normalized
setup_dir="$SCRIPT_PATH"

# Variables
jsoncpp_pkg=`echo $JSONCPP_URL|awk -F/ '{print $NF}'` # get the package name from the url

# Constants
TRUE=0 # Yes, TRUE is 0 (e.g., no errors)
FALSE=1 # FALSE is non-zero

function ensure_install_prefix_writable() {
touch "$JSONCPP_INSTALL_PREFIX/tensegrity.deleteme" 2>/dev/null \
|| { echo "Install prefix '$JSONCPP_INSTALL_PREFIX' is not writable -- please use sudo or execute as root."; exit 1; }
Expand Down
46 changes: 46 additions & 0 deletions conf/default/boost.conf.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

# Copyright © 2012, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All rights reserved.
#
# The NASA Tensegrity Robotics Toolkit (NTRT) v1 platform is licensed
# under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific language
# governing permissions and limitations under the License.

# Purpose: Define configuration directives for setup_boost.sh.
# Date: 2014-08-18
# Usage: Copy/rename this file to '../boost.conf' and run setup.sh

# @see scripts/setup_boost.sh for more info

# Boost installation prefix
# Global install: /usr/local (default), env install: "$ENV_DIR"
# If you've already installed the package under this prefix, this is the
# only thing you'll need to set.
BOOST_INSTALL_PREFIX="$INSTALL_PREFIX"

# Location where bullet is to be built if necessary, or where it was built if
# you're using an existing package. This doesn't need to be set unless boost is
# not already installed.
BOOST_BUILD_DIR="$env_dir/build/boost_1_53_0"

# This is the location where you unzipped the package (or, where it will
# be unzipped if necessary).
BOOST_PACKAGE_DIR="$BOOST_BUILD_DIR"

# BOOST_URL can be either a web address or a local file address,
# e.g. http://url.com/for/boost.tgz or file:///path/to/boost.tgz
BOOST_URL="http://sourceforge.net/projects/boost/files/boost/1.53.0/boost_1_53_0.tar.gz"

# Set the expected SHA1 hash for this package's download.
# Note: Hashes are only checked if a SHA1 sum utility is specified in general.conf
BOOST_SHA1="0e4ef26cc7780c6bbc63987ef2f29be920e2395b"
47 changes: 47 additions & 0 deletions conf/default/bullet.conf.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# Copyright © 2012, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All rights reserved.
#
# The NASA Tensegrity Robotics Toolkit (NTRT) v1 platform is licensed
# under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific language
# governing permissions and limitations under the License.

# Purpose: Define configuration directives for setup_bullet.sh.
# Date: 2014-08-18
# Usage: Copy/rename this file to '../bullet.conf' and run setup.sh

# @see scripts/setup_bullet.sh for more info.

# Bullet installation prefix
# Global install: /usr/local, env install: "$env_dir"
# By default, setup will download and install bullet under your env directory.
# If you have an existing bullet install, you should change
# BULLET_INSTALL_PREFIX to what was used for installation (likely /usr/local).
BULLET_INSTALL_PREFIX="$env_dir"

# Location where bullet is to be built, or where it was built if you're using
# an existing package.
BULLET_BUILD_DIR="$env_dir/build/bullet-2.82-r2704"

# This is the location where you unzipped the package (or, where it will be
# unzipped if required). This will be the same as the build dir unless you did
# an out-of-source build (not common for bullet).
BULLET_PACKAGE_DIR="$BULLET_BUILD_DIR"

# BULLET_URL can be either a web address or a local file address,
# e.g. 'http://url.com/for/bullet.tgz' or 'file:///path/to/bullet.tgz'
BULLET_URL="http://bullet.googlecode.com/files/bullet-2.82-r2704.tgz"

# Set the expected SHA1 hash for this package's download.
# Note: Hashes are only checked if a SHA1 sum utility is specified in general.conf
BULLET_SHA1="a0867257b9b18e9829bbeb4c6c5872a5b29d1d33"
52 changes: 52 additions & 0 deletions conf/default/general.conf.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

# Copyright © 2012, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All rights reserved.
#
# The NASA Tensegrity Robotics Toolkit (NTRT) v1 platform is licensed
# under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific language
# governing permissions and limitations under the License.

# Purpose: Define general configuration directives for setup
# Date: 2014-08-18
# Usage: Copy/rename this file to '../general.conf' and run setup.sh

#############################################
# Script Initialization -- do not edit.
if [[ -z "$base_dir" ]]; then
echo "general.conf : base_dir must be set before sourcing this file."
exit 1
fi
env_name='env'
env_dir="$base_dir/$env_name"
downloads_dir="$env_dir/downloads"
bin_dir="$env_dir/bin"
build_dir="$env_dir/build"
#############################################

#############################################
# Configuration -- edit below as needed.
#############################################

# Uncomment this to use installations that are available to the whole system.
# NOTE: By default, setup installs bullet under env rather than $INSTALL_PREFIX
#INSTALL_PREFIX="/usr/local"

# Uncomment this to install locally (under env/include and env/lib)
# IMPORTANT: If you've previously installed to /usr/local, you'll need to
# delete your 'env' directory before running setup again.
INSTALL_PREFIX="$env_dir"

# Set the path (or executable name if it's in your path) for the utility
# to use for SHA1 summing. To disable download integrity verification
# simply set the variable to an empty string.
SHA1SUM_UTILITY="sha1sum"
109 changes: 0 additions & 109 deletions conf/default/install.conf.default

This file was deleted.

Loading

0 comments on commit 78881cf

Please sign in to comment.