summaryrefslogtreecommitdiffstats
path: root/contrib/fontconfig/module.defs
blob: b06300222cde2ff84dd87df5768c1b6cbfefba7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
__deps__ := FREETYPE LIBXML2 LIBICONV
$(eval $(call import.MODULE.defs,FONTCONFIG,fontconfig,$(__deps__)))
$(eval $(call import.CONTRIB.defs,FONTCONFIG))

FONTCONFIG.FETCH.url = http://download.handbrake.fr/handbrake/contrib/fontconfig-2.8.0.tar.gz
FONTCONFIG.EXTRACT.tarbase = fontconfig-2.8.0

#
# Under MinGW:
# 
# - A 'i386-ming32-gcc' $(FONTCONFIG.GCC.gcc) command will be available,
#   and the '-arch <arch>' argument should be omitted, as it will confuse this compiler.
# 
# - The $(FONTCONFIG.GCC.archs) variable is not set.
#   Therefore statically guess the target arch to be i386.
# 
ifeq ($(BUILD.system),mingw)
    FONTCONFIG.cc_archoption      = 
    FONTCONFIG.config_archoption  = --with-arch=i386
else ifeq ($(BUILD.system),linux)
    FONTCONFIG.cc_archoption      = 
else
    FONTCONFIG.cc_archoption      = -arch $(FONTCONFIG.GCC.archs)
    FONTCONFIG.config_archoption  = --with-arch=$(FONTCONFIG.GCC.archs)
endif

#
# Support cross-compiling:
# 
# - Add '-arch <arch>' to CC argument to avoid the need to put a <host_triplet>-gcc
#   trampoline script in the PATH, since fontconfig's configure looks for this when
#   in cross-compile mode. If such a trampoline were used, it would just call "gcc -arch <arch> $@".
# 
# - In the case of MinGW (on i386), a 'i386-ming32-gcc' command will be available,
#   and the '-arch <arch>' argument should be omitted, as it will confuse the compiler.
# 
# The following line overrides the original line in /make/include/contrib.defs,
# but has the -arch argument added (and '$(1)' presubstituted for 'FONTCONFIG').
# 
FONTCONFIG.CONFIGURE.env.CC       = CC="$(FONTCONFIG.GCC.gcc) $(FONTCONFIG.cc_archoption)"

#
# Support cross-compiling:
# - Remove '-arch <arch>' from *FLAGS variables, since fontconfig's configure script
#   needs to be given the freedom to insert that flag as necessary, since there are
#   some trampoline executables that need to be built in the native build architecture
#   (without the -arch flag).
# 
# The following lines override the original lines in /make/include/contrib.defs,
# but have '*archs' removed (and '$(1)' presubstituted for 'FONTCONFIG').
# 
ifeq (max,$(FONTCONFIG.GCC.g))
    ifeq (none,$(FONTCONFIG.GCC.O))
        FONTCONFIG.CONFIGURE.env.CFLAGS   = CFLAGS="-I$(call fn.ABSOLUTE,$(CONTRIB.build/))include $(call fn.ARGS,FONTCONFIG.GCC,*sysroot *minver ?extra .g .O)"
        FONTCONFIG.CONFIGURE.env.CXXFLAGS = CXXFLAGS="-I$(call fn.ABSOLUTE,$(CONTRIB.build/))include $(call fn.ARGS,FONTCONFIG.GCC,*sysroot *minver ?extra .g .O)"
    else
        FONTCONFIG.CONFIGURE.env.CFLAGS   = CFLAGS="-I$(call fn.ABSOLUTE,$(CONTRIB.build/))include $(call fn.ARGS,FONTCONFIG.GCC,*sysroot *minver ?extra .g)"
        FONTCONFIG.CONFIGURE.env.CXXFLAGS = CXXFLAGS="-I$(call fn.ABSOLUTE,$(CONTRIB.build/))include $(call fn.ARGS,FONTCONFIG.GCC,*sysroot *minver ?extra .g)"
    endif
else
    FONTCONFIG.CONFIGURE.env.CFLAGS   = CFLAGS="-I$(call fn.ABSOLUTE,$(CONTRIB.build/))include $(call fn.ARGS,FONTCONFIG.GCC,*sysroot *minver ?extra)"
    FONTCONFIG.CONFIGURE.env.CXXFLAGS = CXXFLAGS="-I$(call fn.ABSOLUTE,$(CONTRIB.build/))include $(call fn.ARGS,FONTCONFIG.GCC,*sysroot *minver ?extra)"
endif

FONTCONFIG.CONFIGURE.env.CPPFLAGS = CPPFLAGS="-I$(call fn.ABSOLUTE,$(CONTRIB.build/))include $(call fn.ARGS,FONTCONFIG.GCC,*sysroot *minver ?extra)"
FONTCONFIG.CONFIGURE.env.LDFLAGS  = LDFLAGS="-L$(call fn.ABSOLUTE,$(CONTRIB.build/))lib $(call fn.ARGS,FONTCONFIG.GCC,*sysroot *minver)"

# 
# Force use of libxml2 instead of expat with --enable-libxml2.
# 
# Tell configure where to find our (cross-compiled) versions of freetype and libxml2.
# 
# Support cross-compiling:
# - Add --with-arch argument since fontconfig's configure isn't smart enough
#   to infer it from the --host argument
# 
FONTCONFIG.CONFIGURE.extra = \
    --enable-libxml2 \
    --with-freetype-config=$(call fn.ABSOLUTE,$(CONTRIB.build/)bin/freetype-config) \
    $(FONTCONFIG.config_archoption) --disable-silent-rules

ifeq (darwin,$(BUILD.system))
FONTCONFIG.CONFIGURE.extra += \
    LIBXML2_LIBS="-L$(call fn.ABSOLUTE,$(CONTRIB.build/))lib -lxml2" \
    LIBXML2_CFLAGS="-I$(call fn.ABSOLUTE,$(CONTRIB.build/))include/libxml2" \
    --with-fcpath=/usr/X11/lib/X11/fontconfig \
    --with-cache-dir=/usr/X11/var/cache/fontconfig
else ifeq (linux,$(BUILD.system))
FONTCONFIG.CONFIGURE.extra += \
    --with-fcpath=/etc/fonts \
    --with-cache-dir=/var/cache/fontconfig
endif

# disable fc-cache test during install phase
FONTCONFIG.INSTALL.extra = RUN_FC_CACHE_TEST=false