Add files from parent branch HEAD:
[pkgsrcv2.git] / lang / sun-jre6 / builtin.mk
1 # $NetBSD: builtin.mk,v 1.3 2008/10/25 18:05:03 adrianp Exp $
2
3 BUILTIN_PKG:=   sun-jre6
4
5 BUILTIN_FIND_FILES_VAR:=        JAVAVM6
6 BUILTIN_FIND_FILES.JAVAVM6=     \
7         /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home \
8         /usr/jdk/instances/jdk1.6.0
9
10 .include "../../mk/buildlink3/bsd.builtin.mk"
11
12 ###
13 ### Determine if there is a built-in implementation of the package and
14 ### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
15 ###
16 .if !defined(IS_BUILTIN.sun-jre6)
17 .  if empty(JAVAVM6:M__nonexistent__)
18 IS_BUILTIN.sun-jre6=    yes
19 .  else
20 IS_BUILTIN.sun-jre6=    no
21 .  endif
22 .endif
23 MAKEVARS+=      IS_BUILTIN.sun-jre6
24
25 ###
26 ### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
27 ### a package name to represent the built-in package.
28 ###
29 .if !defined(BUILTIN_PKG.sun-jre6) && \
30     !empty(IS_BUILTIN.sun-jre6:M[yY][eE][sS]) && \
31     empty(JAVAVM6:M__nonexistent__)
32
33 BUILTIN_VERSION.sun-jre6!= ${JAVAVM6}/bin/java -version 2>&1 | ${HEAD} -1 | \
34         ${AWK} -F \" '{print $$2}' | ${AWK} -F _ '{print $$1}'
35
36 BUILTIN_PKG.sun-jre6=   sun-jre6-${BUILTIN_VERSION.sun-jre6}
37 .endif
38 MAKEVARS+=      BUILTIN_PKG.sun-jre6
39
40 ###
41 ### Determine whether we should use the built-in implementation if it
42 ### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
43 ###
44 .if !defined(USE_BUILTIN.sun-jre6)
45 .  if ${PREFER.sun-jre6} == "pkgsrc"
46 USE_BUILTIN.sun-jre6=   no
47 .  else
48 USE_BUILTIN.sun-jre6=   ${IS_BUILTIN.sun-jre6}
49 .    if defined(BUILTIN_PKG.sun-jre6) && \
50         !empty(IS_BUILTIN.sun-jre6:M[yY][eE][sS])
51 USE_BUILTIN.sun-jre6=   yes
52 .      for _dep_ in ${BUILDLINK_API_DEPENDS.sun-jre6}
53 .        if !empty(USE_BUILTIN.sun-jre6:M[yY][eE][sS])
54 USE_BUILTIN.sun-jre6!=                                          \
55         if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.sun-jre6:Q}; then \
56                 ${ECHO} yes;                                            \
57         else                                                            \
58                 ${ECHO} no;                                             \
59         fi
60 .        endif
61 .      endfor
62 .    endif
63 .  endif  # PREFER.sun-jre6
64 .endif
65 MAKEVARS+=      USE_BUILTIN.sun-jre6
66
67 ###
68 ### The section below only applies if we are not including this file
69 ### solely to determine whether a built-in implementation exists.
70 ###
71 CHECK_BUILTIN.sun-jre6?=        no
72 .if !empty(CHECK_BUILTIN.sun-jre6:M[nN][oO])
73 .  if !empty(USE_BUILTIN.sun-jre6:M[yY][eE][sS])
74 PKG_JAVA_HOME=  ${JAVAVM6}
75 .  endif
76 .endif