summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-04-30 11:56:05 +0100
committerVincent Sanders <vince@kyllikki.org>2014-04-30 11:56:57 +0100
commit56b42943d0ad0d032b2219290a2b7a02fa598466 (patch)
tree4c7b4eb8123aa875ecfbc3fe5f954b7d1816d32e
parent1822b7c1633671cd41e60a04f7eeaf86dcec4141 (diff)
downloadnetsurf-56b42943d0ad0d032b2219290a2b7a02fa598466.tar.gz
netsurf-56b42943d0ad0d032b2219290a2b7a02fa598466.tar.bz2
improve iconv library handling
-rw-r--r--Makefile39
-rw-r--r--atari/Makefile.target2
-rw-r--r--beos/Makefile.target2
-rw-r--r--cocoa/Makefile.target2
-rw-r--r--gtk/Makefile.defaults6
-rw-r--r--windows/Makefile.target3
6 files changed, 46 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 4f9380a8b..864c5bd32 100644
--- a/Makefile
+++ b/Makefile
@@ -314,6 +314,8 @@ DEPROOT := $(OBJROOT)/deps
TOOLROOT := $(OBJROOT)/tools
+# A macro that conditionaly adds flags to the build when a feature is enabled.
+#
# 1: Feature name (ie, NETSURF_USE_BMP -> BMP)
# 2: Parameters to add to CFLAGS
# 3: Parameters to add to LDFLAGS
@@ -335,6 +337,33 @@ define feature_enabled
endif
endef
+# A macro that conditionaly adds flags to the build with a uniform display.
+#
+# 1: Feature name (ie, NETSURF_USE_BMP -> BMP)
+# 2: Human-readable name for the feature
+# 3: Parameters to add to CFLAGS when enabled
+# 4: Parameters to add to LDFLAGS when enabled
+# 5: Parameters to add to CFLAGS when disabled
+# 6: Parameters to add to LDFLAGS when disabled
+define feature_switch
+ ifeq ($$(NETSURF_USE_$(1)),YES)
+ CFLAGS += $(3)
+ LDFLAGS += $(4)
+ ifneq ($(MAKECMDGOALS),clean)
+ $$(info M.CONFIG: $(2) enabled (NETSURF_USE_$(1) := YES))
+ endif
+ else ifeq ($$(NETSURF_USE_$(1)),NO)
+ CFLAGS += $(5)
+ LDFLAGS += $(6)
+ ifneq ($(MAKECMDGOALS),clean)
+ $$(info M.CONFIG: $(2) disabled (NETSURF_USE_$(1) := NO))
+ endif
+ else
+ $$(info M.CONFIG: $(4) error (NETSURF_USE_$(1) := $$(NETSURF_USE_$(1))))
+ $$(error NETSURF_USE_$(1) must be YES or NO)
+ endif
+endef
+
# Extend flags with appropriate values from pkg-config for enabled features
#
# 1: pkg-config required modules for feature
@@ -431,10 +460,14 @@ endif
# Pull in the configuration
include Makefile.defaults
-$(eval $(call feature_enabled,JPEG,-DWITH_JPEG,-ljpeg,JPEG (libjpeg)))
+# Build flags for libjpeg as it has no pkgconfig file
+$(eval $(call feature_switch,JPEG,JPEG (libjpeg),-DWITH_JPEG,-ljpeg,-UWITH_JPEG,))
+
+# Build flags for haru
+$(eval $(call feature_switch,HARU_PDF,PDF export (haru),-DWITH_PDF_EXPORT,-lhpdf -lpng,-UWITH_PDF_EXPORT,))
-$(eval $(call feature_enabled,HARU_PDF,-DWITH_PDF_EXPORT,-lhpdf -lpng,PDF export (haru)))
-$(eval $(call feature_enabled,LIBICONV_PLUG,-DLIBICONV_PLUG,,glibc internal iconv))
+# Build flags for iconv
+$(eval $(call feature_switch,LIBICONV_PLUG,glibc internal iconv,-DLIBICONV_PLUG,,-ULIBICONV_PLUG,-liconv))
# common libraries without pkg-config support
LDFLAGS += -lz
diff --git a/atari/Makefile.target b/atari/Makefile.target
index 60f6e8056..685140099 100644
--- a/atari/Makefile.target
+++ b/atari/Makefile.target
@@ -69,7 +69,7 @@ CFLAGS += -U__STRICT_ANSI__ -std=c99 -Dsmall $(WARNFLAGS) -Dnsatari \
LDFLAGS += -lcflib -lcurl
LDFLAGS += -lcss -lparserutils -ldom -lwapcaplet -lhubbub
LDFLAGS += -lssl -lcrypto
-LDFLAGS += -lz -liconv -lcares -lHermes -lgem -lm
+LDFLAGS += -lz -lcares -lHermes -lgem -lm
LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib
diff --git a/beos/Makefile.target b/beos/Makefile.target
index ed7532dc2..a1259d644 100644
--- a/beos/Makefile.target
+++ b/beos/Makefile.target
@@ -12,7 +12,7 @@ LDFLAGS += -L/boot/common/lib
LDFLAGS += -lssl -lcrypto -lcss
$(eval $(call feature_enabled,NSSVG,-DWITH_NS_SVG,-lsvgtiny,SVG (libsvgtiny)))
LDFLAGS += -ldom -lparserutils -lhubbub -lwapcaplet
-LDFLAGS += -lexpat -lcurl -liconv
+LDFLAGS += -lexpat -lcurl
CFLAGS += -O $(WARNFLAGS) -Dnsbeos -D_BSD_SOURCE -D_POSIX_C_SOURCE \
-Drestrict="" -Wno-multichar
diff --git a/cocoa/Makefile.target b/cocoa/Makefile.target
index e6292c1f7..6e65b1333 100644
--- a/cocoa/Makefile.target
+++ b/cocoa/Makefile.target
@@ -7,7 +7,7 @@ POSTEXES += NetSurf.app
LDFLAGS += -L/usr/lib
LDFLAGS += $(shell $(PKG_CONFIG) --libs libhubbub libcss libdom)
LDFLAGS += -L/usr/X11/lib
-LDFLAGS += -lm -lcurl -liconv
+LDFLAGS += -lm -lcurl
LDFLAGS += -lssl -lcrypto
CFLAGS += -O $(WARNFLAGS) -Dnscocoa -D_BSD_SOURCE -D_POSIX_C_SOURCE \
diff --git a/gtk/Makefile.defaults b/gtk/Makefile.defaults
index 6c48b0cff..eb17cb127 100644
--- a/gtk/Makefile.defaults
+++ b/gtk/Makefile.defaults
@@ -27,6 +27,12 @@ ifeq ($(HOST),macosx)
NETSURF_USE_HARU_PDF := NO
endif
+# Configuration overrides for OpenBSD
+ifeq ($(HOST),OpenBSD)
+ NETSURF_USE_LIBICONV_PLUG := NO
+ NETSURF_USE_HARU_PDF := NO
+endif
+
# Set default GTK version to build for (2 or 3)
NETSURF_GTK_MAJOR := 2
diff --git a/windows/Makefile.target b/windows/Makefile.target
index 87544e3db..93ee50a46 100644
--- a/windows/Makefile.target
+++ b/windows/Makefile.target
@@ -30,8 +30,7 @@ else
LDFLAGS += -lhubbub -lcss -lparserutils -lwapcaplet -lcurl -lz
endif
-LDFLAGS += -lssl -lcrypto -lregex -liconv \
- -lgdi32 -lcomctl32 -lws2_32 -lmsimg32 -mwindows
+LDFLAGS += -lssl -lcrypto -lregex -lgdi32 -lcomctl32 -lws2_32 -lmsimg32 -mwindows
CFLAGS += -U__STRICT_ANSI__ -mwin32
# only windows versions after XP are supported