From 7a2c302c5f4056132bff0bd120808b3e6f1eae23 Mon Sep 17 00:00:00 2001 From: ericwa Date: Fri, 3 Sep 2010 21:08:06 +0000 Subject: [PATCH] libobjc2: tweaks to build on Windows --- GNUmakefile | 4 ++-- legacy_malloc.c | 7 +++++++ properties.m | 9 +++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index f438b94..794e501 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -52,7 +52,7 @@ ifeq ($(tdd), yes) libobjc_CPPFLAGS += -DTYPE_DEPENDENT_DISPATCH endif -libobjc_LIBRARIES_DEPEND_UPON += -lpthread +libobjc_LIBRARIES_DEPEND_UPON += -lpthread -ltoydispatch # Deprecated functions are only deprecated for external use, not for us because # we are special, precious, little flowers. @@ -62,7 +62,7 @@ libobjc_CPPFLAGS += -D__OBJC_RUNTIME_INTERNAL__=1 -D_XOPEN_SOURCE=500 # benefit from supporting platforms with no C99 compiler. libobjc_CFLAGS += -std=c99 -g -march=native -fexceptions -fno-inline libobjc_OBJCFLAGS += $(libobjc_CFLAGS) -libobjc_LDFLAGS += -g -ltoydispatch +libobjc_LDFLAGS += -g libobjc_LIB_DIRS += -L toydispatch/obj libobjc_CFLAGS += -O3 diff --git a/legacy_malloc.c b/legacy_malloc.c index 5792d4a..3eedf27 100644 --- a/legacy_malloc.c +++ b/legacy_malloc.c @@ -14,10 +14,17 @@ void *objc_atomic_malloc(size_t size) return malloc(size); } +#ifdef __MINGW32__ +void *objc_valloc(size_t size) +{ + return malloc(size); +} +#else void *objc_valloc(size_t size) { return valloc(size); } +#endif void *objc_realloc(void *mem, size_t size) { diff --git a/properties.m b/properties.m index cd3f0b7..0309070 100644 --- a/properties.m +++ b/properties.m @@ -2,6 +2,15 @@ #include #include +#ifdef __MINGW32__ +#include +static unsigned sleep(unsigned seconds) +{ + Sleep(seconds*1000); + return 0; +} +#endif + // Subset of NSObject interface needed for properties. @interface NSObject {} - (id)retain;