improve iconv library handling

This commit is contained in:
Vincent Sanders 2014-04-30 11:56:05 +01:00
parent 1822b7c163
commit 56b42943d0
6 changed files with 46 additions and 8 deletions

View File

@ -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,))
$(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 haru
$(eval $(call feature_switch,HARU_PDF,PDF export (haru),-DWITH_PDF_EXPORT,-lhpdf -lpng,-UWITH_PDF_EXPORT,))
# 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

View File

@ -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

View File

@ -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

View File

@ -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 \

View File

@ -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

View File

@ -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