still tracking rogue chmods
[feisty_meow.git] / scripts / generator / produce_feisty_meow.sh
index cd5ed651fa89af1d20987eda530741c467850f9e..dbecd2637009bd8a0182397b5e9f7402f7e1f013 100644 (file)
@@ -30,15 +30,15 @@ export PATH=/bin:$PATH
 export INCLUDED_FROM_BOOTSTRAP=true
 
 # pull in our build variables using the path to this script.
-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 scripts dir after chewing: $BUILD_SCRIPTS_DIR
+export BUILD_SCRIPTS_PATH="$( \cd "$(\dirname "$0")" && /bin/pwd )"
+#echo build scripts dir initial value: $BUILD_SCRIPTS_PATH
+BUILD_SCRIPTS_PATH="$(echo $BUILD_SCRIPTS_PATH | tr '\\\\' '/' )"
+#echo build scripts dir after chewing: $BUILD_SCRIPTS_PATH
 
 # load in feisty meow basic scripts, if not already loaded.
 if [ -z "$FEISTY_MEOW_SCRIPTS_LOADED" ]; then
-  bash "$BUILD_SCRIPTS_DIR/../core/reconfigure_feisty_meow.sh"
-  source "$BUILD_SCRIPTS_DIR/../core/launch_feisty_meow.sh"
+  bash "$BUILD_SCRIPTS_PATH/../core/reconfigure_feisty_meow.sh"
+  source "$BUILD_SCRIPTS_PATH/../core/launch_feisty_meow.sh"
 fi
 
 source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
@@ -48,7 +48,7 @@ source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
 export FEISTY_MEOW_APEX="$(unix_to_dos_path $FEISTY_MEOW_APEX)"
 
 # load in build variables based on our deduced paths.
-source "$BUILD_SCRIPTS_DIR/build_variables.sh" "$BUILD_SCRIPTS_DIR/build_variables.sh"
+source "$BUILD_SCRIPTS_PATH/build_variables.sh" "$BUILD_SCRIPTS_PATH/build_variables.sh"
 
 ##############
 
@@ -56,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 "$CLAM_BINARY_DIR" ]; then
-    echo "creating binary dir now in $CLAM_BINARY_DIR"
-    mkdir -p "$CLAM_BINARY_DIR"
+  if [ ! -d "$CLAM_BINARIES" ]; then
+    echo "creating binary dir now in $CLAM_BINARIES"
+    mkdir -p "$CLAM_BINARIES"
   fi
-  if [ ! -f "$CLAM_BINARY_DIR/paths.ini" ]; then
+  if [ ! -f "$CLAM_BINARIES/paths.ini" ]; then
     echo "copied paths.ini to binary dir."
-    cp "$PRODUCTION_DIR/paths.ini" "$CLAM_BINARY_DIR"
+    cp "$PRODUCTION_STORE/paths.ini" "$CLAM_BINARIES"
   fi
 }
 
@@ -94,7 +94,7 @@ export BOOT_STRAPPING=true
 declare -a BUILD_DEFAULTS=( "BOOT_STRAPPING=t" "OPTIMIZE=t" "REBUILD=t" "DEBUG=" )
   # bootstrapping is always turned on for this particular script.
   # we also always optimize these builds and turn off the debug flag.
-  # rebuild ensures that the new apps are made fresh: "REBUILD=t"
+  # rebuild ensures that the new applications are made fresh: "REBUILD=t"
   #   it can be turned off when the build bootstrapper is being tested.
   # noisy can be added to spew lots of text: "NOISY=t"
   #   this can help with compilation issues by showing all the flags.
@@ -112,10 +112,10 @@ function make_code {
 function strip_cr {
   ctrl_m=$'\015'
   for i in $*; do
-    tempgrep="$(mktemp "$TEMPORARIES_DIR/tempgrep.XXXXXX")"
+    tempgrep="$(mktemp "$TEMPORARIES_PILE/tempgrep.XXXXXX")"
     grep -l "$ctrl_m" "$i" >$tempgrep
     if [ ! -z "$(cat $tempgrep)" ]; then
-      temp="$(mktemp "$TEMPORARIES_DIR/tempsed.XXXXXX")"
+      temp="$(mktemp "$TEMPORARIES_PILE/tempsed.XXXXXX")"
       sed -e "s/$ctrl_m$//" <$i >$temp
       mv -f $temp $i
     fi
@@ -132,24 +132,24 @@ if [ "$OPERATING_SYSTEM" = "UNIX" ]; then
   function promote {
     prepare_binaries_dir
 
-    if [ ! -f "$INTERMEDIATE_EXE_DIR/$1" ]; then
+    if [ ! -f "$INTERMEDIATE_STORE/$1" ]; then
       echo "Failed to build the application $1--quitting now."
       exit 1892
     fi
-    cp "$INTERMEDIATE_EXE_DIR/$1" "$CLAM_BINARY_DIR/$1"
-    strip "$CLAM_BINARY_DIR/$1"
-    chmod 755 "$CLAM_BINARY_DIR/$1"
+    cp "$INTERMEDIATE_STORE/$1" "$CLAM_BINARIES/$1"
+    strip "$CLAM_BINARIES/$1"
+    chmod 755 "$CLAM_BINARIES/$1"
   }
 elif [ "$OPERATING_SYSTEM" = "WIN32" ]; then
   function promote {
     prepare_binaries_dir
 
-    if [ ! -f "$INTERMEDIATE_EXE_DIR/$1.exe" ]; then
+    if [ ! -f "$INTERMEDIATE_STORE/$1.exe" ]; then
       echo "Failed to build the application $1.exe--quitting now."
       exit 1892
     fi
-    cp "$INTERMEDIATE_EXE_DIR/$1.exe" "$CLAM_BINARY_DIR"
-    chmod 755 "$CLAM_BINARY_DIR/$1.exe"
+    cp "$INTERMEDIATE_STORE/$1.exe" "$CLAM_BINARIES"
+    chmod 755 "$CLAM_BINARIES/$1.exe"
   }
 else
   echo "The OPERATING_SYSTEM variable is unset or unknown.  Bailing out."
@@ -161,37 +161,39 @@ 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"
+source "$BUILD_SCRIPTS_PATH/build_variables.sh" "$BUILD_SCRIPTS_PATH/build_variables.sh"
 
 # clean out any current contents.
-bash "$BUILD_SCRIPTS_DIR/whack_build.sh" clean
+bash "$BUILD_SCRIPTS_PATH/whack_build.sh" clean
 
 # make this again so no one gets cranky.
-mkdir -p "$LOGS_DIR"
+mkdir -p "$FEISTY_MEOW_LOGS"
 
 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="$CLAM_BINARY_DIR/$i$EXE_ENDING"
+    whack_name="$CLAM_BINARIES/$i$EXE_ENDING"
 #echo removing "$whack_name"
     rm -f "$whack_name"
   done
 fi
 
 # make the clam shell scripts executable.
-chmod 755 "$CLAM_DIR"/*.sh
-chmod 755 "$CLAM_DIR"/cpp/*.sh
-#chmod 755 "$CLAM_DIR"/csharp/*.sh
-chmod 755 "$FEISTY_MEOW_SCRIPTS/generator/wrapdoze.sh"
+#hmmm: why?  this should no longer be needed.
+#      and even if it's needed, the perms should be stored in the repo.
+#chmod 755 "$CLAM_SCRIPTS"/*.sh
+#chmod 755 "$CLAM_SCRIPTS"/cpp/*.sh
+#chmod 755 "$CLAM_SCRIPTS"/csharp/*.sh
+#chmod 755 "$FEISTY_MEOW_SCRIPTS/generator/wrapdoze.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 "$CLAM_BINARY_DIR/makedep$EXE_ENDING" ]; then
+if [ ! -f "$CLAM_BINARIES/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
-  if [ ! -f "$INTERMEDIATE_EXE_DIR/makedep$EXE_ENDING" ]; then
+  if [ ! -f "$INTERMEDIATE_STORE/makedep$EXE_ENDING" ]; then
     echo ""
     echo ""
     echo "The build of the makedep tool has failed.  Unknown causes...  Argh."
@@ -203,18 +205,18 @@ if [ ! -f "$CLAM_BINARY_DIR/makedep$EXE_ENDING" ]; then
   popd &>/dev/null
 fi
 
-# rebuild the version tools and other support apps.
-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
+# rebuild the version tools and other support applications.
+if [ ! -f "$CLAM_BINARIES/value_tagger$EXE_ENDING" \
+    -o ! -f "$CLAM_BINARIES/version_stamper$EXE_ENDING" \
+    -o ! -f "$CLAM_BINARIES/vsts_version_fixer$EXE_ENDING" \
+    -o ! -f "$CLAM_BINARIES/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
 
-#hmmm: really this should check all the expected apps.
+#hmmm: really this should check all the expected applications.
 #      nice to just have an array of the things built by this guy.
-  if [ ! -f "$INTERMEDIATE_EXE_DIR/version_stamper$EXE_ENDING" ]; then
+  if [ ! -f "$INTERMEDIATE_STORE/version_stamper$EXE_ENDING" ]; then
     echo ""
     echo ""
     echo "The build of the version_stamper tool has failed.  Unknown causes...  Argh."
@@ -231,11 +233,11 @@ if [ ! -f "$CLAM_BINARY_DIR/value_tagger$EXE_ENDING" \
 fi
 
 # build a few other utilities.
-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
+if [ ! -f "$CLAM_BINARIES/short_path$EXE_ENDING" \
+    -o ! -f "$CLAM_BINARIES/sleep_ms$EXE_ENDING" \
+    -o ! -f "$CLAM_BINARIES/create_guid$EXE_ENDING" \
+    -o ! -f "$CLAM_BINARIES/zap_process$EXE_ENDING" \
+    -o ! -f "$CLAM_BINARIES/playsound$EXE_ENDING" ]; then
   pushd "$TOOL_SOURCES/simple_utilities" &>/dev/null
   make_code pre_compilation OMIT_VERSIONS=t
   make_code OMIT_VERSIONS=t
@@ -254,13 +256,13 @@ echo "The build binaries have been re-created (or were already present)."
 # we won't do the full build if they told us to just do the bootstrap.
 if [ -z "$JUST_BOOTSTRAP_APPS" ]; then
   echo Cleaning up the temporary files that were built.
-  bash "$BUILD_SCRIPTS_DIR/whack_build.sh" 
+  bash "$BUILD_SCRIPTS_PATH/whack_build.sh" 
 #wrong!  we don't want to whack it all. clean
 
   # recreate our useful junk directories...
-  mkdir -p "$GENERATED_DIR"
-  mkdir -p "$TEMPORARIES_DIR"
-  mkdir -p "$LOGS_DIR"
+  mkdir -p "$FEISTY_MEOW_GENERATED_STORE"
+  mkdir -p "$TEMPORARIES_PILE"
+  mkdir -p "$FEISTY_MEOW_LOGS"
 
   echo Now starting a normal build of the repository source code.
   pushd "$FEISTY_MEOW_APEX" &>/dev/null