From 51b587223136de70cd5a9f1cfbf2bf80b4e70ba0 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Sun, 10 Nov 2013 23:24:01 -0500 Subject: [PATCH] updated from windows side and nearly working over there. --- .../utilities/time_running_app.cpp | 4 + .../utilities/time_set_effective_id.cpp | 2 + nucleus/library/algorithms/placeholder.cpp | 3 +- nucleus/library/basis/utf_conversion.h | 1 + nucleus/library/filesystem/byte_filer.cpp | 15 +-- .../tests_filesystem/test_filename.cpp | 2 +- nucleus/tools/clam_tools/cygwin_fixer.cpp | 92 ------------------- nucleus/tools/clam_tools/makefile | 2 +- nucleus/tools/clam_tools/value_tagger.cpp | 1 + production/feisty_meow_config.ini | 9 +- scripts/clam/cpp/rules.def | 2 + scripts/clam/cpp/variables.def | 10 +- scripts/generator/bootstrap_build.sh | 1 - scripts/generator/wrapdoze.sh | 21 +++-- 14 files changed, 35 insertions(+), 130 deletions(-) delete mode 100644 nucleus/tools/clam_tools/cygwin_fixer.cpp mode change 100755 => 100644 scripts/generator/wrapdoze.sh diff --git a/nucleus/applications/utilities/time_running_app.cpp b/nucleus/applications/utilities/time_running_app.cpp index 7e61906b..5bbf5d13 100644 --- a/nucleus/applications/utilities/time_running_app.cpp +++ b/nucleus/applications/utilities/time_running_app.cpp @@ -25,6 +25,10 @@ #include +#ifdef __WIN32__ + #include +#endif + using namespace application; using namespace basis; using namespace loggers; diff --git a/nucleus/applications/utilities/time_set_effective_id.cpp b/nucleus/applications/utilities/time_set_effective_id.cpp index 21a7c59d..07dda37e 100644 --- a/nucleus/applications/utilities/time_set_effective_id.cpp +++ b/nucleus/applications/utilities/time_set_effective_id.cpp @@ -48,6 +48,7 @@ int time_set_effective_id::execute() FUNCDEF("execute"); SETUP_COMBO_LOGGER; +#ifndef __WIN32__ int test_runs = 1000000; time_stamp start; // start of test. @@ -72,6 +73,7 @@ int time_set_effective_id::execute() LOG(a_sprintf("test run took %0.2f milliseconds or %0.2f seconds or %0.2f minutes.", durat, secs, secs / 60.0)); // divide by two because we're doing two calls above. LOG(a_sprintf("individual call takes %0.0f milliseconds.", durat / double(test_runs) / 2.0)); +#endif return 0; } diff --git a/nucleus/library/algorithms/placeholder.cpp b/nucleus/library/algorithms/placeholder.cpp index 72516564..953ca62c 100644 --- a/nucleus/library/algorithms/placeholder.cpp +++ b/nucleus/library/algorithms/placeholder.cpp @@ -3,5 +3,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/basis/utf_conversion.h b/nucleus/library/basis/utf_conversion.h index 33d436eb..dcb8b16b 100644 --- a/nucleus/library/basis/utf_conversion.h +++ b/nucleus/library/basis/utf_conversion.h @@ -190,6 +190,7 @@ Booleano isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd); // compliant functions that required Unicode in win32 but not in Unix systems. #if defined(UNICODE) +#error should not be in here right now --cak ///holding to test wx && defined(__WIN32__) //! to_unicode_temp() converts to UTF-16 as needed for win32 system calls. /*! this conversion is only appropriate to use within expressions. it does diff --git a/nucleus/library/filesystem/byte_filer.cpp b/nucleus/library/filesystem/byte_filer.cpp index bc6779c4..0384d2ec 100644 --- a/nucleus/library/filesystem/byte_filer.cpp +++ b/nucleus/library/filesystem/byte_filer.cpp @@ -29,7 +29,7 @@ #include #endif -//#define DEBUG_BYTE_FILER +#define DEBUG_BYTE_FILER // uncomment for noisy version of class. using namespace basis; @@ -88,19 +88,8 @@ bool byte_filer::open(const astring &fname, const astring &perms) close(); _auto_close = true; // reset since we know we're opening this. _filename->reset(fname); -#ifndef __WIN32__ _handle->fp = _filename->raw().t()? fopen(_filename->raw().s(), perms.s()) : NIL; -#else - _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->raw())); -#endif - -#endif + if (_handle->fp == NIL) return false; return good(); } diff --git a/nucleus/library/tests_filesystem/test_filename.cpp b/nucleus/library/tests_filesystem/test_filename.cpp index 6fa80759..54bba456 100644 --- a/nucleus/library/tests_filesystem/test_filename.cpp +++ b/nucleus/library/tests_filesystem/test_filename.cpp @@ -259,7 +259,7 @@ int test_filename::execute() filename test17("r/"); ASSERT_EQUAL(test17, astring("r\\"), GROUP + "test 17 failed"); filename test18("/kr/soop"); - ASSERT_NOT_EQUAL(test18, astring("\\kr\\soop"), GROUP + "test 18 failed"); + ASSERT_INEQUAL(test18, astring("\\kr\\soop"), GROUP + "test 18 failed"); } #endif diff --git a/nucleus/tools/clam_tools/cygwin_fixer.cpp b/nucleus/tools/clam_tools/cygwin_fixer.cpp deleted file mode 100644 index 48eba3fe..00000000 --- a/nucleus/tools/clam_tools/cygwin_fixer.cpp +++ /dev/null @@ -1,92 +0,0 @@ -//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; -} - -#ifdef __BUILD_STATIC_APPLICATION__ - // static dependencies found by buildor_gen_deps.sh: -#endif // __BUILD_STATIC_APPLICATION__ - diff --git a/nucleus/tools/clam_tools/makefile b/nucleus/tools/clam_tools/makefile index 73578638..b6869892 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 = cygwin_fixer.exe value_tagger.exe version_stamper.exe vsts_version_fixer.exe write_build_config.exe +TARGETS = 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 4308bacf..2bac0602 100644 --- a/nucleus/tools/clam_tools/value_tagger.cpp +++ b/nucleus/tools/clam_tools/value_tagger.cpp @@ -229,6 +229,7 @@ int value_tagger::print_instructions_and_exit() { LOG(a_sprintf("%s usage:", filename(_global_argv[0]).basename().raw().s())); LOG(""); + LOG("\ This utility scans a code base for outcome and filter definitions. It will\n\ only scan the header files (*.h) found in the directories specified. The\n\ diff --git a/production/feisty_meow_config.ini b/production/feisty_meow_config.ini index aaf1e575..aca7bb1e 100755 --- a/production/feisty_meow_config.ini +++ b/production/feisty_meow_config.ini @@ -68,13 +68,8 @@ endif # this flag selects whether to build with unicode enabled. this mainly affects # win32 OSes, and right now we know it affects them badly if this is enabled. # unix may build slightly differently too, such as for WX widgets. -ifeq "$(OP_SYSTEM)" "WIN32" -### -### do not enable on win32 right now. -### DEFINITIONS += UNICODE=t -### -else - DEFINITIONS += UNICODE=t +ifneq "$(OP_SYSTEM)" "WIN32" +# DEFINITIONS += UNICODE=t endif # if this flag is turned on, then memory allocations will be trapped for diff --git a/scripts/clam/cpp/rules.def b/scripts/clam/cpp/rules.def index 6e565162..ee8c7d6f 100644 --- a/scripts/clam/cpp/rules.def +++ b/scripts/clam/cpp/rules.def @@ -500,7 +500,9 @@ $(DYNAMIC_LIBRARY_DIR)/%.dll: $(ACTUAL_OBJECTS:%=$(OBJECT_DIR)/%) $(ACTUAL_LOCAL $(HIDESH)-c 'if [ -f $(BUILD_LIST_FILE) ]; then $(SHELL) $(CLAM_DIR)/cpp/rebuild_oldies.sh $(MULTI_BUILD_CMD); fi' endif $(HIDER)rm -f $(@:%.dll=%.lib) + echo about to run link tool. $(CATCHER)$(LINK_TOOL) $(LINKER_OUTPUT_FLAG)$@ -dll $(LOAD_FLAG_PREFIX) $(ACTUAL_OBJECTS:%=$(OBJECT_DIR)/%) $(ACTUAL_RESX_FLAGS) $(ACTUAL_LOCAL_LIBS:%=$(LIBRARY_NAME_FLAG)$(LIB_PREFIX)%$(LIB_ENDING)) $(LOAD_FLAG_SUFFIX) + echo ran link tool. ifeq "$(COMPILER_VERSION)" "8" $(HIDESH)$(CLAM_DIR)/cpp/ms_manifest.sh "$@" "2" endif diff --git a/scripts/clam/cpp/variables.def b/scripts/clam/cpp/variables.def index dcf70461..2a7b21ac 100644 --- a/scripts/clam/cpp/variables.def +++ b/scripts/clam/cpp/variables.def @@ -674,6 +674,7 @@ ifeq "$(COMPILER)" "VISUAL_CPP" # set these way up here so we can override them later. 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 + LIBRARY_TOOL = $(BUILD_SCRIPTS_DIR)/wrapdoze.sh $(COMPILER_ROOT_DIR)/bin/lib # 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. @@ -683,19 +684,19 @@ ifeq "$(COMPILER)" "VISUAL_CPP" ifeq "$(COMPILER_VERSION)" "6" COMPILER_HEADER_DIR = $(COMPILER_ROOT_DIR)/include $(COMPILER_ROOT_DIR)/atl/include COMPILER_LIBRARY_DIR = $(COMPILER_ROOT_DIR)/lib $(COMPILER_ROOT_DIR)/atl/lib - RC = $(COMPILER_ROOT_DIR)/../common/msdev98/bin/rc + RC = $(BUILD_SCRIPTS_DIR)/wrapdoze.sh $(COMPILER_ROOT_DIR)/../common/msdev98/bin/rc endif ifeq "$(COMPILER_VERSION)" "7" COMPILER_HEADER_DIR = $(COMPILER_ROOT_DIR)/include $(COMPILER_ROOT_DIR)/atlmfc/include $(COMPILER_ROOT_DIR)/platformsdk/include $(FRAMEWORK_DIR) COMPILER_LIBRARY_DIR = $(COMPILER_ROOT_DIR)/lib $(COMPILER_ROOT_DIR)/atlmfc/lib $(COMPILER_ROOT_DIR)/platformsdk/lib - RC = $(COMPILER_ROOT_DIR)/bin/rc + RC = $(BUILD_SCRIPTS_DIR)/wrapdoze.sh $(COMPILER_ROOT_DIR)/bin/rc COMPILER_FLAGS += -Zc:forScope # turn on proper loop scoping. endif ifeq "$(COMPILER_VERSION)" "8" COMPILER_HEADER_DIR = $(COMPILER_ROOT_DIR)/include $(COMPILER_ROOT_DIR)/atlmfc/include $(COMPILER_ROOT_DIR)/platformsdk/include $(FRAMEWORK_DIR) COMPILER_LIBRARY_DIR = $(COMPILER_ROOT_DIR)/lib $(COMPILER_ROOT_DIR)/atlmfc/lib $(COMPILER_ROOT_DIR)/platformsdk/lib - RC = $(COMPILER_ROOT_DIR)/bin/rc + RC = $(BUILD_SCRIPTS_DIR)/wrapdoze.sh $(COMPILER_ROOT_DIR)/bin/rc COMPILER_FLAGS += -Zc:forScope # turn on proper loop scoping. DEFINITIONS += _WIN32_WINNT=0x501 @@ -711,7 +712,7 @@ ifeq "$(COMPILER)" "VISUAL_CPP" COMPILER_LIBRARY_DIR = $(COMPILER_ROOT_DIR)/lib $(COMPILER_ROOT_DIR)/atlmfc/lib $(PLATYPUS)/lib DEFINITIONS += _WIN32_WINNT=0x501 DEPENDENCY_DEFINITIONS += _WIN32_WINNT=0x501 - RC = $(PLATYPUS)/bin/rc + RC = $(BUILD_SCRIPTS_DIR)/wrapdoze.sh $(PLATYPUS)/bin/rc COMPILER_FLAGS += -Zc:forScope # turn on proper loop scoping. endif @@ -731,7 +732,6 @@ ifeq "$(COMPILER)" "VISUAL_CPP" DEFINITIONS += _Windows _WINDOWS WIN32 __WIN32__ __FLAT__ VC_EXTRALEAN WIN32_LEAN_AND_MEAN ATL_NO_LEAN_AND_MEAN DEF_FILE = - LIBRARY_TOOL = $(COMPILER_ROOT_DIR)/bin/lib LOAD_FLAG_PREFIX = -subsystem:windows -machine:X86 -nologo LOAD_FLAG_SUFFIX = diff --git a/scripts/generator/bootstrap_build.sh b/scripts/generator/bootstrap_build.sh index 0e2886e1..4e074a60 100644 --- a/scripts/generator/bootstrap_build.sh +++ b/scripts/generator/bootstrap_build.sh @@ -225,7 +225,6 @@ if [ ! -f "$BINARY_DIR/value_tagger$EXE_ENDING" \ 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 cygwin_fixer # translates cygwin paths into dos-style equivalents. popd &>/dev/null fi diff --git a/scripts/generator/wrapdoze.sh b/scripts/generator/wrapdoze.sh old mode 100755 new mode 100644 index 3f133b96..9aa543e7 --- a/scripts/generator/wrapdoze.sh +++ b/scripts/generator/wrapdoze.sh @@ -2,17 +2,20 @@ source $FEISTY_MEOW_SCRIPTS/core/functions.sh +# for a windows build, this will replace any forward slashes +# and other cygwin notation with the appropriate dos style paths. function dossify_and_run_commands() { - # we only mess with the command line on windows... if [ "$OS" != "Windows_NT" ]; then # for non windows, just run the commands straight up. eval "${@}" return $? fi + # force all slashes to be dossy. +# export SERIOUS_SLASH_TREATMENT=true + declare -a darc_commands=() -#hmmm: may need the serious slash treatment. for i in "$@"; do if [[ "$i" =~ ^-[a-zA-z][/\"].* ]]; then @@ -33,13 +36,13 @@ function dossify_and_run_commands() real_commands+=($(echo $i | sed -e 's/\\/\\\\/g')) done -#temp! - echo commands are now: - for i in "${real_commands[@]}"; do - echo -n "$i " - done - echo -#end temp + if [ ! -z "$SHELL_DEBUG" ]; then + echo commands are now: + for i in "${real_commands[@]}"; do + echo -n "$i " + done + echo + fi # now actually run the chewed command. cmd /c "${real_commands[@]}" -- 2.34.1