summaryrefslogtreecommitdiff
path: root/converters
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2004-04-26 04:53:23 +0000
committerjlam <jlam@pkgsrc.org>2004-04-26 04:53:23 +0000
commit8da51b0fbe1e4cb1ffbd24d9084c4512d344374d (patch)
tree91afaad6f5331b5af9852a9f693c8b81e2b25964 /converters
parent076fee665433ea4383c2bb5840bf1f21e95330bf (diff)
downloadpkgsrc-8da51b0fbe1e4cb1ffbd24d9084c4512d344374d.tar.gz
Do previous in a different way. We want USE_GNU_ICONV to always use
a GNU libiconv, whether it be builtin or not, and PREFER_{NATIVE,PKGSRC} can be used to decide which iconv we use if USE_GNU_ICONV isn't defined. On NetBSD, the native iconv implementation (if it exists) is considered GNUish enough unless USE_GNU_ICONV is explicitly defined.
Diffstat (limited to 'converters')
-rw-r--r--converters/libiconv/builtin.mk92
1 files changed, 73 insertions, 19 deletions
diff --git a/converters/libiconv/builtin.mk b/converters/libiconv/builtin.mk
index 7f77a42169e..e9f815b66dc 100644
--- a/converters/libiconv/builtin.mk
+++ b/converters/libiconv/builtin.mk
@@ -1,4 +1,4 @@
-# $NetBSD: builtin.mk,v 1.3 2004/04/26 00:28:39 snj Exp $
+# $NetBSD: builtin.mk,v 1.4 2004/04/26 04:53:23 jlam Exp $
.if !defined(_LIBICONV_FOUND)
_LIBICONV_FOUND!= \
@@ -14,43 +14,97 @@ _ICONV_H= /usr/include/iconv.h
.if !defined(IS_BUILTIN.iconv)
IS_BUILTIN.iconv= no
-. if exists(${_ICONV_H})
-IS_BUILTIN.iconv= yes
+. if exists(${_ICONV_H}) && !empty(_LIBICONV_FOUND:M[yY][eE][sS])
+IS_BUILTIN.iconv!= \
+ if ${GREP} -q "GNU LIBICONV Library" ${_ICONV_H}; then \
+ ${ECHO} "yes"; \
+ else \
+ ${ECHO} "no"; \
+ fi
. endif
+. if !empty(IS_BUILTIN.iconv:M[yY][eE][sS])
+_ICONV_MAJOR!= \
+ ${AWK} 'BEGIN { hex="0123456789abcdef" } \
+ /\#define[ ]*_LIBICONV_VERSION[ ]/ { \
+ i = 16 * (index(hex, substr($$3, 3, 1)) - 1); \
+ i += index(hex, substr($$3, 4, 1)) - 1; \
+ print i; \
+ exit 0; \
+ } \
+ ' ${_ICONV_H}
+_ICONV_MINOR!= \
+ ${AWK} 'BEGIN { hex="0123456789abcdef" } \
+ /\#define[ ]*_LIBICONV_VERSION[ ]/ { \
+ i = 16 * (index(hex, substr($$3, 5, 1)) - 1); \
+ i += index(hex, substr($$3, 6, 1)) - 1; \
+ print i; \
+ exit 0; \
+ } \
+ ' ${_ICONV_H}
+_ICONV_VERSION= ${_ICONV_MAJOR}.${_ICONV_MINOR}
+#
+# If the native libiconv is ABI version 1.9, then treat it the same as
+# the latest version on the libiconv-1.9.x branch.
+#
+. if ${_ICONV_VERSION} == "1.9"
+_ICONV_VERSION= 1.9.1
+. endif
+BUILTIN_PKG.iconv= libiconv-${_ICONV_VERSION}
+BUILDLINK_VARS+= BUILTIN_PKG.iconv
+. endif
+BUILDLINK_VARS+= IS_BUILTIN.iconv
.endif # IS_BUILTIN.iconv
.if !defined(USE_BUILTIN.iconv)
USE_BUILTIN.iconv?= ${IS_BUILTIN.iconv}
PREFER.iconv?= pkgsrc
+. if defined(BUILTIN_PKG.iconv)
+USE_BUILTIN.iconv= yes
+. for _depend_ in ${BUILDLINK_DEPENDS.iconv}
+. if !empty(IS_BUILTIN.iconv:M[yY][eE][sS])
+USE_BUILTIN.iconv!= \
+ if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.iconv}; then \
+ ${ECHO} "yes"; \
+ else \
+ ${ECHO} "no"; \
+ fi
+. endif
+. endfor
+. endif
+
+. if ${PREFER.iconv} == "native"
+# XXX
+# XXX By default, assume that the native iconv on NetBSD systems
+# XXX supports GNU libiconv's API.
+# XXX
+. if (${OPSYS} == "NetBSD") && exists(${_ICONV_H})
+USE_BUILTIN.iconv= yes
_INCOMPAT_ICONV?= # should be set from defs.${OPSYS}.mk
-. for _pattern_ in ${_INCOMPAT_ICONV} ${INCOMPAT_ICONV}
-. if !empty(MACHINE_PLATFORM:M${_pattern_})
+. for _pattern_ in ${_INCOMPAT_ICONV} ${INCOMPAT_ICONV}
+. if !empty(MACHINE_PLATFORM:M${_pattern_})
USE_BUILTIN.iconv= no
+. endif
+. endfor
. endif
-. endfor
-
-.if !defined(ICONV_TYPE)
-ICONV_TYPE?= gnu
-. if !empty(USE_BUILTIN.iconv:M[yY][eE][sS]) && exists(${_ICONV_H})
-ICONV_TYPE!= \
- if ${GREP} -q "GNU LIBICONV Library" ${_ICONV_H}; then \
- ${ECHO} "gnu"; \
- else \
- ${ECHO} "native"; \
- fi
. endif
-BUILDLINK_VARS+= ICONV_TYPE
-.endif
. if defined(USE_GNU_ICONV)
. if !empty(IS_BUILTIN.iconv:M[nN][oO]) || \
- (${PREFER.iconv} == "pkgsrc") || ${ICONV_TYPE} == "native"
+ (${PREFER.iconv} == "pkgsrc")
USE_BUILTIN.iconv= no
. endif
. endif
.endif # USE_BUILTIN.iconv
+.if !defined(ICONV_TYPE)
+ICONV_TYPE?= gnu
+. if !empty(USE_BUILTIN.iconv:M[yY][eE][sS]) && \
+ !empty(IS_BUILTIN.iconv:M[nN][oO])
+ICONV_TYPE= native
+. endif
+.endif
+
CHECK_BUILTIN.iconv?= no
.if !empty(CHECK_BUILTIN.iconv:M[nN][oO])