Skip to content

Commit

Permalink
Added install script
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarkramer committed Dec 9, 2015
1 parent 7393a75 commit 54f3cb4
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 10 deletions.
21 changes: 11 additions & 10 deletions scripts/linux/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
# Uncomment following line to debug script line by line:
#set -x; trap read debug

# Working directory must be top-level dir:
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
pushd $SCRIPT_DIR/../.. >/dev/null
REPO_DIR=$PWD
echo "@@@@@ REPO_DIR=$REPO_DIR"
popd >/dev/null
pushd $SCRIPT_DIR/../../..
OSSIM_DEV_HOME=$PWD
echo "@@@@@ OSSIM_DEV_HOME=$OSSIM_DEV_HOME"

CMAKE_CONFIG_SCRIPT=$REPO_DIR/cmake/scripts/ossim-cmake-config-LINUX.sh
CMAKE_CONFIG_SCRIPT=$OSSIM_DEV_HOME/ossim/cmake/scripts/ossim-cmake-config-LINUX.sh

# Consider whether running in interactive shell or batch for possible
# prompting on build configuration:
Expand Down Expand Up @@ -72,17 +72,18 @@ if [ $? -ne 0 ]; then
exit 1
fi

# CMake successful, now run make in the build directory (OSSIM_BUILD_DIR
# exported by cmake config script):
pushd $OSSIM_BUILD_DIR >/dev/null
# CMake successful, now run make in the build directory (OSSIM_BUILD_DIR may have been exported
# by cmake config script):
pushd $OSSIM_BUILD_DIR
make -j 8
if [ $? -ne 0 ]; then
echo; echo "Error encountered during make. Check the console log and correct."
popd>/dev/null
exit 1
fi

echo; echo "Build completed successfully. Binaries located in $OSSIM_BUILD_DIR"
popd>/dev/null
popd # out of $OSSIM_BUILD_DIR

popd # out of $OSSIM_DEV_HOME
exit 0

38 changes: 38 additions & 0 deletions scripts/linux/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
pushd $SCRIPT_DIR/../../..
OSSIM_DEV_HOME=$PWD
echo "STATUS: Setting OSSIM_DEV_HOME = <$OSSIM_DEV_HOME>"

echo "STATUS: Checking presence of env var OSSIM_BUILD_DIR = <$OSSIM_BUILD_DIR>...";
if [ -z $OSSIM_BUILD_DIR ]; then
OSSIM_BUILD_DIR=$OSSIM_DEV_HOME/build;
if [ ! -d $OSSIM_BUILD_DIR ] ; then
echo "ERROR: OSSIM_BUILD_DIR = <$OSSIM_BUILD_DIR> does not exist at this location. Cannot install";
exit 1;
fi
fi

if [ -z $OSSIM_INSTALL_DIR ]; then
OSSIM_INSTALL_DIR=$OSSIM_DEV_HOME/install;
echo "INFO: OSSIM_INSTALL_DIR environment variable is not defined. Defaulting to <$OSSIM_INSTALL_DIR>";
fi

if [ ! -d $OSSIM_INSTALL_DIR ] ; then
echo "INFO: Installation directory <$OSSIM_INSTALL_DIR> does not exist. Creating...";
mkdir $OSSIM_INSTALL_PREFIX;
fi

pushd $OSSIM_BUILD_DIR
echo "STATUS: Performing make install to <$OSSIM_INSTALL_DIR>"
make install
if [ $? -ne 0 ]; then
echo; echo "ERROR: Error encountered during make install. Check the console log and correct."
popd
exit 1
fi
echo; echo "STATUS: Install completed successfully. Install located in $OSSIM_INSTALL_DIR"
popd # out of OSSIM_BUILD_DIR

popd # out of OSSIM_DEV_HOME
exit 0

0 comments on commit 54f3cb4

Please sign in to comment.