Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / archivers / xz / builtin.mk
blob46d790d1eca5be36c382c446ba8e4d46a8253b89
1 # $NetBSD: builtin.mk,v 1.1 2010/08/25 10:44:40 obache Exp $
3 BUILTIN_PKG:= xz
5 BUILTIN_FIND_FILES_VAR:= H_LZMA H_LZMA_VERSION
6 BUILTIN_FIND_FILES.H_LZMA= /usr/include/lzma.h \
7 /boot/common/include/lzma.h
8 BUILTIN_FIND_FILES.H_LZMA_VERSION=/usr/include/lzma/version.h \
9 /boot/common/include/lzma/version.h
10 BUILTIN_FIND_GREP.H_LZMA= LZMA_
12 .include "../../mk/buildlink3/bsd.builtin.mk"
14 ###
15 ### Determine if there is a built-in implementation of the package and
16 ### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
17 ###
18 .if !defined(IS_BUILTIN.xz)
19 IS_BUILTIN.xz= no
20 . if empty(H_LZMA:M__nonexistent__) && empty(H_LZMA:M${LOCALBASE}/*)
21 IS_BUILTIN.xz= yes
22 . endif
23 .endif
24 MAKEVARS+= IS_BUILTIN.xz
26 ###
27 ### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
28 ### a package name to represent the built-in package.
29 ###
30 .if !defined(BUILTIN_PKG.xz) && \
31 !empty(IS_BUILTIN.xz:M[yY][eE][sS])
32 BUILTIN_VERSION.xz!= \
33 ${AWK} 'BEGIN { M = "0" } \
34 /\#define[ ]+LZMA_VERSION_MAJOR/ { M = $$3 } \
35 /\#define[ ]+LZMA_VERSION_MINOR/ { m = "."$$3 } \
36 /\#define[ ]+LZMA_VERSION_PATCH/ { p = "."$$3 } \
37 /\#define[ ]+LZMA_VERSION_STABILITY[ ]+/ { \
38 if (split($$3, ss, /_/) == 4 && ss[4] != "STABLE") { \
39 s = tolower(ss[4]) \
40 } \
41 } \
42 END { printf "%s%s%s%s\n", M, m, p, s} \
43 ' ${H_LZMA_VERSION:Q}
45 BUILTIN_PKG.xz= xz-${BUILTIN_VERSION.xz}
46 .endif
47 MAKEVARS+= BUILTIN_PKG.xz
49 ###
50 ### Determine whether we should use the built-in implementation if it
51 ### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
52 ###
53 .if !defined(USE_BUILTIN.xz)
54 . if ${PREFER.xz} == "pkgsrc"
55 USE_BUILTIN.xz= no
56 . else
57 USE_BUILTIN.xz= ${IS_BUILTIN.xz}
58 . if defined(BUILTIN_PKG.xz) && \
59 !empty(IS_BUILTIN.xz:M[yY][eE][sS])
60 USE_BUILTIN.xz= yes
61 . for _dep_ in ${BUILDLINK_API_DEPENDS.xz}
62 . if !empty(USE_BUILTIN.xz:M[yY][eE][sS])
63 USE_BUILTIN.xz!= \
64 if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.xz:Q}; then \
65 ${ECHO} yes; \
66 else \
67 ${ECHO} no; \
69 . endif
70 . endfor
71 . endif
72 _INCOMPAT_XZ?= # empty
73 . for _pattern_ in ${_INCOMPAT_XZ} ${INCOMPAT_XZ}
74 . if !empty(MACHINE_PLATFORM:M${_pattern_})
75 USE_BUILTIN.xz= no
76 . endif
77 . endfor
78 . endif # PREFER.xz
79 .endif
80 MAKEVARS+= USE_BUILTIN.xz
82 # if USE_XZ is defined, then force the use of a true xz
83 # implementation.
85 .if defined(USE_XZ)
86 . if !empty(IS_BUILTIN.xz:M[nN][oO])
87 USE_BUILTIN.xz= no
88 . endif
89 .endif
91 ###
92 ### The section below only applies if we are not including this file
93 ### solely to determine whether a built-in implementation exists.
94 ###
96 CHECK_BUILTIN.xz?= no
97 .if !empty(CHECK_BUILTIN.xz:M[nN][oO])
99 . if !empty(USE_BUILTIN.xz:M[yY][eE][sS])
100 BUILDLINK_PREFIX.xz= ${H_LZMA:S/\/include\/lzma.h//}
101 BUILDLINK_FILES.xz+= lib/pkgconfig/xz.pc
102 . endif
104 .endif # CHECK_BUILTIN.xz