Add the required makefile stuff to build NetSurf for OSX using 'make cocoa' in trunk/. Crashes for now though. Requires some libs installed with macports to /opt/local.

svn path=/trunk/netsurf/; revision=11380
This commit is contained in:
François Revel 2011-01-19 01:36:21 +00:00
parent ebc216434f
commit 6d1169e92d
3 changed files with 136 additions and 2 deletions

View File

@ -76,6 +76,9 @@ else
else
ifeq ($(HOST),Darwin)
HOST := macosx
ifeq ($(TARGET),)
TARGET := cocoa
endif
endif
ifeq ($(HOST),FreeMiNT)
HOST := mint
@ -103,7 +106,9 @@ ifneq ($(TARGET),riscos)
ifneq ($(TARGET),framebuffer)
ifneq ($(TARGET),windows)
ifneq ($(TARGET),atari)
$(error Unknown TARGET "$(TARGET)", should either be "riscos", "gtk", "beos", "amiga", "framebuffer", "windows" or "atari")
ifneq ($(TARGET),cocoa)
$(error Unknown TARGET "$(TARGET)", should either be "riscos", "gtk", "beos", "amiga", "framebuffer", "windows", "atari" or "cocoa")
endif
endif
endif
endif
@ -355,7 +360,7 @@ ifeq ($(SOURCES),)
$(error Unable to build NetSurf, could not determine set of sources to build)
endif
OBJECTS := $(sort $(addprefix $(OBJROOT)/,$(subst /,_,$(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(patsubst %.s,%.o,$(SOURCES)))))))
OBJECTS := $(sort $(addprefix $(OBJROOT)/,$(subst /,_,$(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(patsubst %.m,%.o,$(patsubst %.s,%.o,$(SOURCES))))))))
$(EXETARGET): $(OBJECTS) $(RESOURCES)
$(VQ)echo " LINK: $(EXETARGET)"
@ -528,6 +533,9 @@ $(eval $(foreach SOURCE,$(filter %.c,$(SOURCES)), \
$(eval $(foreach SOURCE,$(filter %.cpp,$(SOURCES)), \
$(call dependency_generate_c,$(SOURCE),$(subst /,_,$(SOURCE:.cpp=.d)),$(subst /,_,$(SOURCE:.cpp=.o)))))
$(eval $(foreach SOURCE,$(filter %.m,$(SOURCES)), \
$(call dependency_generate_c,$(SOURCE),$(subst /,_,$(SOURCE:.m=.d)),$(subst /,_,$(SOURCE:.m=.o)))))
# Cannot currently generate dep files for S files because they're objasm
# when we move to gas format, we will be able to.
@ -546,6 +554,9 @@ $(eval $(foreach SOURCE,$(filter %.c,$(SOURCES)), \
$(eval $(foreach SOURCE,$(filter %.cpp,$(SOURCES)), \
$(call compile_target_cpp,$(SOURCE),$(subst /,_,$(SOURCE:.cpp=.o)),$(subst /,_,$(SOURCE:.cpp=.d)))))
$(eval $(foreach SOURCE,$(filter %.m,$(SOURCES)), \
$(call compile_target_c,$(SOURCE),$(subst /,_,$(SOURCE:.m=.o)),$(subst /,_,$(SOURCE:.m=.d)))))
$(eval $(foreach SOURCE,$(filter %.s,$(SOURCES)), \
$(call compile_target_s,$(SOURCE),$(subst /,_,$(SOURCE:.s=.o)),$(subst /,_,$(SOURCE:.s=.d)))))

View File

@ -345,6 +345,45 @@ ifeq ($(TARGET),atari)
endif
# ----------------------------------------------------------------------------
# Cocoa-specific options
# ----------------------------------------------------------------------------
ifeq ($(TARGET),cocoa)
# Force using glibc internal iconv implementation instead of external libiconv
# Valid options: YES, NO
NETSURF_USE_LIBICONV_PLUG := NO
# Enable NetSurf's use of librosprite for displaying RISC OS Sprites
# Valid options: YES, NO, AUTO
NETSURF_USE_ROSPRITE := NO
# Enable NetSurf's use of libwebp/libvpx for displaying WebPs
# Valid options: YES, NO
NETSURF_USE_WEBP := NO
# Enable NetSurf's use of librsvg in conjunction with Cairo to display SVGs
# Valid options: YES, NO, AUTO
NETSURF_USE_RSVG := AUTO
# Enable NetSurf's use of libsvgtiny for displaying SVGs
# Valid options: YES, NO, AUTO
NETSURF_USE_NSSVG := YES
NETSURF_USE_MNG := NO
NETSURF_ATARI_USE_FREETYPE := YES
# Optimisation levels
CFLAGS += -O2 -Wuninitialized
WARNFLAGS = -W -Wundef -Wpointer-arith \
-Wcast-align -Wwrite-strings -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations -Wredundant-decls \
-Wnested-externs -Wl,-t
endif
# Include any local configuration
-include Makefile.config

84
cocoa/Makefile.target Normal file
View File

@ -0,0 +1,84 @@
# ----------------------------------------------------------------------------
# Mac OS X target setup
# ----------------------------------------------------------------------------
$(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng) ))
LDFLAGS += -L/opt/local/lib
LDFLAGS += -lm -lxml2 -lcurl -liconv
LDFLAGS += -lssl -lcrypto -lhubbub -lcss -lparserutils -lwapcaplet
CFLAGS += -I. -O $(WARNFLAGS) -Dnscocoa \
-D_BSD_SOURCE -D_POSIX_C_SOURCE \
-std=c99
# DEBUG
CFLAGS += -g -O0 -Wno-uninitialized
# -DDEBUG=1
# shut up zconf.h and zlib.h
#CFLAGS += -D_LARGEFILE64_SOURCE=1
# for timerisset()
CFLAGS += -D_DARWIN_C_SOURCE
CFLAGS += -I/opt/local/include
CFLAGS += -I/opt/local/include/libxml2
VERSION_FULL := $(shell sed -n '/"/{s/.*"\(.*\)".*/\1/;p;}' desktop/version.c)
VERSION_MAJ := $(shell sed -n '/_major/{s/.* = \([0-9]*\).*/\1/;p;}' desktop/version.c)
VERSION_MIN := $(shell sed -n '/_minor/{s/.* = \([0-9]*\).*/\1/;p;}' desktop/version.c)
ifeq ($(HOST),macosx)
CFLAGS +=
else
endif
LDFLAGS += -Wl,-framework,Cocoa $(NETLDFLAGS)
$(eval $(call feature_enabled,NSSVG,-DWITH_NS_SVG,-lsvgtiny,SVG (libsvgtiny)))
ifeq ($(HOST),macosx)
CFLAGS += -I$(PREFIX)/include
LDFLAGS += -L$(PREFIX)/lib
$(eval $(call feature_enabled,BMP,-DWITH_BMP,-lnsbmp,BMP (libnsbmp)))
$(eval $(call feature_enabled,GIF,-DWITH_GIF,-lnsgif,GIF (libnsgif)))
$(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng) ))
else
NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG
$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add,PNG,libpng,PNG ))
endif
# ----------------------------------------------------------------------------
# Source file setup
# ----------------------------------------------------------------------------
# S_COCOA are sources purely for the Mac OS X build
S_COCOA := \
BrowserView.m \
BrowserWindow.m \
DownloadWindowController.m \
NetSurfAppDelegate.m \
NetsurfApp.m \
ScrollableView.m \
TreeView.m \
bitmap.m \
fetch.m \
font.m \
gui.m \
plotter.m \
save.m \
schedule.m \
selection.m \
thumbnail.m \
url.m \
utf8.m \
utils.m
S_COCOA := $(addprefix cocoa/,$(S_COCOA))
# complete source file list
SOURCES := $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_COCOA)
EXETARGET := NetSurf