summaryrefslogtreecommitdiff
path: root/devel/gettext-lib/buildlink3.mk
blob: 9ed24b3d3178671a7f3cb5a140792d2a9085a243 (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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# $NetBSD: buildlink3.mk,v 1.14 2004/02/12 01:59:37 jlam Exp $

BUILDLINK_DEPTH:=	${BUILDLINK_DEPTH}+
GETTEXT_BUILDLINK3_MK:=	${GETTEXT_BUILDLINK3_MK}+

.include "../../mk/bsd.prefs.mk"

.if !empty(GETTEXT_BUILDLINK3_MK:M+)
BUILDLINK_PACKAGES+=		gettext
BUILDLINK_DEPENDS.gettext+=	gettext-lib>=0.10.35nb1
BUILDLINK_PKGSRCDIR.gettext?=	../../devel/gettext-lib
.endif	# GETTEXT_BUILDLINK3_MK

BUILDLINK_CHECK_BUILTIN.gettext?=	NO

.if !defined(BUILDLINK_IS_BUILTIN.gettext)
BUILDLINK_IS_BUILTIN.gettext=	NO
.  if exists(/usr/include/libintl.h)
BUILDLINK_IS_BUILTIN.gettext=	YES
.    if !empty(BUILDLINK_CHECK_BUILTIN.gettext:M[nN][oO])
#
# Consider the base system libintl to be gettext-lib-0.10.35nb1.
#
_GETTEXT_PKG=		gettext-lib-0.10.35nb1
.      for _depend_ in ${BUILDLINK_DEPENDS.gettext}
.        if !empty(BUILDLINK_IS_BUILTIN.gettext:M[yY][eE][sS])
BUILDLINK_IS_BUILTIN.gettext!=	\
	if ${PKG_ADMIN} pmatch '${_depend_}' ${_GETTEXT_PKG}; then	\
		${ECHO} "YES";						\
	else								\
		${ECHO} "NO";						\
	fi
.        endif
.      endfor
.    endif
.  endif
.  if !empty(BUILDLINK_CHECK_BUILTIN.gettext:M[nN][oO])
#
# The listed platforms have a broken (for the purposes of pkgsrc) version
# of gettext-lib.  
#
_INCOMPAT_GETTEXT=	SunOS-*-*
INCOMPAT_GETTEXT?=	# empty
.    for _pattern_ in ${_INCOMPAT_GETTEXT} ${INCOMPAT_GETTEXT}
.      if !empty(MACHINE_PLATFORM:M${_pattern_})
BUILDLINK_IS_BUILTIN.gettext=	NO
.      endif
.    endfor
.  endif
MAKEFLAGS+=	BUILDLINK_IS_BUILTIN.gettext=${BUILDLINK_IS_BUILTIN.gettext}
.endif

.if !empty(BUILDLINK_IS_BUILTIN.gettext:M[yY][eE][sS])
BUILDLINK_USE_BUILTIN.gettext=	YES
.else
BUILDLINK_USE_BUILTIN.gettext=	NO
.endif

.if !empty(PREFER_PKGSRC:M[yY][eE][sS]) || \
    !empty(PREFER_PKGSRC:Mgettext)
BUILDLINK_USE_BUILTIN.gettext=	NO
.endif

.if defined(USE_GNU_GETTEXT)
BUILDLINK_USE_BUILTIN.gettext=	NO
.endif

.if !empty(BUILDLINK_CHECK_BUILTIN.gettext:M[yY][eE][sS])
BUILDLINK_USE_BUILTIN.gettext=	YES
.endif

.if !empty(BUILDLINK_USE_BUILTIN.gettext:M[nN][oO])
.  if !empty(BUILDLINK_DEPTH:M+)
BUILDLINK_DEPENDS+=	gettext
.  endif
.endif

.if !empty(GETTEXT_BUILDLINK3_MK:M+)
.  if !empty(BUILDLINK_USE_BUILTIN.gettext:M[nN][oO])
_BLNK_LIBINTL=		-lintl
_GETTEXT_ICONV_DEPENDS=	gettext-lib>=0.11.5nb1
.    if !defined(_GETTEXT_NEEDS_ICONV)
_GETTEXT_NEEDS_ICONV?=	NO
.      for _depend_ in ${BUILDLINK_DEPENDS.gettext}
.        if !empty(_GETTEXT_NEEDS_ICONV:M[nN][oO])
_GETTEXT_NEEDS_ICONV!=	\
	if ${PKG_INFO} -qe '${_depend_}'; then				\
		pkg=`cd ${_PKG_DBDIR}; ${PKG_ADMIN} -S lsbest '${_depend_}'`; \
		if ${PKG_INFO} -qN "$$pkg" | ${GREP} -q "libiconv-[0-9]"; then \
			${ECHO} "YES";					\
		else							\
			${ECHO} "NO";					\
		fi;							\
	else								\
		${ECHO} "YES";						\
	fi
.        endif
.      endfor
MAKEFLAGS+=	_GETTEXT_NEEDS_ICONV=${_GETTEXT_NEEDS_ICONV}
.    endif
.    if ${_GETTEXT_NEEDS_ICONV} == "YES"
.      include "../../converters/libiconv/buildlink3.mk"
BUILDLINK_DEPENDS.gettext+=	${_GETTEXT_ICONV_DEPENDS}
_BLNK_LIBINTL+=			${BUILDLINK_LDADD.iconv}
.    endif
.  else
.    if !defined(_BLNK_LIBINTL_FOUND)
_BLNK_LIBINTL_FOUND!=	\
	if [ "`${ECHO} /usr/lib/libintl.*`" = "/usr/lib/libintl.*" ]; then \
		${ECHO} "NO";						\
	else								\
		${ECHO} "YES";						\
	fi
MAKEFLAGS+=	_BLNK_LIBINTL_FOUND=${_BLNK_LIBINTL_FOUND}
.    endif
.    if ${_BLNK_LIBINTL_FOUND} == "YES"
_BLNK_LIBINTL=		-lintl
.    else
_BLNK_LIBINTL=		# empty
BUILDLINK_TRANSFORM+=	l:intl:
.    endif
.  endif

BUILDLINK_LDADD.gettext?=	${_BLNK_LIBINTL}

# Add -lintl to LIBS in CONFIGURE_ENV to work around broken gettext.m4:
# older gettext.m4 does not add -lintl where it should, and the resulting
# configure script fails to detect if libintl.a is the genuine GNU gettext
# or not.
#
.  if defined(GNU_CONFIGURE)
LIBS+=			${BUILDLINK_LDADD.gettext}
CONFIGURE_ENV+=		INTLLIBS="${BUILDLINK_LDADD.gettext}"
.    if !empty(BUILDLINK_USE_BUILTIN.gettext:M[yY][eE][sS])
.      if ${_BLNK_LIBINTL_FOUND} == "YES"
CONFIGURE_ENV+=		gt_cv_func_gnugettext1_libintl="yes"
.      endif
.    endif
.    if !empty(BUILDLINK_USE_BUILTIN.gettext:M[nN][oO])
CONFIGURE_ARGS+=	--with-libintl-prefix=${BUILDLINK_PREFIX.gettext}
.    else
CONFIGURE_ARGS+=	--without-libintl-prefix
.    endif
.  endif
.endif	# GETTEXT_BUILDLINK3_MK

BUILDLINK_DEPTH:=	${BUILDLINK_DEPTH:S/+$//}