a ton of changes to fix the production directory. formerly this directory $FEISTY_ME...
[feisty_meow.git] / scripts / generator / bootstrap_build.sh
index 5a07d9bc183c3aef4331d87e2e4f8fc193c02a35..7a9e08c1fe57b951a79f1e851763a2f2381d4040 100644 (file)
 #
 # (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.
+# (2) on windows, the unix tools bin directory should already be in the path
+#     so that tools like dirname are already available.  use msys or cygwin
+#     at your discretion and your own risk.
 
 # make sure we know how to find our bash bins.
 export PATH=/bin:$PATH
+
 # signals that we're doing a fresh build to the variables script.
 export INCLUDED_FROM_BOOTSTRAP=true
+
 # pull in our build variables using the path to this script.
-export BUILD_SCRIPTS_DIR="$( \cd "$(\dirname "$0")" && \pwd )"
-echo build script initial from bootstrap: $BUILD_SCRIPTS_DIR
+export BUILD_SCRIPTS_DIR="$( \cd "$(\dirname "$0")" && /bin/pwd )"
+#echo build scripts dir initial value: $BUILD_SCRIPTS_DIR
 BUILD_SCRIPTS_DIR="$(echo $BUILD_SCRIPTS_DIR | tr '\\\\' '/' )"
-echo build script after: $BUILD_SCRIPTS_DIR
+#echo build scripts dir after chewing: $BUILD_SCRIPTS_DIR
+
 # load in feisty meow basic scripts, if not already loaded.
-source "$BUILD_SCRIPTS_DIR/../core/profile.sh"
-# drop any previous version of the repository variable.
-unset REPOSITORY_DIR
+if [ -z "$FEISTY_MEOW_SCRIPTS_LOADED" ]; then
+  bash "$BUILD_SCRIPTS_DIR/../core/bootstrap_shells.sh"
+  source "$BUILD_SCRIPTS_DIR/../core/launch_feisty_meow.sh"
+fi
+
+source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
+
+# translate to dos format if there's a cygdrive in there; otherwise microsoft's tools
+# will hose up completely due to unknown paths.
+export FEISTY_MEOW_DIR="$(unix_to_dos_path $FEISTY_MEOW_DIR)"
+
+# load in build variables based on our deduced paths.
 source "$BUILD_SCRIPTS_DIR/build_variables.sh" "$BUILD_SCRIPTS_DIR/build_variables.sh"
 
 ##############
@@ -43,13 +56,13 @@ source "$BUILD_SCRIPTS_DIR/build_variables.sh" "$BUILD_SCRIPTS_DIR/build_variabl
 function prepare_binaries_dir()
 {
   # we'll store binaries here from the bootstrap process.
-  if [ ! -d "$BINARY_DIR" ]; then
-    echo "creating binary dir now in $BINARY_DIR"
-    mkdir "$BINARY_DIR"
+  if [ ! -d "$CLAM_BINARY_DIR" ]; then
+    echo "creating binary dir now in $CLAM_BINARY_DIR"
+    mkdir "$CLAM_BINARY_DIR"
   fi
-  if [ ! -f "$BINARY_DIR/paths.ini" ]; then
+  if [ ! -f "$CLAM_BINARY_DIR/paths.ini" ]; then
     echo "copied paths.ini to binary dir."
-    cp "$PRODUCTION_DIR/paths.ini" "$BINARY_DIR"
+    cp "$PRODUCTION_DIR/paths.ini" "$CLAM_BINARY_DIR"
   fi
 }
 
@@ -65,6 +78,7 @@ echo "Build bootstrap process has started."
 
 # preconditions for the build process...
 
+# set up our output directories etc.
 prepare_binaries_dir
 
 # set a flag for this process so we can omit certain compilations as necessary.
@@ -122,9 +136,9 @@ if [ "$OPERATING_SYSTEM" = "UNIX" ]; then
       echo "Failed to build the application $1--quitting now."
       exit 1892
     fi
-    cp "$INTERMEDIATE_EXE_DIR/$1" "$BINARY_DIR/$1"
-    strip "$BINARY_DIR/$1"
-    chmod 755 "$BINARY_DIR/$1"
+    cp "$INTERMEDIATE_EXE_DIR/$1" "$CLAM_BINARY_DIR/$1"
+    strip "$CLAM_BINARY_DIR/$1"
+    chmod 755 "$CLAM_BINARY_DIR/$1"
   }
 elif [ "$OPERATING_SYSTEM" = "WIN32" ]; then
   function promote {
@@ -134,8 +148,8 @@ elif [ "$OPERATING_SYSTEM" = "WIN32" ]; then
       echo "Failed to build the application $1.exe--quitting now."
       exit 1892
     fi
-    cp "$INTERMEDIATE_EXE_DIR/$1.exe" "$BINARY_DIR"
-    chmod 755 "$BINARY_DIR/$1.exe"
+    cp "$INTERMEDIATE_EXE_DIR/$1.exe" "$CLAM_BINARY_DIR"
+    chmod 755 "$CLAM_BINARY_DIR/$1.exe"
   }
 else
   echo "The OPERATING_SYSTEM variable is unset or unknown.  Bailing out."
@@ -146,17 +160,20 @@ fi
 
 # start the actual build process now...
 
+# load in the feisty meow building environment.
+source "$BUILD_SCRIPTS_DIR/build_variables.sh" "$BUILD_SCRIPTS_DIR/build_variables.sh"
+
 # clean out any current contents.
 bash "$BUILD_SCRIPTS_DIR/whack_build.sh" clean
 
-# recreate our useful waste directories and other things...
-source "$BUILD_SCRIPTS_DIR/build_variables.sh" "$BUILD_SCRIPTS_DIR/build_variables.sh"
+# make this again so no one gets cranky.
+mkdir -p "$LOGS_DIR"
 
 toolset_names=(makedep value_tagger version_stamper vsts_version_fixer write_build_config short_path sleep_ms zap_process playsound create_guid)
 
 if [ -z "$SAVE_BINARIES" ]; then
   for i in ${toolset_names[*]}; do
-    whack_name="$BINARY_DIR/$i$EXE_ENDING"
+    whack_name="$CLAM_BINARY_DIR/$i$EXE_ENDING"
 #echo removing "$whack_name"
     rm -f "$whack_name"
   done
@@ -169,7 +186,7 @@ chmod 755 "$CLAM_DIR"/cpp/*.sh
 
 # rebuild the dependency tool.  needed by everything, pretty much, but
 # since it's from the xfree project, it doesn't need any of our libraries.
-if [ ! -f "$BINARY_DIR/makedep$EXE_ENDING" ]; then
+if [ ! -f "$CLAM_BINARY_DIR/makedep$EXE_ENDING" ]; then
   pushd "$TOOL_SOURCES/dependency_tool" &>/dev/null
   make_code pre_compilation NO_DEPS=t OMIT_VERSIONS=t
   make_code NO_DEPS=t OMIT_VERSIONS=t
@@ -186,10 +203,10 @@ if [ ! -f "$BINARY_DIR/makedep$EXE_ENDING" ]; then
 fi
 
 # rebuild the version tools and other support apps.
-if [ ! -f "$BINARY_DIR/value_tagger$EXE_ENDING" \
-    -o ! -f "$BINARY_DIR/version_stamper$EXE_ENDING" \
-    -o ! -f "$BINARY_DIR/vsts_version_fixer$EXE_ENDING" \
-    -o ! -f "$BINARY_DIR/write_build_config$EXE_ENDING" ]; then
+if [ ! -f "$CLAM_BINARY_DIR/value_tagger$EXE_ENDING" \
+    -o ! -f "$CLAM_BINARY_DIR/version_stamper$EXE_ENDING" \
+    -o ! -f "$CLAM_BINARY_DIR/vsts_version_fixer$EXE_ENDING" \
+    -o ! -f "$CLAM_BINARY_DIR/write_build_config$EXE_ENDING" ]; then
   pushd "$TOOL_SOURCES/clam_tools" &>/dev/null
   make_code pre_compilation OMIT_VERSIONS=t
   make_code OMIT_VERSIONS=t
@@ -207,17 +224,17 @@ if [ ! -f "$BINARY_DIR/value_tagger$EXE_ENDING" \
   promote value_tagger # tool scrambles through headers to standardize outcomes.
   promote version_stamper  # used for version stamping.
   promote vsts_version_fixer  # used for version stamping.
-  promote write_build_config # creates a header of build-specific config info.
+  promote write_build_config  # creates a header of build-specific config info.
 
   popd &>/dev/null
 fi
 
 # build a few other utilities.
-if [ ! -f "$BINARY_DIR/short_path$EXE_ENDING" \
-    -o ! -f "$BINARY_DIR/sleep_ms$EXE_ENDING" \
-    -o ! -f "$BINARY_DIR/create_guid$EXE_ENDING" \
-    -o ! -f "$BINARY_DIR/zap_process$EXE_ENDING" \
-    -o ! -f "$BINARY_DIR/playsound$EXE_ENDING" ]; then
+if [ ! -f "$CLAM_BINARY_DIR/short_path$EXE_ENDING" \
+    -o ! -f "$CLAM_BINARY_DIR/sleep_ms$EXE_ENDING" \
+    -o ! -f "$CLAM_BINARY_DIR/create_guid$EXE_ENDING" \
+    -o ! -f "$CLAM_BINARY_DIR/zap_process$EXE_ENDING" \
+    -o ! -f "$CLAM_BINARY_DIR/playsound$EXE_ENDING" ]; then
   pushd "$TOOL_SOURCES/simple_utilities" &>/dev/null
   make_code pre_compilation OMIT_VERSIONS=t
   make_code OMIT_VERSIONS=t
@@ -239,15 +256,16 @@ if [ -z "$JUST_BOOTSTRAP_APPS" ]; then
   bash "$BUILD_SCRIPTS_DIR/whack_build.sh" clean
 
   # recreate our useful junk directories...
-  mkdir -p "$WASTE_DIR"
+  mkdir -p "$GENERATED_DIR"
   mkdir -p "$TEMPORARIES_DIR"
+  mkdir -p "$LOGS_DIR"
 
   echo Now starting a normal build of the repository source code.
-  pushd "$REPOSITORY_DIR" &>/dev/null
+  pushd "$FEISTY_MEOW_DIR" &>/dev/null
   unset BUILD_DEFAULTS
   declare -a BUILD_DEFAULTS=( "BOOT_STRAPPING=" "OPTIMIZE=t" "DEBUG=t" "REBUILD=t" )
-  export NOT_SLIMLINE=true
   make_code
+
   popd &>/dev/null
 fi