From 25018c455b1297b72bb793a8eba7bc9426e28326 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 11 Aug 2008 16:44:12 +0000 Subject: [PATCH] Make nsgtk compile on Mac OS X. svn path=/trunk/netsurf/; revision=5031 --- Makefile | 24 +++++++++++++++--------- Makefile.config | 7 ++++++- desktop/browser.c | 1 + desktop/options.c | 1 + image/mng.c | 7 ++++--- render/imagemap.c | 1 + render/list.c | 1 + render/textplain.c | 1 + utils/config.h | 3 ++- utils/utf8.c | 2 ++ utils/utils.c | 1 + utils/utils.h | 3 ++- 12 files changed, 37 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index a207877bf..262891aa0 100644 --- a/Makefile +++ b/Makefile @@ -60,12 +60,6 @@ else # Haiku implements the BeOS API HOST := beos endif - ifeq ($(HOST),AmigaOS) - HOST := amiga - ifeq ($(TARGET),) - TARGET := amiga - endif - endif ifeq ($(HOST),beos) # Build happening on BeOS platform, default target is BeOS backend ifeq ($(TARGET),) @@ -74,9 +68,21 @@ else # BeOS still uses gcc2 GCCVER := 2 else - # Build happening on non-RO platform, default target is GTK backend - ifeq ($(TARGET),) - TARGET := gtk + ifeq ($(HOST),AmigaOS) + HOST := amiga + ifeq ($(TARGET),) + TARGET := amiga + endif + GCCVER := 2 + else + ifeq ($(HOST),Darwin) + HOST := macosx + endif + + # Default target is GTK backend + ifeq ($(TARGET),) + TARGET := gtk + endif endif endif endif diff --git a/Makefile.config b/Makefile.config index 362db38f9..96e7646c7 100644 --- a/Makefile.config +++ b/Makefile.config @@ -26,7 +26,7 @@ NETSURF_USE_JPEG := YES NETSURF_USE_MNG := YES # Use libharu to enable PDF export and GTK printing support. There is no -# auto-detection available for this, as it does not have a pkg-config file +# auto-detection available for this, as it does not have a pkg-config file. # Valid options: YES, NO NETSURF_USE_HARU_PDF := YES @@ -103,6 +103,11 @@ ifeq ($(TARGET),gtk) # Valid options: YES, NO, AUTO NETSURF_USE_ROSPRITE := AUTO + # Configuration overrides for Mac OS X + ifeq ($(HOST),macosx) + NETSURF_USE_LIBICONV_PLUG := NO + NETSURF_USE_HARU_PDF := NO + endif endif # ---------------------------------------------------------------------------- diff --git a/desktop/browser.c b/desktop/browser.c index 0b9c2a638..899457b74 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include "curl/curl.h" diff --git a/desktop/options.c b/desktop/options.c index 8668afa74..c289cb0b6 100644 --- a/desktop/options.c +++ b/desktop/options.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include "content/urldb.h" diff --git a/image/mng.c b/image/mng.c index e4e375922..d6902f4e9 100644 --- a/image/mng.c +++ b/image/mng.c @@ -383,9 +383,10 @@ mng_uint32 nsmng_gettickcount(mng_handle mng) { static bool start = true; static time_t t0; struct timeval tv; -#if defined(__SVR4) && defined(__sun) || defined(__NetBSD__) - /* Solaris and NetBSD don't have this structure, and ignores the second - * parameter to gettimeofday() +#if defined(__SVR4) && defined(__sun) || defined(__NetBSD__) || \ + defined(__APPLE__) + /* Solaris, NetBSD, and OS X don't have this structure, and ignore the + * second parameter to gettimeofday() */ int tz; #else diff --git a/render/imagemap.c b/render/imagemap.c index af442484f..9f1c3bf95 100644 --- a/render/imagemap.c +++ b/render/imagemap.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "content/content.h" #include "render/box.h" #include "render/imagemap.h" diff --git a/render/list.c b/render/list.c index 5bcf36ffc..8b5ef698e 100644 --- a/render/list.c +++ b/render/list.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "css/css.h" #include "render/list.h" #include "utils/log.h" diff --git a/render/textplain.c b/render/textplain.c index f85906a10..9503b3dad 100644 --- a/render/textplain.c +++ b/render/textplain.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include "content/content.h" diff --git a/utils/config.h b/utils/config.h index 2e586974c..deee87150 100644 --- a/utils/config.h +++ b/utils/config.h @@ -24,7 +24,8 @@ /* Try to detect which features the target OS supports */ #define HAVE_STRNDUP -#if defined(__FreeBSD__) || (defined(__SRV4) && defined(__sun)) +#if defined(__FreeBSD__) || (defined(__SRV4) && defined(__sun)) || \ + defined(__APPLE__) /* FreeBSD and Solaris do not have this function, so * we implement it ourselves in util.c */ diff --git a/utils/utf8.c b/utils/utf8.c index 2ebac31b6..4c3c612f5 100644 --- a/utils/utf8.c +++ b/utils/utf8.c @@ -25,8 +25,10 @@ #include #include #include +#include #include +#include "utils/config.h" #include "utils/log.h" #include "utils/utf8.h" diff --git a/utils/utils.c b/utils/utils.c index cf5b5276e..9f72be0ee 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/utils/utils.h b/utils/utils.h index 49b67528c..cf66aedca 100644 --- a/utils/utils.h +++ b/utils/utils.h @@ -75,7 +75,8 @@ void regcomp_wrapper(regex_t *preg, const char *regex, int cflags); void unicode_transliterate(unsigned int c, char **r); char *human_friendly_bytesize(unsigned long bytesize); const char *rfc1123_date(time_t t); -#if !(defined(_GNU_SOURCE) || defined(__NetBSD__)) || defined(riscos) +#if !(defined(_GNU_SOURCE) || defined(__NetBSD__)) || defined(riscos) || \ + defined(__APPLE__) char *strcasestr(const char *haystack, const char *needle); #endif unsigned int wallclock(void);