From b51411a29f1a751a09e69f5676afeea24a94ac83 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Fri, 21 Dec 2012 14:59:32 -0500 Subject: [PATCH] updated to get closer to building using cygwin, which is difficult because cygwin is super uncooperative with certain types of dos paths. --- nucleus/library/algorithms/placeholder.cpp | 3 + nucleus/library/filesystem/byte_filer.cpp | 30 +++---- nucleus/library/filesystem/byte_filer.h | 18 ++-- nucleus/library/filesystem/filename.cpp | 11 +++ nucleus/library/filesystem/filename.h | 3 + nucleus/library/filesystem/huge_file.cpp | 4 +- nucleus/library/versions/version_ini.cpp | 4 +- nucleus/tools/clam_tools/cygwin_fixer.cpp | 83 +++++++++++++++++++ nucleus/tools/clam_tools/makefile | 2 +- nucleus/tools/clam_tools/value_tagger.cpp | 4 +- .../tools/clam_tools/write_build_config.cpp | 6 +- nucleus/tools/dependency_tool/makedep.cpp | 42 +++++++--- scripts/clam/cpp/variables.def | 6 +- scripts/core/bootstrap_shells.sh | 1 + scripts/core/functions.sh | 13 ++- scripts/core/variables.sh | 2 +- scripts/generator/bootstrap_build.sh | 9 +- scripts/generator/build_variables.sh | 12 ++- scripts/generator/vis_stu_vars.sh | 27 +++--- scripts/generator/wrapdoze.sh | 51 ++++++++---- 20 files changed, 238 insertions(+), 93 deletions(-) create mode 100644 nucleus/tools/clam_tools/cygwin_fixer.cpp diff --git a/nucleus/library/algorithms/placeholder.cpp b/nucleus/library/algorithms/placeholder.cpp index 4878eca4..72516564 100644 --- a/nucleus/library/algorithms/placeholder.cpp +++ b/nucleus/library/algorithms/placeholder.cpp @@ -2,3 +2,6 @@ // sole purpose of this is to make the lib be generated, // even though we currently do not have any code that lives inside it. + + +int __private_private_bogus_placeholder_xj27_qx19() { return 32; } diff --git a/nucleus/library/filesystem/byte_filer.cpp b/nucleus/library/filesystem/byte_filer.cpp index 7aa05d78..005b2955 100644 --- a/nucleus/library/filesystem/byte_filer.cpp +++ b/nucleus/library/filesystem/byte_filer.cpp @@ -51,25 +51,25 @@ public: byte_filer::byte_filer() : _handle(new file_hider), - _filename(new astring), + _filename(new filename), _auto_close(true) {} -byte_filer::byte_filer(const astring &filename, const astring &perms) +byte_filer::byte_filer(const astring &fname, const astring &perms) : _handle(new file_hider), - _filename(new astring), + _filename(new filename), _auto_close(true) -{ open(filename, perms); } +{ open(fname, perms); } -byte_filer::byte_filer(const char *filename, const char *perms) +byte_filer::byte_filer(const char *fname, const char *perms) : _handle(new file_hider), - _filename(new astring), + _filename(new filename), _auto_close(true) -{ open(filename, perms); } +{ open(fname, perms); } byte_filer::byte_filer(bool auto_close, void *handle) : _handle(new file_hider), - _filename(new astring), + _filename(new filename), _auto_close(auto_close) { if (handle) { @@ -79,25 +79,25 @@ byte_filer::byte_filer(bool auto_close, void *handle) byte_filer::~byte_filer() { close(); WHACK(_handle); WHACK(_filename); } -astring byte_filer::filename() const { return *_filename; } +astring byte_filer::name() const { return _filename->raw(); } size_t byte_filer::file_size_limit() { return BTFL_FILE_TELL_LIMIT; } -bool byte_filer::open(const astring &filename, const astring &perms) +bool byte_filer::open(const astring &fname, const astring &perms) { close(); _auto_close = true; // reset since we know we're opening this. - *_filename = filename; + _filename->reset(fname); #ifndef __WIN32__ - _handle->fp = filename.t()? fopen(filename.s(), perms.s()) : NIL; + _handle->fp = _filename->raw().t()? fopen(_filename->raw().s(), perms.s()) : NIL; #else - _handle->fp = filename.t()? _wfopen((wchar_t *)(UTF16 *)transcode_to_utf16(filename), + _handle->fp = _filename->raw().t()? _wfopen((wchar_t *)(UTF16 *)transcode_to_utf16(_filename->raw()), (wchar_t *)(UTF16 *)transcode_to_utf16(perms)) : NIL; #ifdef DEBUG_BYTE_FILER if (!_handle->fp) wprintf((wchar_t *)(UTF16 *)transcode_to_utf16("could not open: %ls\n"), - (wchar_t *)(UTF16 *)transcode_to_utf16(filename)); + (wchar_t *)(UTF16 *)transcode_to_utf16(_filename->raw())); #endif #endif @@ -106,7 +106,7 @@ bool byte_filer::open(const astring &filename, const astring &perms) void byte_filer::close() { - *_filename = ""; + _filename->reset(""); if (_auto_close && _handle->fp) fclose(_handle->fp); _handle->fp = NIL; } diff --git a/nucleus/library/filesystem/byte_filer.h b/nucleus/library/filesystem/byte_filer.h index 0e8bca78..34e6379c 100644 --- a/nucleus/library/filesystem/byte_filer.h +++ b/nucleus/library/filesystem/byte_filer.h @@ -19,6 +19,8 @@ #include #include +#include "filename.h" + namespace filesystem { // forward declarations. @@ -33,8 +35,8 @@ public: //!< constructs an object that doesn't access a file yet. /*!< use open() to make the object valid. */ - byte_filer(const basis::astring &filename, const basis::astring &permissions); - //!< opens a file "filename" as specified in "permissions". + byte_filer(const basis::astring &fname, const basis::astring &permissions); + //!< opens a file "fname" as specified in "permissions". /*!< these are identical to the standard I/O permissions: - "r" - opens text file for reading. @@ -47,7 +49,7 @@ public: a "b" can be added to the end of these to indicate a binary file should be used instead of a text file. */ - byte_filer(const char *filename, const char *permissions); + byte_filer(const char *fname, const char *permissions); //!< synonym for above but takes char pointers. byte_filer(bool auto_close, void *opened); @@ -62,16 +64,16 @@ public: //!< returns the maximum size that seek and length can support. /*!< use the huge_file class if you need to exceed the stdio limits. */ - bool open(const basis::astring &filename, const basis::astring &permissions); - //!< opens a file with "filename" and "permissions" as in the constructor. + bool open(const basis::astring &fname, const basis::astring &permissions); + //!< opens a file with "fname" and "permissions" as in the constructor. /*!< if a different file had already been opened, it is closed. */ void close(); //!< shuts down the open file, if any. /*!< open() will have to be invoked before this object can be used again. */ - basis::astring filename() const; - //!< returns the filename that this was opened with. + basis::astring name() const; + //!< returns the file name that the object is operating on. bool good(); //!< returns true if the file seems to be in the appropriate desired state. @@ -145,7 +147,7 @@ public: private: file_hider *_handle; //!< the standard I/O support that we rely upon. - basis::astring *_filename; //!< holds onto our current filename. + filename *_filename; //!< holds onto our current filename. bool _auto_close; //!< true if the object should close the file. // not to be called. diff --git a/nucleus/library/filesystem/filename.cpp b/nucleus/library/filesystem/filename.cpp index a77035ba..4ea4269a 100644 --- a/nucleus/library/filesystem/filename.cpp +++ b/nucleus/library/filesystem/filename.cpp @@ -100,6 +100,12 @@ bool filename::good() const { return exists(); } bool filename::unlink() const { return ::unlink(observe()) == 0; } +void filename::reset(const astring &name) { + *this = name; + _had_directory = true; // until we know better. + canonicalize(); +} + astring filename::null_device() { #ifdef __WIN32__ @@ -309,10 +315,15 @@ bool filename::is_normal() const status_info fill; if (!get_info(&fill)) return false; +#if defined(__WIN32__) || defined(__VMS__) +//hmmm: is there a corresponding set of functions for windows, where applicable? + bool weird = false; +#else bool weird = S_ISCHR(fill.st_mode) || S_ISBLK(fill.st_mode) || S_ISFIFO(fill.st_mode) || S_ISSOCK(fill.st_mode); +#endif return !weird; } diff --git a/nucleus/library/filesystem/filename.h b/nucleus/library/filesystem/filename.h index 940b6c03..f609f901 100644 --- a/nucleus/library/filesystem/filename.h +++ b/nucleus/library/filesystem/filename.h @@ -63,6 +63,9 @@ public: /*!< this means that not only was the pathname parsed and found valid, but the file actually exists. */ + void reset(const basis::astring &name); + //!< changes the file name held by the object. + const basis::astring &raw() const; //!< returns the astring that we're holding onto for the path. basis::astring &raw(); diff --git a/nucleus/library/filesystem/huge_file.cpp b/nucleus/library/filesystem/huge_file.cpp index acf9adc7..33b4672a 100644 --- a/nucleus/library/filesystem/huge_file.cpp +++ b/nucleus/library/filesystem/huge_file.cpp @@ -124,7 +124,7 @@ double huge_file::length() // something malfunctioned. we should always be able to get back to // the last good size we found if the file is static. LOG(a_sprintf("failed to seek back to best highest %.0f on ", - best_highest) + _real_file->filename()); + best_highest) + _real_file->name()); // try to repair our ideas about the file by starting the process // over. //hmmm: count the number of times restarted and bail after N. @@ -134,7 +134,7 @@ double huge_file::length() // the heck with this. we can't even go back to the start. this // file seems to be screwed up now. LOG(astring("failed to seek back to start of file! on ") - + _real_file->filename()); + + _real_file->name()); return 0; } // reset the rest of the positions for our failed attempt to return diff --git a/nucleus/library/versions/version_ini.cpp b/nucleus/library/versions/version_ini.cpp index 40d0d3c3..6a5519e1 100644 --- a/nucleus/library/versions/version_ini.cpp +++ b/nucleus/library/versions/version_ini.cpp @@ -519,8 +519,8 @@ bool version_ini::write_assembly(const version_record &to_write, modfile.truncate(); // chop off anything left from previous versions. if (do_logging) { // let the people know about this... - filename dirbase = filename(modfile.filename()).dirname().basename(); - filename just_base = filename(modfile.filename()).basename(); + filename dirbase = filename(modfile.name()).dirname().basename(); + filename just_base = filename(modfile.name()).basename(); program_wide_logger::get().log(astring(" patching: ") + dirbase + "/" + just_base, basis::ALWAYS_PRINT); } diff --git a/nucleus/tools/clam_tools/cygwin_fixer.cpp b/nucleus/tools/clam_tools/cygwin_fixer.cpp new file mode 100644 index 00000000..2f4eb1c8 --- /dev/null +++ b/nucleus/tools/clam_tools/cygwin_fixer.cpp @@ -0,0 +1,83 @@ +//need header here. + +// make ms be quiet about strncat. +#define _CRT_SECURE_NO_WARNINGS + +#ifdef _MSC_VER +#include +#else +#include +#endif +#include +#include +#include + +// turns the cygwin name format into a usable windos filename. +char *translate_cygwin(char *fname) +{ + int oldlen = strlen(fname); + if (!strncmp(fname, "/cygdrive/", 10) && (oldlen > 10) ) { + // in the first case the filename has /cygdrive in it, right at the front. + char *newprefix = (char *)malloc(oldlen); + // build the drive letter first. + newprefix[0] = fname[10]; + newprefix[1] = ':'; + newprefix[2] = '\0'; + // concatenate the filename without cygdrive in it. + strncat(newprefix, fname + 11, oldlen - 11 + 1); // one extra for null char. + return newprefix; // mem leak here; cannot be helped for quick fix using functional style. + } else if ( (fname[0] == '-') && (oldlen > 12) + && (!strncmp(fname + 2, "/cygdrive/", 10) ) { + // in the second case we are looking for command line options. this code handles a parameter + // that starts with a single dash and has a single flag character after that. + char *newprefix = (char *)malloc(oldlen); + newprefix[0] = fname[0]; + newprefix[1] = fname[1]; + newprefix[2] = fname[12]; + newprefix[3] = ':'; + newprefix[4] = '\0'; + // now concatenate the useful filename portion, offset by the flag found. + strncat(newprefix, fname + 13, oldlen - 13 + 1); // one extra for null char. + return newprefix; + } else { + return fname; + } +} + + +function dossify_and_run_commands() +{ + declare -a darc_commands=() + + for i in "$@"; do + # we only mess with the command line on windows. + if [ "$OS" == "Windows_NT" ]; then + if [[ "$i" =~ ^-[a-zA-z][/\"].* ]]; then +#echo matched on our pattern for parameters + flag="${i:0:2}" + filename="$(unix_to_dos_path ${i:2})" + +#echo "first two chars are $flag" +#echo "last after that are $filename" +#combined="$flag$filename" +#echo combined is $combined + + darc_commands+=("$flag$filename") + else + darc_commands+=($(unix_to_dos_path $i)) + fi + else + darc_commands+=("$i") + fi + done + + + +int main(int argc, char *argv[]) +{ + for (int i = 1; i < argc; i++) { + printf("%s", translate_cygwin(argv[i])); + } + return 0; +} + diff --git a/nucleus/tools/clam_tools/makefile b/nucleus/tools/clam_tools/makefile index b6869892..73578638 100644 --- a/nucleus/tools/clam_tools/makefile +++ b/nucleus/tools/clam_tools/makefile @@ -13,7 +13,7 @@ DEFINITIONS += __BUILD_STATIC_APPLICATION__ ifeq "$(OMIT_VERSIONS)" "" SOURCE += clamtools_version.rc endif -TARGETS = value_tagger.exe version_stamper.exe vsts_version_fixer.exe write_build_config.exe +TARGETS = cygwin_fixer.exe value_tagger.exe version_stamper.exe vsts_version_fixer.exe write_build_config.exe include cpp/rules.def diff --git a/nucleus/tools/clam_tools/value_tagger.cpp b/nucleus/tools/clam_tools/value_tagger.cpp index 076853a4..240601d4 100644 --- a/nucleus/tools/clam_tools/value_tagger.cpp +++ b/nucleus/tools/clam_tools/value_tagger.cpp @@ -481,7 +481,7 @@ variables before running a build.\r\n"; byte_filer build_file(fname, "r"); if (!build_file.good()) { - non_continuable_error(class_name(), build_file.filename(), + non_continuable_error(class_name(), build_file.name(), "Could not find the build configuration; is FEISTY_MEOW_DIR set?"); } byte_array full_config; @@ -501,7 +501,7 @@ variables before running a build.\r\n"; build_number += "."; build_number += temp_ini.load("version", "build", ""); if (build_number.equal_to("...")) { - non_continuable_error(class_name(), build_file.filename(), + non_continuable_error(class_name(), build_file.name(), "Could not read the build number; is build parameter file malformed?"); } diff --git a/nucleus/tools/clam_tools/write_build_config.cpp b/nucleus/tools/clam_tools/write_build_config.cpp index 6a9a30b5..d3b9a812 100644 --- a/nucleus/tools/clam_tools/write_build_config.cpp +++ b/nucleus/tools/clam_tools/write_build_config.cpp @@ -208,10 +208,10 @@ if (read < 1) LOG("why is existing header contentless?"); byte_filer build_header(filename, "wb"); if (!build_header.good()) non_continuable_error(static_class_name(), func, astring("failed to create " - "build header file in ") + build_header.filename()); + "build header file in ") + build_header.name()); build_header.write(new_contents); LOG(astring(static_class_name()) + ": wrote config to " - + build_header.filename()); + + build_header.name()); } else { // nothing has changed. // LOG(astring(static_class_name()) + ": config already up to date in " @@ -263,7 +263,7 @@ int write_build_config::execute() byte_filer ini(fname, "r"); if (!ini.good()) non_continuable_error(static_class_name(), func, astring("failed to open " - "build configuration file for reading at ") + ini.filename()); + "build configuration file for reading at ") + ini.name()); //hmmm: parameterize the build ini thing above! // now we build strings that represents the output files we want to create. diff --git a/nucleus/tools/dependency_tool/makedep.cpp b/nucleus/tools/dependency_tool/makedep.cpp index 83df3bf1..0a3844b8 100644 --- a/nucleus/tools/dependency_tool/makedep.cpp +++ b/nucleus/tools/dependency_tool/makedep.cpp @@ -139,6 +139,21 @@ c_catch(int sig) struct sigaction sig_act; #endif /* USGISH */ +// turns the cygwin name format into a usable windos filename. +char *translate_cygwin(char *fname) +{ + if (!strncmp(fname, "/cygdrive/", 10)) { + int oldlen = strlen(fname); + char *newprefix = (char *)malloc(oldlen); // at least long enough. + newprefix[0] = fname[10]; + newprefix[1] = ':'; + newprefix[2] = '\0'; + strncat(newprefix, fname + 11, oldlen - 11 + 1); // one extra for null char. +printf("translate cygwin: new filename is %s\n", newprefix); + return newprefix; // ignoring mem leak here. cannot be helped for quicky fix. + } else return fname; +} + /* fatty boombalatty, and wrong idea here. // adds any subdirectories under dirname into the list of @@ -189,8 +204,8 @@ int main(int argc, char **argv) char quotechar = '\0'; nargc = 1; - if ((afd = open(argv[1]+1, O_RDONLY)) < 0) - fatalerr("cannot open \"%s\"\n", argv[1]+1); + if ((afd = open(translate_cygwin(argv[1]+1), O_RDONLY)) < 0) + fatalerr("cannot open \"%s\"\n", translate_cygwin(argv[1]+1)); fstat(afd, &ast); args = (char *)malloc(ast.st_size + 2); if ((ast.st_size = read(afd, args, ast.st_size)) < 0) @@ -346,6 +361,7 @@ int main(int argc, char **argv) objprefix = argv[0]; } else objprefix = argv[0]+2; + objprefix = translate_cygwin(objprefix); break; case 'v': if (endmarker) break; @@ -505,9 +521,9 @@ struct filepointer *getfile(char *file) struct stat st; content = (struct filepointer *)malloc(sizeof(struct filepointer)); - content->f_name = strdup(file); + content->f_name = strdup(translate_cygwin(file)); if ((fd = open(file, O_RDONLY)) < 0) { - warning("cannot open \"%s\"\n", file); + warning("cannot open \"%s\"\n", translate_cygwin(file)); content->f_p = content->f_base = content->f_end = (char *)malloc(1); *content->f_p = '\0'; return(content); @@ -517,7 +533,7 @@ struct filepointer *getfile(char *file) if (content->f_base == NULL) fatalerr("cannot allocate mem\n"); if ((st.st_size = read(fd, content->f_base, st.st_size)) < 0) - fatalerr("failed to read %s\n", file); + fatalerr("failed to read %s\n", translate_cygwin(file)); close(fd); content->f_len = st.st_size+1; content->f_p = content->f_base; @@ -686,21 +702,21 @@ void redirect(char *line, char *makefile) } else stat(makefile, &st); - if ((fdin = fopen(makefile, "r")) == NULL) - fatalerr("cannot open \"%s\"\n", makefile); + if ((fdin = fopen(translate_cygwin(makefile), "r")) == NULL) + fatalerr("cannot open \"%s\"\n", translate_cygwin(makefile)); sprintf(backup, "%s.bak", makefile); unlink(backup); #if defined(WIN32) || defined(__EMX__) || defined(__OS2__) fclose(fdin); #endif - if (rename(makefile, backup) < 0) - fatalerr("cannot rename %s to %s\n", makefile, backup); + if (rename(translate_cygwin(makefile), translate_cygwin(backup)) < 0) + fatalerr("cannot rename %s to %s\n", translate_cygwin(makefile), translate_cygwin(backup)); #if defined(WIN32) || defined(__EMX__) || defined(__OS2__) - if ((fdin = fopen(backup, "r")) == NULL) - fatalerr("cannot open \"%s\"\n", backup); + if ((fdin = fopen(translate_cygwin(backup), "r")) == NULL) + fatalerr("cannot open \"%s\"\n", translate_cygwin(backup)); #endif - if ((fdout = freopen(makefile, "w", stdout)) == NULL) - fatalerr("cannot open \"%s\"\n", backup); + if ((fdout = freopen(translate_cygwin(makefile), "w", stdout)) == NULL) + fatalerr("cannot open \"%s\"\n", translate_cygwin(backup)); len = int(strlen(line)); while (!found && fgets(buf, BUFSIZ, fdin)) { if (*buf == '#' && strncmp(line, buf, len) == 0) diff --git a/scripts/clam/cpp/variables.def b/scripts/clam/cpp/variables.def index 72a16136..74334a22 100644 --- a/scripts/clam/cpp/variables.def +++ b/scripts/clam/cpp/variables.def @@ -654,7 +654,7 @@ ifeq "$(COMPILER)" "VISUAL_CPP" export VIS_STU_ROOT := $(shell $(SHELL) $(CLAM_DIR)/cpp/ms_root_dir.sh ) endif ifneq "$(VIS_STU_ROOT)" "" - export COMPILER_ROOT_DIR = $(VIS_STU_ROOT)/vc + export COMPILER_ROOT_DIR = $(VIS_STU_ROOT)/VC endif ifeq "$(COMPILER_ROOT_DIR)" "" HOSEUP = $(shell echo The compiler directory is not set. Please define the environment variable) @@ -671,8 +671,8 @@ ifeq "$(COMPILER)" "VISUAL_CPP" export PDB_DIR = $(TARGETS_DIR) # set these way up here so we can override them later. - CC = bash $(BUILD_SCRIPTS_DIR)/wrapdoze.sh $(COMPILER_ROOT_DIR)/bin/cl - LINK_TOOL = bash $(BUILD_SCRIPTS_DIR)/wrapdoze.sh $(COMPILER_ROOT_DIR)/bin/link + CC = $(BUILD_SCRIPTS_DIR)/wrapdoze.sh $(COMPILER_ROOT_DIR)/bin/cl.exe + LINK_TOOL = $(BUILD_SCRIPTS_DIR)/wrapdoze.sh $(COMPILER_ROOT_DIR)/bin/link.exe # This is needed to protect against the use of 64-bit time_t structure # on windows. We are casting to time_t from a 32-bit structure. diff --git a/scripts/core/bootstrap_shells.sh b/scripts/core/bootstrap_shells.sh index a4031bca..0f7ad4a6 100644 --- a/scripts/core/bootstrap_shells.sh +++ b/scripts/core/bootstrap_shells.sh @@ -15,6 +15,7 @@ THIS_TOOL_NAME="$(basename "$0")" # set up the feisty_meow dir. pushd "$CORE_SCRIPTS_DIR/../.." &>/dev/null +source "$CORE_SCRIPTS_DIR/functions.sh" export FEISTY_MEOW_DIR="$(pwd)" popd &>/dev/null diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index 3a86546b..1cb2a2e4 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -157,13 +157,18 @@ if [ -z "$skip_all" ]; then } # switches from a /X/path form to an X:/ form. this also processes cygwin paths. - function msys_to_dos_path() { - # we always remove dos slashes in favor of forward slashes. - echo "$1" | sed -e 's/\\/\//g' | sed -e 's/\/cygdrive//' | sed -e 's/\/\([a-zA-Z]\)\/\(.*\)/\1:\/\2/' + function unix_to_dos_path() { + # we usually remove dos slashes in favor of forward slashes. + if [ ! -z "$SERIOUS_SLASH_TREATMENT" ]; then + # unless this flag is set, in which case we force dos slashes. + echo "$1" | sed -e 's/\\/\//g' | sed -e 's/\/cygdrive//' | sed -e 's/\/\([a-zA-Z]\)\/\(.*\)/\1:\/\2/' | sed -e 's/\//\\/g' + else + echo "$1" | sed -e 's/\\/\//g' | sed -e 's/\/cygdrive//' | sed -e 's/\/\([a-zA-Z]\)\/\(.*\)/\1:\/\2/' + fi } # switches from an X:/ form to an /X/path form. - function dos_to_msys_path() { + function dos_to_unix_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/' } diff --git a/scripts/core/variables.sh b/scripts/core/variables.sh index f3c1972a..de83d76d 100644 --- a/scripts/core/variables.sh +++ b/scripts/core/variables.sh @@ -177,7 +177,7 @@ if [ -z "$NECHUNG" ]; then # set the path for locating applications. this is done after any # potential overrides from the user. - #export PATH="$(dos_to_msys_path $BINDIR):$(dos_to_msys_path $FEISTY_MEOW_GENERATED):$PATH:/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/lib:/usr/games:/usr/bin:." + #export PATH="$(dos_to_unix_path $BINDIR):$(dos_to_unix_path $FEISTY_MEOW_GENERATED):$PATH:/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/lib:/usr/games:/usr/bin:." export PATH="$FEISTY_MEOW_GENERATED:$PATH:/sbin:." ###noise! :/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/lib:/usr/games:/usr/bin:. diff --git a/scripts/generator/bootstrap_build.sh b/scripts/generator/bootstrap_build.sh index c6bb8faa..1314e1db 100644 --- a/scripts/generator/bootstrap_build.sh +++ b/scripts/generator/bootstrap_build.sh @@ -41,6 +41,12 @@ if [ -z "$FEISTY_MEOW_SCRIPTS_LOADED" ]; then 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 $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" @@ -218,7 +224,8 @@ 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. + promote cygwin_fixer # translates cygwin paths into dos-style equivalents. popd &>/dev/null fi diff --git a/scripts/generator/build_variables.sh b/scripts/generator/build_variables.sh index 8723e454..c21f1b78 100644 --- a/scripts/generator/build_variables.sh +++ b/scripts/generator/build_variables.sh @@ -71,13 +71,6 @@ export CLAM_DIR="$(cd $BUILD_SCRIPTS_DIR/../clam ; \pwd)" # 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. @@ -95,6 +88,11 @@ if [ ! -z "$SHELL_DEBUG" ]; then echo "[FEISTY_MEOW_DIR is $FEISTY_MEOW_DIR]" 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" diff --git a/scripts/generator/vis_stu_vars.sh b/scripts/generator/vis_stu_vars.sh index 1134e539..1989f756 100644 --- a/scripts/generator/vis_stu_vars.sh +++ b/scripts/generator/vis_stu_vars.sh @@ -62,25 +62,22 @@ export LIB="$VCINSTALLDIR/ATLMFC/LIB:$VCINSTALLDIR/LIB:$PLATFORM_DIR/lib" #:$FrameworkSDKDir/lib" # convert framework dir back or things yell like hell. -export FrameworkDir=$(msys_to_dos_path $FrameworkDir) +export FrameworkDir=$(unix_to_dos_path $FrameworkDir) # the redirection of stderr to null is to get around an obnoxious cygwin # warning that seems to be erroneously bitching about backslashes. -# mark this as executable because we will need it. -#chmod 755 $FEISTY_MEOW_SCRIPTS/generator/wrapdoze.sh - # convert all other relevant paths back to dos form, or visual studio barfs. -#export BUILD_SCRIPTS_DIR=$(msys_to_dos_path $BUILD_SCRIPTS_DIR) -#export BUILDING_HIERARCHY=$(msys_to_dos_path $BUILDING_HIERARCHY) -#export BUILDER_DIR=$(msys_to_dos_path $BUILDER_DIR) -#export BUILD_TOP=$(msys_to_dos_path $BUILD_TOP) -#export PRODUCTION_DIR=$(msys_to_dos_path $PRODUCTION_DIR) -#export LOGS_DIR=$(msys_to_dos_path $LOGS_DIR) -#export TOOL_SOURCES=$(msys_to_dos_path $TOOL_SOURCES) -#export BINARY_DIR=$(msys_to_dos_path $BINARY_DIR) -#export TARGETS_DIR=$(msys_to_dos_path $TARGETS_DIR) -#export INTERMEDIATE_EXE_DIR=$(msys_to_dos_path $INTERMEDIATE_EXE_DIR) -#export WASTE_DIR=$(msys_to_dos_path $WASTE_DIR) +#export BUILD_SCRIPTS_DIR=$(unix_to_dos_path $BUILD_SCRIPTS_DIR) +#export BUILDING_HIERARCHY=$(unix_to_dos_path $BUILDING_HIERARCHY) +#export BUILDER_DIR=$(unix_to_dos_path $BUILDER_DIR) +#export BUILD_TOP=$(unix_to_dos_path $BUILD_TOP) +#export PRODUCTION_DIR=$(unix_to_dos_path $PRODUCTION_DIR) +#export LOGS_DIR=$(unix_to_dos_path $LOGS_DIR) +#export TOOL_SOURCES=$(unix_to_dos_path $TOOL_SOURCES) +#export BINARY_DIR=$(unix_to_dos_path $BINARY_DIR) +#export TARGETS_DIR=$(unix_to_dos_path $TARGETS_DIR) +#export INTERMEDIATE_EXE_DIR=$(unix_to_dos_path $INTERMEDIATE_EXE_DIR) +#export WASTE_DIR=$(unix_to_dos_path $WASTE_DIR) ############## diff --git a/scripts/generator/wrapdoze.sh b/scripts/generator/wrapdoze.sh index 99d610ca..758fc762 100644 --- a/scripts/generator/wrapdoze.sh +++ b/scripts/generator/wrapdoze.sh @@ -1,24 +1,43 @@ #!/bin/bash -source "$FEISTY_MEOW_SCRIPTS/core/functions.sh" +source $FEISTY_MEOW_SCRIPTS/core/functions.sh -declare -a commands=() +function dossify_and_run_commands() +{ + declare -a darc_commands=() -for i in "$@"; do - # we only mess with the command line on windows. - if [ "$OS" == "Windows_NT" ]; then - commands+=($(msys_to_dos_path $i)) - else - commands+=("$i") - fi -done + for i in "$@"; do + # we only mess with the command line on windows. + if [ "$OS" == "Windows_NT" ]; then + if [[ "$i" =~ ^-[a-zA-z][/\"].* ]]; then +#echo matched on our pattern for parameters + flag="${i:0:2}" + filename="$(unix_to_dos_path ${i:2})" -# echo commands are now: -# for i in "${commands[@]}"; do -# echo $i -# done +#echo "first two chars are $flag" +#echo "last after that are $filename" +#combined="$flag$filename" +#echo combined is $combined + + darc_commands+=("$flag$filename") + else + darc_commands+=($(unix_to_dos_path $i)) + fi + else + darc_commands+=("$i") + fi + done -# now actually run the possibly chewed command. -"${commands[@]}" +#temp! + echo commands are now: >>/tmp/wrapdoze.log + for i in "${darc_commands[@]}"; do + echo $i >>/tmp/wrapdoze.log + done +#end temp + # now actually run the possibly chewed command. + "${darc_commands[@]}" +} + +dossify_and_run_commands "$@" -- 2.34.1