summaryrefslogtreecommitdiff
path: root/fonts/fontconfig/buildlink3.mk
blob: f1042c82f021da8ba68d6d34c49dd932639174b0 (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
104
105
106
107
108
109
110
111
112
113
114
115
116
# $NetBSD: buildlink3.mk,v 1.11 2004/02/18 16:35:27 jlam Exp $

BUILDLINK_DEPTH:=	${BUILDLINK_DEPTH}+
FONTCONFIG_BUILDLINK3_MK:=	${FONTCONFIG_BUILDLINK3_MK}+

.include "../../mk/bsd.prefs.mk"

.if !empty(FONTCONFIG_BUILDLINK3_MK:M+)
BUILDLINK_PACKAGES+=			fontconfig
BUILDLINK_DEPENDS.fontconfig+=		fontconfig>=1.0.1
BUILDLINK_PKGSRCDIR.fontconfig?=	../../fonts/fontconfig
.endif	# FONTCONFIG_BUILDLINK3_MK

BUILDLINK_CHECK_BUILTIN.fontconfig?=	NO

_FONTCONFIG_FONTCONFIG_H=	${X11BASE}/include/fontconfig/fontconfig.h
_X11_TMPL=			${X11BASE}/lib/X11/config/X11.tmpl

.if !defined(BUILDLINK_IS_BUILTIN.fontconfig)
BUILDLINK_IS_BUILTIN.fontconfig=	NO
.  if exists(${_FONTCONFIG_FONTCONFIG_H}) && exists(${_X11_TMPL})
_IS_BUILTIN.fontconfig!=						\
	if ${GREP} -q BuildFontconfigLibrary ${_X11_TMPL}; then		\
		${ECHO} "YES";						\
	else								\
		${ECHO} "NO";						\
	fi
BUILDLINK_IS_BUILTIN.fontconfig= ${_IS_BUILTIN.fontconfig}
.    if !empty(BUILDLINK_CHECK_BUILTIN.fontconfig:M[nN][oO]) && \
        !empty(_IS_BUILTIN.fontconfig:M[yY][eE][sS])
#
# Create an appropriate package name for the built-in fontconfig distributed
# with the system.  This package name can be used to check against
# BUILDLINK_DEPENDS.<pkg> to see if we need to install the pkgsrc version
# or if the built-in one is sufficient.
#
_FONTCONFIG_MAJOR!=	\
	${AWK} '/\#define[ 	]*FC_MAJOR/ { print $$3 }'		\
		${_FONTCONFIG_FONTCONFIG_H}
_FONTCONFIG_MINOR!=	\
	${AWK} '/\#define[ 	]*FC_MINOR/ { print $$3 }'		\
		${_FONTCONFIG_FONTCONFIG_H}
_FONTCONFIG_REVISION!=	\
	${AWK} '/\#define[ 	]*FC_REVISION/ { print $$3 }'		\
		${_FONTCONFIG_FONTCONFIG_H}
_FONTCONFIG_VERSION=	\
	${_FONTCONFIG_MAJOR}.${_FONTCONFIG_MINOR}.${_FONTCONFIG_REVISION}
_FONTCONFIG_PKG=	fontconfig-${_FONTCONFIG_VERSION}

BUILDLINK_IS_BUILTIN.fontconfig?=	YES
.      for _depend_ in ${BUILDLINK_DEPENDS.fontconfig}
.        if !empty(BUILDLINK_IS_BUILTIN.fontconfig:M[yY][eE][sS])
BUILDLINK_IS_BUILTIN.fontconfig!=		\
	if ${PKG_ADMIN} pmatch '${_depend_}' ${_FONTCONFIG_PKG}; then	\
		${ECHO} "YES";						\
	else								\
		${ECHO} "NO";						\
	fi
.        endif
.      endfor
.    endif
.  endif
MAKEFLAGS+=	\
	BUILDLINK_IS_BUILTIN.fontconfig=${BUILDLINK_IS_BUILTIN.fontconfig}
.endif

.if !empty(BUILDLINK_CHECK_BUILTIN.fontconfig:M[yY][eE][sS])
BUILDLINK_USE_BUILTIN.fontconfig=	YES
.endif

.if !defined(BUILDLINK_USE_BUILTIN.fontconfig)
.  if !empty(BUILDLINK_IS_BUILTIN.fontconfig:M[yY][eE][sS])
BUILDLINK_USE_BUILTIN.fontconfig=	YES
.  else
BUILDLINK_USE_BUILTIN.fontconfig=	NO
.  endif

.  if !empty(PREFER_NATIVE:M[yY][eE][sS]) && \
      !empty(BUILDLINK_IS_BUILTIN.fontconfig:M[yY][eE][sS])
BUILDLINK_USE_BUILTIN.fontconfig=	YES
.  endif
.  if !empty(PREFER_PKGSRC:M[yY][eE][sS])
BUILDLINK_USE_BUILTIN.fontconfig=	NO
.  endif
.  if !empty(PREFER_NATIVE:Mfontconfig) && \
      !empty(BUILDLINK_IS_BUILTIN.fontconfig:M[yY][eE][sS])
BUILDLINK_USE_BUILTIN.fontconfig=	YES
.  endif
.  if !empty(PREFER_PKGSRC:Mfontconfig)
BUILDLINK_USE_BUILTIN.fontconfig=	NO
.  endif
.endif

.if !empty(BUILDLINK_USE_BUILTIN.fontconfig:M[nN][oO])
BUILDLINK_DEPENDS.fontconfig+=	fontconfig>=2.1nb2
.  if !empty(BUILDLINK_DEPTH:M+)
BUILDLINK_DEPENDS+=		fontconfig
.  endif
.endif

.if !empty(FONTCONFIG_BUILDLINK3_MK:M+)
.  if !empty(BUILDLINK_USE_BUILTIN.fontconfig:M[yY][eE][sS])
BUILDLINK_PREFIX.fontconfig=	${X11BASE}
BUILDLINK_FILES.fontconfig+=	lib/pkgconfig/fontconfig.pc
.  endif
USE_X11=	yes
BUILDLINK_DEPENDS.freetype2+=	freetype2>=2.1.3

.  if !empty(BUILDLINK_CHECK_BUILTIN.fontconfig:M[nN][oO])
.    include "../../devel/zlib/buildlink3.mk"
.    include "../../graphics/freetype2/buildlink3.mk"
.    include "../../textproc/expat/buildlink3.mk"
.  endif
.endif	# FONTCONFIG_BUILDLINK3_MK

BUILDLINK_DEPTH:=	${BUILDLINK_DEPTH:S/+$//}