summaryrefslogtreecommitdiff
path: root/x11/Xrender/builtin.mk
blob: 69aae99d4e40bee5ca94ce7d52c7ab7eb7ea7c05 (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
117
118
119
120
# $NetBSD: builtin.mk,v 1.10 2005/06/03 17:02:36 jlam Exp $

BUILTIN_PKG:=	Xrender

BUILTIN_FIND_FILES_VAR:=	H_XRENDER
BUILTIN_FIND_FILES.H_XRENDER=	${X11BASE}/include/X11/extensions/Xrender.h

.include "../../mk/buildlink3/bsd.builtin.mk"

###
### Determine if there is a built-in implementation of the package and
### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
###
.if !defined(IS_BUILTIN.Xrender)
IS_BUILTIN.Xrender=	no
.  if exists(${H_XRENDER})
PKGSRC_USE_TOOLS+=	imake			# XXX
IMAKE?=			${X11BASE}/bin/imake	# XXX
_BUILTIN_IMAKE_CMD=	${IMAKE:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}
.    if exists(${_BUILTIN_IMAKE_CMD})
IS_BUILTIN.Xrender!=							\
	dir=`cd ${BUILDLINK_PKGSRCDIR.Xrender} && ${PWD_CMD}`;		\
	cd ${TMPDIR:U/tmp:Q} && 					\
	${IMAKE} -DUseInstalled -I${X11BASE}/lib/X11/config		\
		-f $$dir/builtin-imake.mk -C builtin-imake.$$$$.c	\
		-s - |							\
	${IMAKE_MAKE} -f - builtin-test
.    endif
.  endif
.endif
MAKEVARS+=	IS_BUILTIN.Xrender

###
### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
### a package name to represent the built-in package.
###
.if !defined(BUILTIN_PKG.Xrender) && \
    !empty(IS_BUILTIN.Xrender:M[yY][eE][sS]) && \
    exists(${H_XRENDER})
#
# Xrender doesn't provide a method of discovering the version number of
# the software.  Match up Xrender versions with X11 versions for an
# approximate determination of the Xrender version.
#
_BLTN_XRENDER_VERSIONS=		0.8.3  0.8.2  0.8.1  0.8  0.2  0.1
_BLTN_XRENDER_0.1.XFree86=	4.0 4.0.* 4.1 4.1.[0-9] 4.1.[0-9].*	\
				4.1.[1-8][0-9]* 4.1.9[0-8]*
_BLTN_XRENDER_0.2.XFree86=	4.1.99.* 4.2 4.2.[0-9] 4.2.[0-9].*	\
				4.2.[1-8][0-9]* 4.2.9[0-8]*
_BLTN_XRENDER_0.8.XFree86=	4.2.99.* 4.3 4.3.[0-9] 4.3.[0-9].*	\
				4.3.[1-8][0-9]* 4.3.9[0-8]*		\
				4.3.99.* 4.[4-9]* 4.[1-9][0-9]*
_BLTN_XRENDER_0.8.xorg=		6.[7-9]* 6.[1-9][0-9]*
.  for _version_ in ${_BLTN_XRENDER_VERSIONS}
.    for _pattern_ in ${_BLTN_XRENDER_${_version_}.${BUILTIN_X11_TYPE.${X11_TYPE}}}
.      if !empty(BUILTIN_X11_VERSION.${X11_TYPE}:M${_pattern_})
BUILTIN_VERSION.Xrender?=	${_version_}
.      endif
.    endfor
.  endfor
.  if defined(BUILTIN_VERSION.Xrender)
BUILTIN_PKG.Xrender=	Xrender-${BUILTIN_VERSION.Xrender}
.  endif
.endif
MAKEVARS+=	BUILTIN_PKG.Xrender

###
### Determine whether we should use the built-in implementation if it
### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
###
#
# These are dependencies of Xrender.  If we need to use the pkgsrc
# versions of any of these, then also use the pkgsrc version of
# Xrender.
#
#.if defined(USE_BUILTIN.render) && !empty(USE_BUILTIN.render:M[nN][oO])
#USE_BUILTIN.render=	no
#.endif

.if !defined(USE_BUILTIN.Xrender)
.  if ${PREFER.Xrender} == "pkgsrc"
USE_BUILTIN.Xrender=	no
.  else
USE_BUILTIN.Xrender=	${IS_BUILTIN.Xrender}
.    if defined(BUILTIN_PKG.Xrender) && \
        !empty(IS_BUILTIN.Xrender:M[yY][eE][sS])
USE_BUILTIN.Xrender=	yes
.      for _dep_ in ${BUILDLINK_DEPENDS.Xrender}
.        if !empty(USE_BUILTIN.Xrender:M[yY][eE][sS])
USE_BUILTIN.Xrender!=							\
	if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.Xrender:Q}; then \
		${ECHO} yes;						\
	else								\
		${ECHO} no;						\
	fi
.        endif
.      endfor
.    endif
.  endif  # PREFER.Xrender
.endif
MAKEVARS+=	USE_BUILTIN.Xrender

###
### The section below only applies if we are not including this file
### solely to determine whether a built-in implementation exists.
###
CHECK_BUILTIN.Xrender?=	no
.if !empty(CHECK_BUILTIN.Xrender:M[nN][oO])

.  if !empty(USE_BUILTIN.Xrender:M[nN][oO])
BUILDLINK_DEPENDS.Xrender+=	Xrender>=0.8.2
BUILDLINK_DEPENDS.render+=	Xrender>=0.8
.  endif

.  if !empty(USE_BUILTIN.Xrender:M[yY][eE][sS])
BUILDLINK_PREFIX.Xrender=	${X11BASE}
USE_BUILTIN.render=		yes
.  endif

.endif	# CHECK_BUILTIN.Xrender