Merge from vendor branch TNF:
[pkgsrcv2.git] / x11 / Xrandr-mixedcase / builtin.mk
1 # $NetBSD: builtin.mk,v 1.12 2005/06/03 19:12:49 jlam Exp $
2
3 BUILTIN_PKG:=   Xrandr
4
5 BUILTIN_FIND_FILES_VAR:=        H_XRANDR
6 BUILTIN_FIND_FILES.H_XRANDR=    ${X11BASE}/include/X11/extensions/Xrandr.h
7
8 .include "../../mk/buildlink3/bsd.builtin.mk"
9
10 ###
11 ### Determine if there is a built-in implementation of the package and
12 ### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
13 ###
14 .if !defined(IS_BUILTIN.Xrandr)
15 IS_BUILTIN.Xrandr=      no
16 .  if exists(${H_XRANDR})
17 BUILTIN_IMAKE_CHECK:=   Xrandr:BuildRandRLibrary
18 .    include "../../mk/buildlink3/imake-check.mk"
19 IS_BUILTIN.Xrandr=      ${BUILTIN_IMAKE_CHECK.Xrandr}
20 .  endif
21 .endif
22 MAKEVARS+=      IS_BUILTIN.Xrandr
23
24 ###
25 ### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
26 ### a package name to represent the built-in package.
27 ###
28 .if !defined(BUILTIN_PKG.Xrandr) && \
29     !empty(IS_BUILTIN.Xrandr:M[yY][eE][sS]) && \
30     exists(${H_XRANDR})
31 #                                                                              
32 # Xrandr doesn't provide a method of discovering the version number of         
33 # the software.  Match up Xrandr versions with X11 versions for an         
34 # approximate determination of the Xrandr version.                             
35 #                                                                              
36 _BLTN_XRANDR_VERSIONS=          1.0.2  1.0.1  1.0  0.99
37 _BLTN_XRANDR_0.99.XFree86=      4.2 4.2.*
38 _BLTN_XRANDR_1.0.XFree86=       4.3 4.3.[0-9] 4.3.[0-9].*               \
39                                 4.3.[1-8][0-9]* 4.3.9[0-8]*             \
40                                 4.3.99.* 4.[4-9]* 4.[1-9][0-9]*
41 _BLTN_XRANDR_1.0.xorg=          6.[7-9]* 6.[1-9][0-9]*
42 .  for _version_ in ${_BLTN_XRANDR_VERSIONS}
43 .    for _pattern_ in ${_BLTN_XRANDR_${_version_}.${BUILTIN_X11_TYPE.${X11_TYPE}}}
44 .      if defined(BUILTIN_X11_VERSION.${X11_TYPE}) && \
45           !empty(BUILTIN_X11_VERSION.${X11_TYPE}:M${_pattern_})
46 BUILTIN_VERSION.Xrandr?=        ${_version_}
47 .      endif
48 .    endfor
49 .  endfor
50 .  if defined(BUILTIN_VERSION.Xrandr)
51 BUILTIN_PKG.Xrandr=     Xrandr-${BUILTIN_VERSION.Xrandr}
52 .  endif
53 .endif
54 MAKEVARS+=      BUILTIN_PKG.Xrandr
55
56 ###
57 ### Determine whether we should use the built-in implementation if it
58 ### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
59 ###
60 #
61 # These are dependencies of Xrandr.  If we need to use the pkgsrc
62 # versions of any of these, then also use the pkgsrc version of
63 # Xrandr.
64 #
65 .if defined(USE_BUILTIN.Xrender) && !empty(USE_BUILTIN.Xrender:M[nN][oO])
66 USE_BUILTIN.Xrender=    no
67 .endif
68 .if defined(USE_BUILTIN.randrext) && !empty(USE_BUILTIN.randrext:M[nN][oO])
69 USE_BUILTIN.randrext=   no
70 .endif
71
72 .if !defined(USE_BUILTIN.Xrandr)
73 .  if ${PREFER.Xrandr} == "pkgsrc"
74 USE_BUILTIN.Xrandr=     no
75 .  else
76 USE_BUILTIN.Xrandr=     ${IS_BUILTIN.Xrandr}
77 .    if defined(BUILTIN_PKG.Xrandr) && \
78         !empty(IS_BUILTIN.Xrandr:M[yY][eE][sS])
79 USE_BUILTIN.Xrandr=     yes
80 .      for _dep_ in ${BUILDLINK_DEPENDS.Xrandr}
81 .        if !empty(USE_BUILTIN.Xrandr:M[yY][eE][sS])
82 USE_BUILTIN.Xrandr!=                                                    \
83         if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.Xrandr:Q}; then \
84                 ${ECHO} yes;                                            \
85         else                                                            \
86                 ${ECHO} no;                                             \
87         fi
88 .        endif
89 .      endfor
90 .    endif
91 .  endif  # PREFER.Xrandr
92 .endif
93 MAKEVARS+=      USE_BUILTIN.Xrandr
94
95 ###
96 ### The section below only applies if we are not including this file
97 ### solely to determine whether a built-in implementation exists.
98 ###
99 CHECK_BUILTIN.Xrandr?=  no
100 .if !empty(CHECK_BUILTIN.Xrandr:M[nN][oO])
101
102 .  if !empty(USE_BUILTIN.Xrandr:M[nN][oO])
103 BUILDLINK_DEPENDS.Xrandr+=      Xrandr>=1.0.1
104 BUILDLINK_DEPENDS.Xrender+=     Xrender>=0.8
105 .  endif
106
107 .  if !empty(USE_BUILTIN.Xrandr:M[yY][eE][sS])
108 BUILDLINK_PREFIX.Xrandr=        ${X11BASE}
109 USE_BUILTIN.Xrender=            yes
110 USE_BUILTIN.randrext=           yes
111 .  endif
112
113 .endif  # CHECK_BUILTIN.Xrandr