X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Fgenerator%2Fbuild_variables.sh;h=2a30e2dce56e4b02b55d43e4d16a048b0eea0125;hb=d87617f212d9dff8d5033b81e19a0740846999fe;hp=c5ce03b7122d7f30672f038d521435c9f807b6c9;hpb=e007e9f6d615ec4ab3649d570b09c39fbedd11a5;p=feisty_meow.git diff --git a/scripts/generator/build_variables.sh b/scripts/generator/build_variables.sh index c5ce03b7..2a30e2dc 100644 --- a/scripts/generator/build_variables.sh +++ b/scripts/generator/build_variables.sh @@ -32,13 +32,6 @@ # Please send any updates to: fred@gruntose.com ############## -# prerequisites for this script: -# -# (1) the script should be run with a full path, so that it can decide where -# it lives with minimal fuss. -# (2) on windows, the msys bin directory should already be in the path so that -# tools like dirname are already available. - # here is where we compute the locations for the build's pieces, based on # where this script is located. we currently assume that the build scripts # like this one are at the same height in the hierarchy as the clam scripts @@ -54,51 +47,30 @@ PARM_1="$1" # helpful build function zone. source $FEISTY_MEOW_SCRIPTS/core/functions.sh - # load msys_to_dos_path and dos_to_msys_path. - -#### 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/' -###} - -#### 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/' -###} ############## +# outer check on whether this already was run or not. +if [ -z "$BUILD_VARS_LOADED" ]; then + # perform some calculations to get the right paths from our parameters. if [ ! -z "$PARM_1" ]; then # use the first real parameter since this is probably the 'source' version. export BUILD_SCRIPTS_DIR="$(dirname "$PARM_1")" THIS_TOOL_NAME="$(basename "$PARM_1")" -echo ==sourced version buildscriptsdir is $BUILD_SCRIPTS_DIR else # use the zeroth parameter, since we know nothing more about our name. export BUILD_SCRIPTS_DIR="$(dirname "$PARM_0")" THIS_TOOL_NAME="$(basename "$PARM_0")" -echo ==bashed version buildscriptsdir is $BUILD_SCRIPTS_DIR fi BUILD_SCRIPTS_DIR="$(cd $(echo $BUILD_SCRIPTS_DIR | tr '\\\\' '/' ); \pwd)" -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 "==buildvars clamdir is $CLAM_DIR" # synonym to make other builds happy. export BUILDER_DIR="$BUILDING_HIERARCHY" -# guess the current platform. -IS_UNIX=$(uname | grep -i linux) -if [ -z "$IS_UNIX" ]; then IS_UNIX=$(uname | grep -i unix); fi -if [ -z "$IS_UNIX" ]; then IS_UNIX=$(uname | grep -i darwin); fi -IS_DOS=$(uname | grep -i ming) -if [ -z "$IS_DOS" ]; then IS_DOS=$(uname | grep -i cygwin); fi - # set some clam parameters for compilation. if the script can't guess the # right configuration, then you will need to set them in the last 'else' # below. @@ -112,58 +84,58 @@ if [ ! -z "$SHELL_DEBUG" ]; then echo "[OS is \"$OPERATING_SYSTEM\"]" fi -#hmmm: all this stuff is highly questionable value now. -# we create the variable FEISTY_MEOW_DIR, but we keep the dos form of -# the path, because otherwise lots of bad things happens when passing the -# folders around to visual studio commands that don't allow a space after them. -if [ -d "$BUILDING_HIERARCHY/source" ]; then - # old style repository is same height as building hierarchy. - export FEISTY_MEOW_DIR="$BUILDING_HIERARCHY" -else - # new style repository is a level above the build hierarchy. - export FEISTY_MEOW_DIR="$(echo "$BUILDING_HIERARCHY" | sed -e 's/\(.*\)\/[^\/]*/\1/')" -fi - -if [ "$OPERATING_SYSTEM" = "WIN32" ]; then - # make sure repository dir looks right on windoze. - export FEISTY_MEOW_DIR="$(msys_to_dos_path "$FEISTY_MEOW_DIR")" -fi - if [ ! -z "$SHELL_DEBUG" ]; then - echo "[FEISTY_MEOW_DIR is $FEISTY_MEOW_DIR]" + echo "[FEISTY_MEOW_APEX is $FEISTY_MEOW_APEX]" fi +#if [ "$OPERATING_SYSTEM" == "WIN32" ]; then +# # harsh on the paths and make them use backwards slashes. +# export SERIOUS_SLASH_TREATMENT=true +#fi + # new BUILD_TOP variable points at the utter top-most level of any files # in the building hierarchy. -export BUILD_TOP="$FEISTY_MEOW_DIR" +export BUILD_TOP="$FEISTY_MEOW_APEX" -# this variable points at a folder where we store most of the generated products -# of the build. these tend to be the things that will be used for packaging into -# different types of products. +# the production directory is the location for all the scripts and setup +# code needed to produce the executables for feisty meow. export PRODUCTION_DIR="$BUILD_TOP/production" +## set up the top-level for all build creations and logs and such. +#export GENERATED_DIR="$TMP/generated-feisty_meow" +#if [ ! -d "$GENERATED_DIR" ]; then +# mkdir -p "$GENERATED_DIR" +#fi +## set up our effluent outsourcing valves. +#export TEMPORARIES_DIR="$GENERATED_DIR/temporaries" +#if [ ! -d "$TEMPORARIES_DIR" ]; then +# mkdir -p "$TEMPORARIES_DIR" +#fi + +# this variable points at a folder where we store the generated products of +# the build, such as the binaries and installer packages. +export RUNTIME_DIR="$GENERATED_DIR/runtime" +if [ ! -d "$RUNTIME_DIR" ]; then + mkdir -p "$RUNTIME_DIR" +fi + # we define a log file storage area that can be relied on by the build. -export LOGS_DIR="$PRODUCTION_DIR/logs" +export LOGS_DIR="$GENERATED_DIR/logs" if [ ! -d "$LOGS_DIR" ]; then mkdir -p "$LOGS_DIR" fi -# hook clam into the compilation system. -function make() -{ - /usr/bin/make -I "$CLAM_DIR" $* -} - ############## # debugging area where we say what we think we know. -#echo scripts: $BUILD_SCRIPTS_DIR -#echo build tools hier: $BUILDING_HIERARCHY -#echo this tool: $THIS_TOOL_NAME -#echo repository: $FEISTY_MEOW_DIR -#echo clam: $CLAM_DIR -#echo makeflags: $MAKEFLAGS +if [ ! -z "$SHELL_DEBUG" ]; then + echo scripts: $BUILD_SCRIPTS_DIR + echo build tools hier: $BUILDING_HIERARCHY + echo this tool: $THIS_TOOL_NAME + echo repository: $FEISTY_MEOW_APEX + echo clam: $CLAM_DIR +fi ############## @@ -192,8 +164,7 @@ 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" -echo "==tool source is $TOOL_SOURCES" +export TOOL_SOURCES="$FEISTY_MEOW_APEX/nucleus/tools" 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." @@ -207,23 +178,15 @@ fi 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" + export CLAM_BINARY_DIR="$RUNTIME_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" + export TARGETS_DIR="$RUNTIME_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 - +#hmmm: could allow override on this if already set. # calculate which build ini file to use. export BUILD_PARAMETER_FILE="$PRODUCTION_DIR/feisty_meow_config.ini" if [ ! -f "$BUILD_PARAMETER_FILE" ]; then @@ -239,7 +202,7 @@ if [ -z "$got_bad" ]; then # we should have established our internal variables now, so let's try # using them. - export PATH=$BINARY_DIR:$PATH + export PATH=$(dos_to_unix_path $CLAM_BINARY_DIR):$PATH # load up the helper variables for visual studio on winders. if [ "$OPERATING_SYSTEM" == "WIN32" ]; then @@ -261,5 +224,20 @@ if [ -z "$got_bad" ]; then bash fi + # sentinel that tells us this script was pulled in. + export BUILD_VARS_LOADED=true + fi +fi # outer wrapper for already ran build vars check. + +############## + +# hook clam into the compilation system. +# this always needs to be defined since functions aren't exported. +function make() +{ + /usr/bin/make -I "$CLAM_DIR" $* +} + +