summaryrefslogtreecommitdiff
path: root/devel/libevent/builtin.mk
blob: e3f03b7f5970ce5bcc867bb8641455179a2ce291 (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
# $NetBSD: builtin.mk,v 1.13 2014/12/05 14:06:28 pettai Exp $

BUILTIN_PKG:=	libevent

BUILTIN_FIND_HEADERS_VAR:=		H_LIBEVENT H_LIBEVENTCONFIG
BUILTIN_FIND_HEADERS.H_LIBEVENT=	event.h
BUILTIN_FIND_HEADERS.H_LIBEVENTCONFIG=	event-config.h event2/event-config.h

.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.libevent)
IS_BUILTIN.libevent=	no
.  if empty(H_LIBEVENT:M__nonexistent__) && empty(H_LIBEVENT:M${LOCALBASE}/*)
IS_BUILTIN.libevent=	yes
.  endif
.endif	# IS_BUILTIN.libevent
MAKEVARS+=	IS_BUILTIN.libevent

###
### 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.libevent) && \
    !empty(IS_BUILTIN.libevent:M[yY][eE][sS]) && \
    empty(H_LIBEVENT:M__nonexistent__)
.  if empty(H_LIBEVENTCONFIG:M__nonexistent__)
_BLTN_EVENT_1_4_11!= \
	${GREP} -c 1.4.11-stable ${H_LIBEVENTCONFIG} || ${TRUE}
_BLTN_EVENT_1_4_12!= \
	${GREP} -c 1.4.12-stable ${H_LIBEVENTCONFIG} || ${TRUE}
_BLTN_EVENT_2_0_21!= \
	${GREP} -c 2.0.21-stable ${H_LIBEVENTCONFIG} || ${TRUE}
.    if ${_BLTN_EVENT_2_0_21} == "1"
BUILTIN_VERSION.libevent=	2.0.21
.    elif ${_BLTN_EVENT_1_4_12} == "1"
BUILTIN_VERSION.libevent=	1.4.12
.    elif ${_BLTN_EVENT_1_4_11} == "1"
BUILTIN_VERSION.libevent=	1.4.11
.    else
BUILTIN_VERSION.libevent=	1.4.4
.    endif
.  else
# libevent>=1.3: bufferevent_base_set added
_BLTN_EVENT_13!=	\
	${GREP} -c bufferevent_base_set ${H_LIBEVENT} || ${TRUE}
# libevent>=1.2: evtag_*, event_base_free added
_BLTN_EVENT_12!=	\
	${GREP} -c evtag_ ${H_LIBEVENT} || ${TRUE}
# libevent>=1.1b: evbuffer_add_vprintf added
_BLTN_EVENT_11b!=	\
	${GREP} -c evbuffer_add_vprintf ${H_LIBEVENT} || ${TRUE}
# libevent>=1.0d: evbuffer_readline added
_BLTN_EVENT_10d!=	\
	${GREP} -c event_base_loopexit ${H_LIBEVENT} || ${TRUE}
# libevent>=1.0c: event_set_log_callback, event_base_loopexit and
#                 event_get_{version,method} added
_BLTN_EVENT_10c!=	\
	${GREP} -c event_base_loopexit ${H_LIBEVENT} || ${TRUE}
# libevent>=1.0: event_base_* and event_priority_* added
_BLTN_EVENT_10!=	\
	${GREP} -c event_base_ ${H_LIBEVENT} || ${TRUE}
# libevent>=0.9: evbuffer_{expand,remove} added
_BLTN_EVENT_09!=	\
	${GREP} -c evbuffer_expand ${H_LIBEVENT} || ${TRUE}
# libevent>=0.8: buffering functions added
_BLTN_EVENT_08!=	\
	${GREP} -c evbuffer ${H_LIBEVENT} || ${TRUE}
# libevent>=0.7b: WIN32 support added
_BLTN_EVENT_07b!=	\
	${GREP} -c WIN32 ${H_LIBEVENT} || ${TRUE}
# libevent>=0.6: evtimer_* added
_BLTN_EVENT_06!=	\
	${GREP} -c evtimer_ ${H_LIBEVENT} || ${TRUE}

.    if ${_BLTN_EVENT_13} == "1"
BUILTIN_VERSION.libevent=	1.3
.    elif ${_BLTN_EVENT_12} == "1"
BUILTIN_VERSION.libevent=	1.2
.    elif ${_BLTN_EVENT_11b} == "1"
BUILTIN_VERSION.libevent=	1.1b
.    elif ${_BLTN_EVENT_10d} == "1"
BUILTIN_VERSION.libevent=	1.0d
.    elif ${_BLTN_EVENT_10c} == "1"
BUILTIN_VERSION.libevent=	1.0c
.    elif ${_BLTN_EVENT_10} == "1"
BUILTIN_VERSION.libevent=	1.0
.    elif ${_BLTN_EVENT_09} == "1"
BUILTIN_VERSION.libevent=	0.9
.    elif ${_BLTN_EVENT_08} == "1"
BUILTIN_VERSION.libevent=	0.8
.    elif ${_BLTN_EVENT_07b} == "1"
BUILTIN_VERSION.libevent=	0.7b
.    elif ${_BLTN_EVENT_06} == "1"
BUILTIN_VERSION.libevent=	0.6
.    else
BUILTIN_VERSION.libevent=	0.5
.    endif
.  endif
BUILTIN_PKG.libevent=	libevent-${BUILTIN_VERSION.libevent}
.endif
MAKEVARS+=	BUILTIN_PKG.libevent

###
### 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.libevent)
.  if ${PREFER.libevent} == "pkgsrc"
USE_BUILTIN.libevent=	no
.  else
USE_BUILTIN.libevent=	${IS_BUILTIN.libevent}
.    if defined(BUILTIN_PKG.libevent) && \
        !empty(IS_BUILTIN.libevent:M[yY][eE][sS])
USE_BUILTIN.libevent=	yes
.      for _dep_ in ${BUILDLINK_API_DEPENDS.libevent}
.        if !empty(USE_BUILTIN.libevent:M[yY][eE][sS])
USE_BUILTIN.libevent!=							\
	if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.libevent:Q}; then \
		${ECHO} yes;						\
	else								\
		${ECHO} no;						\
	fi
.        endif
.      endfor
.    endif
.  endif  # PREFER.libevent
.endif
MAKEVARS+=	USE_BUILTIN.libevent