From c0c9e30c82753ca1a0d2d75f22cc261c00d7b680 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Tue, 21 Feb 2012 19:21:12 -0500 Subject: [PATCH] trying to script around the nuisance called cygwin. --- scripts/generator/build_variables.sh | 167 ++++++++++++++------------- 1 file changed, 84 insertions(+), 83 deletions(-) diff --git a/scripts/generator/build_variables.sh b/scripts/generator/build_variables.sh index 57177009..82a74a39 100644 --- a/scripts/generator/build_variables.sh +++ b/scripts/generator/build_variables.sh @@ -53,29 +53,20 @@ PARM_1="$1" # helpful build function zone. -# switches from a /X/path form to an X:/ form. -function msys_to_dos_path() { - # we always remove dos slashes in favor of forward slashes. - echo "$1" | sed -e 's/\\/\//g' | sed -e 's/\/\([a-zA-Z]\)\/\(.*\)/\1:\/\2/' -} +source $FEISTY_MEOW_SCRIPTS/core/functions.sh + # load msys_to_dos_path and dos_to_msys_path. -# switches from an X:/ form to an /X/path form. -function dos_to_msys_path() { - # we always remove dos slashes in favor of forward slashes. - echo "$1" | sed -e 's/\\/\//g' | sed -e 's/\([a-zA-Z]\):\/\(.*\)/\/\1\/\2/' -} +#### switches from a /X/path form to an X:/ form. +###function msys_to_dos_path() { +### # we always remove dos slashes in favor of forward slashes. +### echo "$1" | sed -e 's/\\/\//g' | sed -e 's/\/\([a-zA-Z]\)\/\(.*\)/\1:\/\2/' +###} -###hmmm: move test suite out to the functions file in yeti, where the definitive versions -# of dos to msys etc live. -# test suite for above functions. -#echo this should go from msys to dos: -# prior='/c/bogart\dongle' -# latter=$(msys_to_dos_path "$prior") -# echo went from $prior to $latter -#echo this should go from dos to msys: -# prior='D:\bogart\dongle' -# latter=$(dos_to_msys_path "$prior") -# echo went from $prior to $latter +#### switches from an X:/ form to an /X/path form. +###function dos_to_msys_path() { +### # we always remove dos slashes in favor of forward slashes. +### echo "$1" | sed -e 's/\\/\//g' | sed -e 's/\([a-zA-Z]\):\/\(.*\)/\/\1\/\2/' +###} ############## @@ -92,12 +83,12 @@ else #echo bashed version buildscriptsdir is $BUILD_SCRIPTS_DIR fi BUILD_SCRIPTS_DIR="$(cd $(echo $BUILD_SCRIPTS_DIR | tr '\\\\' '/' ); \pwd)" -#echo ">> buildscriptsdir is $BUILD_SCRIPTS_DIR" +echo ">> buildvars buildscriptsdir is $BUILD_SCRIPTS_DIR" # figure out the other paths based on where we found this script. export BUILDING_HIERARCHY="$(echo "$BUILD_SCRIPTS_DIR" | sed -e 's/\(.*\)\/[^\/]*/\1/')" export CLAM_DIR="$(cd $BUILD_SCRIPTS_DIR/../clam ; \pwd)" -#echo ">> clamdir is $CLAM_DIR" +echo ">> buildvars clamdir is $CLAM_DIR" # synonym to make other builds happy. export BUILDER_DIR="$BUILDING_HIERARCHY" @@ -179,85 +170,95 @@ function make() # test out our computed variables to make sure they look right. pushd / &>/dev/null # jump to the root so relative paths are caught. +# flag for whether any checks have failed. +got_bad= + # first the scripts directory; do we find this script there? if [ ! -f "$BUILD_SCRIPTS_DIR/$THIS_TOOL_NAME" ]; then echo "This script cannot locate the proper build folders. The crucial path" echo "variable seems to be '$BUILD_SCRIPTS_DIR', which" echo "does not seem to contain '$THIS_TOOL_NAME' (this" echo "script's apparent name)." + got_bad=1 fi # next the clam directory; is the main variables file present there? -if [ ! -f "$CLAM_DIR/variables.def" ]; then +if [ -z "$got_bad" -a ! -f "$CLAM_DIR/variables.def" ]; then echo "The clam directory could not be located under our build tools hierarchy." echo "Please examine the configuration and make sure that this script is in a" echo "directory that resides at the same height as the 'clam' directory." + got_bad=1 fi # now compute some more paths with a bit of "heuristics" for where we can # find the source code. export TOOL_SOURCES="$FEISTY_MEOW_DIR/nucleus/tools" -if [ ! -d "$TOOL_SOURCES/dependency_tool" -o ! -d "$TOOL_SOURCES/clam_tools" ]; then - if [ ! -d "$TOOL_SOURCES/dependency_tool" -o ! -d "$TOOL_SOURCES/clam_tools" ]; then - echo "This script cannot locate the tool source code folder. This is where the" - echo "dependency_tool and clam_tools folders are expected to be." - fi -fi - -# where we store the binaries used for building the rest of the code base. -export BINARY_DIR="$PRODUCTION_DIR/clam_bin" - # the final destination for the new binaries which provide the hoople - # build with all the apps it needs to get going. -export TARGETS_DIR="$PRODUCTION_DIR/binaries" - # targets directory is meaningful to clam, which will use it for output. -export INTERMEDIATE_EXE_DIR="$TARGETS_DIR" - # where we are building the apps before they get promoted. - -export WASTE_DIR="$PRODUCTION_DIR/waste" -if [ ! -d "$WASTE_DIR" ]; then - mkdir -p "$WASTE_DIR" -fi -export TEMPORARIES_DIR="$WASTE_DIR/temporaries" -if [ ! -d "$TEMPORARIES_DIR" ]; then - mkdir -p "$TEMPORARIES_DIR" +if [ -z "$got_bad" -a ! -d "$TOOL_SOURCES/dependency_tool" -o ! -d "$TOOL_SOURCES/clam_tools" ]; then + echo "This script cannot locate the tool source code folder. This is where the" + echo "dependency_tool and clam_tools folders are expected to be." + got_bad=1 fi -# calculate which build ini file to use. -export BUILD_PARAMETER_FILE="$PRODUCTION_DIR/feisty_meow_config.ini" -if [ ! -f "$BUILD_PARAMETER_FILE" ]; then - echo "Cannot find a useful build configuration file." -fi - -# pick the executable's file ending based on the platform. -if [ "$OPERATING_SYSTEM" == "UNIX" ]; then export EXE_ENDING=; -elif [ "$OPERATING_SYSTEM" == "WIN32" ]; then export EXE_ENDING=.exe; -else - echo "The OPERATING_SYSTEM variable is unset or unknown. Bailing out." -fi - -# we should have established our internal variables now, so let's try -# using them. -export PATH=$BINARY_DIR:$PATH - -# load up the helper variables for visual studio on winders. -if [ "$OPERATING_SYSTEM" == "WIN32" ]; then - source "$BUILD_SCRIPTS_DIR/vis_stu_vars.sh" -else - export LD_LIBRARY_PATH="$TARGETS_DIR" -fi - -popd &>/dev/null # checking is over, jump back to the starting point. - -############################################################################ - -# at this point, all the build related variables should be valid. +############################ + +# we only run the rest of the script if we know we didn't have some kind of +# bad thing happen earlier. +if [ -z "$got_bad" ]; then + + # where we store the binaries used for building the rest of the code base. + export BINARY_DIR="$PRODUCTION_DIR/clam_bin" + # the final destination for the new binaries which provide the hoople + # build with all the apps it needs to get going. + export TARGETS_DIR="$PRODUCTION_DIR/binaries" + # targets directory is meaningful to clam, which will use it for output. + export INTERMEDIATE_EXE_DIR="$TARGETS_DIR" + # where we are building the apps before they get promoted. + + export WASTE_DIR="$PRODUCTION_DIR/waste" + if [ ! -d "$WASTE_DIR" ]; then + mkdir -p "$WASTE_DIR" + fi + export TEMPORARIES_DIR="$WASTE_DIR/temporaries" + if [ ! -d "$TEMPORARIES_DIR" ]; then + mkdir -p "$TEMPORARIES_DIR" + fi + + # calculate which build ini file to use. + export BUILD_PARAMETER_FILE="$PRODUCTION_DIR/feisty_meow_config.ini" + if [ ! -f "$BUILD_PARAMETER_FILE" ]; then + echo "Cannot find a useful build configuration file." + fi + + # pick the executable's file ending based on the platform. + if [ "$OPERATING_SYSTEM" == "UNIX" ]; then export EXE_ENDING=; + elif [ "$OPERATING_SYSTEM" == "WIN32" ]; then export EXE_ENDING=.exe; + else + echo "The OPERATING_SYSTEM variable is unset or unknown. Bailing out." + fi + + # we should have established our internal variables now, so let's try + # using them. + export PATH=$BINARY_DIR:$PATH + + # load up the helper variables for visual studio on winders. + if [ "$OPERATING_SYSTEM" == "WIN32" ]; then + source "$BUILD_SCRIPTS_DIR/vis_stu_vars.sh" + else + export LD_LIBRARY_PATH="$TARGETS_DIR" + fi + + popd &>/dev/null # checking is over, jump back to the starting point. + + ############################ + + # at this point, all the build related variables should be valid. + + if [ -z "$INCLUDED_FROM_BOOTSTRAP" \ + -a -z "$PARM_1" ]; then + # we are running as a stand-alone script, so we stay resident with our + # current set of variables. + bash + fi -if [ -z "$INCLUDED_FROM_BOOTSTRAP" \ - -a -z "$PARM_1" ]; then - # we are running as a stand-alone script, so we stay resident with our - # current set of variables. - bash fi -############################################################################ - -- 2.34.1