blob: ddcdf6b533ef8a799ca86192d3033a7a6351dbf5 (
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
121
122
123
124
125
126
127
128
129
130
131
132
133
|
# $NetBSD: builtin.mk,v 1.5 2018/04/29 21:18:16 ryoon Exp $
BUILTIN_PKG:= xz
BUILTIN_FIND_HEADERS_VAR:= H_LZMA H_LZMA_VERSION
BUILTIN_FIND_HEADERS.H_LZMA= lzma.h
BUILTIN_FIND_HEADERS.H_LZMA_VERSION=lzma/version.h
BUILTIN_FIND_GREP.H_LZMA= LZMA_
.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.xz)
IS_BUILTIN.xz= no
. if empty(H_LZMA:M__nonexistent__) && empty(H_LZMA:M${LOCALBASE}/*)
IS_BUILTIN.xz= yes
. endif
.endif
MAKEVARS+= IS_BUILTIN.xz
###
### 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.xz) && \
!empty(IS_BUILTIN.xz:M[yY][eE][sS])
BUILTIN_VERSION.xz!= \
${AWK} 'BEGIN { M = "0" } \
/\#define[ ]+LZMA_VERSION_MAJOR/ { M = $$3 } \
/\#define[ ]+LZMA_VERSION_MINOR/ { m = "."$$3 } \
/\#define[ ]+LZMA_VERSION_PATCH/ { p = "."$$3 } \
/\#define[ ]+LZMA_VERSION_STABILITY[ ]+/ { \
if (split($$3, ss, /_/) == 4 && ss[4] != "STABLE") { \
s = tolower(ss[4]) \
} \
} \
END { printf "%s%s%s%s\n", M, m, p, s} \
' ${H_LZMA_VERSION:Q}
BUILTIN_PKG.xz= xz-${BUILTIN_VERSION.xz}
.endif
MAKEVARS+= BUILTIN_PKG.xz
###
### Determine whether we should use the built-in implementation if it
### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
###
.if !defined(USE_BUILTIN.xz)
. if ${PREFER.xz} == "pkgsrc"
USE_BUILTIN.xz= no
. else
USE_BUILTIN.xz= ${IS_BUILTIN.xz}
. if defined(BUILTIN_PKG.xz) && \
!empty(IS_BUILTIN.xz:M[yY][eE][sS])
USE_BUILTIN.xz= yes
. for _dep_ in ${BUILDLINK_API_DEPENDS.xz}
. if !empty(USE_BUILTIN.xz:M[yY][eE][sS])
USE_BUILTIN.xz!= \
if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.xz:Q}; then \
${ECHO} yes; \
else \
${ECHO} no; \
fi
. endif
. endfor
. endif
_INCOMPAT_XZ?= # empty
. for _pattern_ in ${_INCOMPAT_XZ} ${INCOMPAT_XZ}
. if !empty(MACHINE_PLATFORM:M${_pattern_})
USE_BUILTIN.xz= no
. endif
. endfor
. endif # PREFER.xz
.endif
MAKEVARS+= USE_BUILTIN.xz
# if USE_XZ is defined, then force the use of a true xz
# implementation.
#
.if defined(USE_XZ)
. if !empty(IS_BUILTIN.xz:M[nN][oO])
USE_BUILTIN.xz= no
. endif
.endif
###
### The section below only applies if we are not including this file
### solely to determine whether a built-in implementation exists.
###
CHECK_BUILTIN.xz?= no
.if !empty(CHECK_BUILTIN.xz:M[nN][oO])
. if !empty(USE_BUILTIN.xz:M[yY][eE][sS])
BUILDLINK_FILES.xz+= lib/pkgconfig/xz.pc
. endif
# Fake pkg-config for builtin xz on NetBSD
.if !empty(USE_BUILTIN.xz:M[yY][eE][sS])
. if !empty(USE_TOOLS:C/:.*//:Mpkg-config)
do-configure-pre-hook: override-liblzma-pkgconfig
BLKDIR_PKGCFG= ${BUILDLINK_DIR}/lib/pkgconfig
LIBLZMA_PKGCFGF= liblzma.pc
override-liblzma-pkgconfig: override-message-liblzma-pkgconfig
override-message-liblzma-pkgconfig:
@${STEP_MSG} "Generating pkg-config files for builtin xz package."
override-liblzma-pkgconfig:
${RUN} \
${MKDIR} ${BLKDIR_PKGCFG}; \
{ \
${ECHO} "prefix=${LIBLZMA_PREFIX}"; \
${ECHO} "exec_prefix=\$${prefix}"; \
${ECHO} "libdir=\$${exec_prefix}/lib"; \
${ECHO} "includedir=\$${prefix}/include"; \
${ECHO} ""; \
${ECHO} "Name: liblzma"; \
${ECHO} "Description: Generic purpose data compression library"; \
${ECHO} "Version: ${BUILTIN_VERSION.xz}"; \
${ECHO} "Libs: ${COMPILER_RPATH_FLAG}\$${libdir} -L\$${libdir} -llzma"; \
${ECHO} "Libs.private: -pthread"; \
${ECHO} "Cflags: -I\$${includedir}"; \
} >> ${BLKDIR_PKGCFG}/${LIBLZMA_PKGCFGF};
. endif
.endif
.endif # CHECK_BUILTIN.xz
|