(svn r4019) -Fix: [OSX] stopped using iconv for 10.2.8, since it was added in 10.3
authorbjarni
Wed, 22 Mar 2006 13:06:50 +0000
changeset 3294 be3b1e6b4b74
parent 3293 65cee7ffb0b9
child 3295 36c287fd4ceb
(svn r4019) -Fix: [OSX] stopped using iconv for 10.2.8, since it was added in 10.3
this have the sideeffect that 10.2.8 will still have the "failure to save with certain chars in the filename bug", but at least it can compile again
Makefile
network_core.h
os/macosx/Makefile.setup
saveload.c
screenshot.c
unix.c
--- a/Makefile	Wed Mar 22 10:13:15 2006 +0000
+++ b/Makefile	Wed Mar 22 13:06:50 2006 +0000
@@ -486,8 +486,10 @@
 endif
 
 ifdef OSX
+ifndef JAGUAR
 LIBS += -liconv
 endif
+endif
 
 # enables/disables assert()
 ifdef DISABLE_ASSERTS
--- a/network_core.h	Wed Mar 22 10:13:15 2006 +0000
+++ b/network_core.h	Wed Mar 22 13:06:50 2006 +0000
@@ -11,13 +11,10 @@
 
 #ifdef ENABLE_NETWORK
 
-#ifdef __APPLE__
-#include <AvailabilityMacros.h>
-#if (MAC_OS_X_VERSION_MAX_ALLOWED == MAC_OS_X_VERSION_10_2)
+#if defined(__APPLE__) && (MAC_OS_X_VERSION_MAX_ALLOWED == MAC_OS_X_VERSION_10_2)
 	// OSX 10.2 don't have socklen_t defined, so we will define it here
 	typedef int socklen_t;
 #endif
-#endif
 
 // Windows stuff
 #if defined(WIN32) || defined(WIN64)
--- a/os/macosx/Makefile.setup	Wed Mar 22 10:13:15 2006 +0000
+++ b/os/macosx/Makefile.setup	Wed Mar 22 13:06:50 2006 +0000
@@ -23,16 +23,6 @@
 UNIVERSAL_BINARY:=1
 endif
 
-ifndef UNIVERSAL_BINARY
-ifndef JAGUAR
-ifeq ($(shell uname), Darwin)
-# it's a hardware mac, not crosscompiling
-$(shell $(CC) os/macosx/G5_detector.c -o os/macosx/G5_detector)
-IS_G5:=$(shell os/macosx/G5_detector)
-endif
-endif
-endif
-
 ifdef UNIVERSAL_BINARY
 ifndef STATIC
 $(warning Compiling a universal binary, that is not static. Adding static flag)
@@ -78,3 +68,19 @@
 LDFLAGS += -arch ppc970
 endif
 endif
+
+# setting up flags to make a binary, that fits the system it builds on
+ifndef UNIVERSAL_BINARY
+	ifndef JAGUAR
+		ifeq ($(shell uname), Darwin)
+			# it's a hardware mac, not crosscompiling
+			# the next line fails if it got whitespace in front of it
+$(shell $(CC) os/macosx/G5_detector.c -o os/macosx/G5_detector)
+			IS_G5:=$(shell os/macosx/G5_detector)
+			ifeq ($(shell uname -r), 6.8)
+			# OSX 10.2.8 uses Darwin 6.8, so we better set JAGUAR so we avoid the stuff that was added in 10.3 or later
+				JAGUAR:=1
+			endif
+		endif
+	endif
+endif
--- a/saveload.c	Wed Mar 22 10:13:15 2006 +0000
+++ b/saveload.c	Wed Mar 22 13:06:50 2006 +0000
@@ -1314,7 +1314,7 @@
 extern void BeforeSaveGame(void);
 extern bool LoadOldSaveGame(const char *file);
 
-#ifdef __APPLE__
+#if defined(__APPLE__) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3)
 extern const char *convert_to_fs_charset(const char *filename);
 #else
 #define convert_to_fs_charset(str) (str)
--- a/screenshot.c	Wed Mar 22 10:13:15 2006 +0000
+++ b/screenshot.c	Wed Mar 22 13:06:50 2006 +0000
@@ -12,7 +12,7 @@
 #include "screenshot.h"
 #include "variables.h"
 
-#ifdef __APPLE__
+#if defined(__APPLE__) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3)
 extern const char *convert_to_fs_charset(const char *filename);
 #else
 #define convert_to_fs_charset(str) (str)
--- a/unix.c	Wed Mar 22 10:13:15 2006 +0000
+++ b/unix.c	Wed Mar 22 13:06:50 2006 +0000
@@ -43,8 +43,6 @@
 #endif
 
 #if defined(__APPLE__)
-	#include <iconv.h>
-	#include <locale.h>
 	#if defined(WITH_SDL)
 		//the mac implementation needs this file included in the same file as main()
 		#include <SDL.h>
@@ -606,12 +604,15 @@
 	#endif // __AMIGA__
 }
 
-#ifdef __APPLE__
+#if defined(__APPLE__) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3)
 /* FYI: This is not thread-safe.
 Assumptions:
 	- the 'from' charset is ISO-8859-15
 	- the 'to' charset is either the same, or UTF-8
+NOTE: iconv was added in OSX 10.3. 10.2.x will still have the invalid char issues. There aren't any easy fix for this
 */
+#include <iconv.h>
+#include <locale.h>
 const char *convert_to_fs_charset(const char *filename)
 {
 	static char statout[1024], statin[1024];