1 # $NetBSD: builtin.mk,v 1.1 2010/08/25 10:44:40 obache Exp $
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"
15 ### Determine if there is a built-in implementation of the package and
16 ### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
18 .if
!defined
(IS_BUILTIN.xz
)
20 . if empty
(H_LZMA
:M__nonexistent__
) && empty
(H_LZMA
:M
${LOCALBASE}/*)
24 MAKEVARS
+= IS_BUILTIN.xz
27 ### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
28 ### a package name to represent the built-in package.
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") { \
42 END { printf "%s%s%s%s\n", M, m, p, s} \
45 BUILTIN_PKG.xz
= xz-
${BUILTIN_VERSION.xz
}
47 MAKEVARS
+= BUILTIN_PKG.xz
50 ### Determine whether we should use the built-in implementation if it
51 ### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
53 .if
!defined
(USE_BUILTIN.xz
)
54 . if
${PREFER.xz
} == "pkgsrc"
57 USE_BUILTIN.xz
= ${IS_BUILTIN.xz
}
58 . if defined
(BUILTIN_PKG.xz
) && \
59 !empty
(IS_BUILTIN.xz
:M
[yY
][eE
][sS
])
61 . for _dep_ in
${BUILDLINK_API_DEPENDS.xz
}
62 . if
!empty
(USE_BUILTIN.xz
:M
[yY
][eE
][sS
])
64 if
${PKG_ADMIN} pmatch
${_dep_
:Q
} ${BUILTIN_PKG.xz
:Q
}; then \
72 _INCOMPAT_XZ?
= # empty
73 . for _pattern_ in
${_INCOMPAT_XZ} ${INCOMPAT_XZ}
74 . if
!empty
(MACHINE_PLATFORM
:M
${_pattern_})
80 MAKEVARS
+= USE_BUILTIN.xz
82 # if USE_XZ is defined, then force the use of a true xz
86 . if
!empty
(IS_BUILTIN.xz
:M
[nN
][oO
])
92 ### The section below only applies if we are not including this file
93 ### solely to determine whether a built-in implementation exists.
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
104 .
endif # CHECK_BUILTIN.xz