summaryrefslogtreecommitdiffstats
path: root/contrib/fontconfig/module.defs
blob: 24bccd8a3697c3a3ab2d08e7e8536dfde21ebbd8 (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
96
97
98
99
100
101
102
103
__deps__ := FREETYPE LIBXML2 LIBICONV
$(eval $(call import.MODULE.defs,FONTCONFIG,fontconfig,$(__deps__)))
$(eval $(call import.CONTRIB.defs,FONTCONFIG))

FONTCONFIG.FETCH.url     = https://download.handbrake.fr/handbrake/contrib/fontconfig-2.12.1.tar.bz2
FONTCONFIG.FETCH.url    += https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.12.1.tar.bz2
FONTCONFIG.FETCH.sha256  = b449a3e10c47e1d1c7a6ec6e2016cca73d3bd68fbbd4f0ae5cc6b573f7d6c7f3

#
# 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 ifeq ($(BUILD.system),solaris)
    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 ?c_std ?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 ?c_std ?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 ?c_std ?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=~/Library/Caches/fontconfig \
    --with-default-fonts=/Library/Fonts \
    --with-add-fonts=/System/Library/Fonts,~/Library/Fonts
else ifeq (linux,$(BUILD.system))
FONTCONFIG.CONFIGURE.extra += \
    --with-fcpath=/etc/fonts \
    --with-cache-dir=/var/cache/fontconfig
endif

# work around Debian bug #768312
FONTCONFIG.CONFIGURE.extra += --disable-docs

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