summaryrefslogtreecommitdiff
path: root/converters/libiconv
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2008-02-27 22:10:34 +0000
committerjlam <jlam@pkgsrc.org>2008-02-27 22:10:34 +0000
commit1ba751eba24b07c1344b2888c4706554918f8ee4 (patch)
tree1609b129b1f252201860de23bdb307a36fd19bc3 /converters/libiconv
parente332637fc79a5dddf52e2ccd8bc01bf49e099f61 (diff)
downloadpkgsrc-1ba751eba24b07c1344b2888c4706554918f8ee4.tar.gz
Greatly simplify the logic that tries to determine whether -lintl
needs -liconv in order to satisfy linkage requirements. This is now patterned after the approach taken with readline and termlib. Examples on NetBSD for a package that includes only gettext-lib/buildlink3.mk: PREFER_NATIVE= yes PREFER_PKGSRC= # empty # This uses the native gettext and native iconv, with: # BUILDLINK_LDADD.gettext == "-lintl" PREFER_NATIVE= yes PREFER_PKGSRC= iconv # This uses the native gettext and native iconv, with: # BUILDLINK_LDADD.gettext == "-lintl" PREFER_NATIVE= yes PREFER_PKGSRC= gettext # This uses the pkgsrc gettext and native iconv, with: # BUILDLINK_LDADD.gettext == "-lintl" PREFER_NATIVE= yes PREFER_PKGSRC= gettext iconv # This uses the pkgsrc gettext and pkgsrc iconv, with: # BUILDLINK_LDADD.gettext == "-lintl -liconv" PREFER_NATIVE= # empty PREFER_PKGSRC= yes # This uses the pkgsrc gettext and pkgsrc iconv, with: # BUILDLINK_LDADD.gettext == "-lintl -liconv" PREFER_NATIVE= iconv PREFER_PKGSRC= yes # This uses the pkgsrc gettext and native iconv, with: # BUILDLINK_LDADD.gettext == "-lintl" PREFER_NATIVE= gettext PREFER_PKGSRC= yes # This uses the native gettext and native iconv, with: # BUILDLINK_LDADD.gettext == "-lintl" PREFER_NATIVE= gettext iconv PREFER_PKGSRC= yes # This uses the native gettext and native iconv, with: # BUILDLINK_LDADD.gettext == "-lintl"
Diffstat (limited to 'converters/libiconv')
-rw-r--r--converters/libiconv/buildlink3.mk4
-rw-r--r--converters/libiconv/builtin.mk69
2 files changed, 37 insertions, 36 deletions
diff --git a/converters/libiconv/buildlink3.mk b/converters/libiconv/buildlink3.mk
index feade46fa6a..b3143523d93 100644
--- a/converters/libiconv/buildlink3.mk
+++ b/converters/libiconv/buildlink3.mk
@@ -1,4 +1,4 @@
-# $NetBSD: buildlink3.mk,v 1.24 2006/07/08 23:10:39 jlam Exp $
+# $NetBSD: buildlink3.mk,v 1.25 2008/02/27 22:10:34 jlam Exp $
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
ICONV_BUILDLINK3_MK:= ${ICONV_BUILDLINK3_MK}+
@@ -15,6 +15,8 @@ BUILDLINK_ORDER:= ${BUILDLINK_ORDER} ${BUILDLINK_DEPTH}iconv
BUILDLINK_API_DEPENDS.iconv+= libiconv>=1.9.1
BUILDLINK_ABI_DEPENDS.iconv+= libiconv>=1.9.1nb4
BUILDLINK_PKGSRCDIR.iconv?= ../../converters/libiconv
+BUILDLINK_LIBNAME.iconv= iconv
+BUILDLINK_LDADD.iconv= ${BUILDLINK_LIBNAME.iconv:S/^/-l/:S/^-l$//}
.endif # ICONV_BUILDLINK3_MK
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
diff --git a/converters/libiconv/builtin.mk b/converters/libiconv/builtin.mk
index 6648f26ce08..389233e516b 100644
--- a/converters/libiconv/builtin.mk
+++ b/converters/libiconv/builtin.mk
@@ -1,11 +1,15 @@
-# $NetBSD: builtin.mk,v 1.18 2008/02/27 19:32:55 jlam Exp $
+# $NetBSD: builtin.mk,v 1.19 2008/02/27 22:10:34 jlam Exp $
BUILTIN_PKG:= iconv
-BUILTIN_FIND_LIBS:= iconv
-BUILTIN_FIND_FILES_VAR:= H_ICONV
-BUILTIN_FIND_FILES.H_ICONV= /usr/include/iconv.h
-BUILTIN_FIND_GREP.H_ICONV= GNU LIBICONV Library
+BUILTIN_FIND_LIBS:= iconv
+BUILTIN_FIND_FILES_VAR:= H_ICONV H_GLIBC_ICONV H_CITRUS_ICONV
+BUILTIN_FIND_FILES.H_ICONV= /usr/include/iconv.h
+BUILTIN_FIND_GREP.H_ICONV= GNU LIBICONV Library
+BUILTIN_FIND_FILES.H_GLIBC_ICONV= /usr/include/iconv.h
+BUILTIN_FIND_GREP.H_GLIBC_ICONV= This file is part of the GNU C Library
+BUILTIN_FIND_FILES.H_CITRUS_ICONV= /usr/include/iconv.h
+BUILTIN_FIND_GREP.H_CITRUS_ICONV= Copyright.*Citrus Project
.include "../../mk/buildlink3/bsd.builtin.mk"
@@ -75,35 +79,26 @@ USE_BUILTIN.iconv!= \
. endif
. endfor
. endif
-. if !defined(_BLTN_REPLACE.iconv)
-_BLTN_REPLACE.iconv= no
# XXX
# XXX By default, assume that the native iconv implementation is good
# XXX enough to replace GNU libiconv if it is part of glibc (the GNU C
# XXX Library).
# XXX
-. if exists(/usr/include/iconv.h)
-H_ICONV= /usr/include/iconv.h
-_BLTN_REPLACE.iconv!= \
- if ${GREP} -q "This file is part of the GNU C Library" ${H_ICONV}; then \
- ${ECHO} yes; \
- else \
- ${ECHO} no; \
- fi
-. endif
+. if empty(H_GLIBC_ICONV:M__nonexistent__) && \
+ empty(H_GLIBC_ICONV:M${LOCALBASE}/*) && \
+ !empty(BUILTIN_LIB_FOUND.iconv:M[nN][oO])
+USE_BUILTIN.iconv= yes
+H_ICONV= ${H_GLIBC_ICONV}
+. endif
# XXX
-# XXX By default, assume that on NetBSD and DragonFly the native iconv
-# XXX implementation (if it exists) is good enough to replace GNU libiconv.
+# XXX By default, assume that the Citrus project iconv implementation
+# XXX (if it exists) is good enough to replace GNU libiconv.
# XXX
-. if (${OPSYS} == "NetBSD" || ${OPSYS} == "DragonFly") && \
- exists(/usr/include/iconv.h)
-H_ICONV= /usr/include/iconv.h
-_BLTN_REPLACE.iconv= yes
-. endif
-. endif
-MAKEVARS+= _BLTN_REPLACE.iconv
-. if !empty(_BLTN_REPLACE.iconv:M[yY][eE][sS])
+. if empty(H_CITRUS_ICONV:M__nonexistent__) && \
+ empty(H_CITRUS_ICONV:M${LOCALBASE}/*) && \
+ !empty(BUILTIN_LIB_FOUND.iconv:M[nN][oO])
USE_BUILTIN.iconv= yes
+H_ICONV= ${H_CITRUS_ICONV}
. endif
#
# Some platforms don't have an iconv implementation that can replace
@@ -128,6 +123,15 @@ USE_BUILTIN.iconv= no
. endif
.endif
+# Define BUILTIN_LIBNAME.iconv to be the base name of the built-in
+# iconv library.
+#
+.if !empty(BUILTIN_LIB_FOUND.iconv:M[yY][eE][sS])
+BUILTIN_LIBNAME.iconv= iconv
+.else
+BUILTIN_LIBNAME.iconv= # empty (part of the C library)
+.endif
+
# ICONV_TYPE is either "gnu" or "native" depending on which iconv
# implementation is used.
#
@@ -146,17 +150,12 @@ ICONV_TYPE= native
CHECK_BUILTIN.iconv?= no
.if !empty(CHECK_BUILTIN.iconv:M[nN][oO])
-. if !empty(USE_BUILTIN.iconv:M[nN][oO])
-_BLTN_LIBICONV= -liconv
-. else
-. if !empty(BUILTIN_LIB_FOUND.iconv:M[yY][eE][sS])
-_BLTN_LIBICONV= -liconv
-. else
-_BLTN_LIBICONV= # empty
-BUILDLINK_TRANSFORM+= rm:-liconv
+. if !empty(USE_BUILTIN.iconv:M[yY][eE][sS])
+BUILDLINK_LIBNAME.iconv= ${BUILTIN_LIBNAME.iconv}
+. if empty(BUILTIN_LIBNAME.iconv)
+BUILDLINK_TRANSFORM+= rm:-liconv
. endif
. endif
-BUILDLINK_LDADD.iconv?= ${_BLTN_LIBICONV}
. if defined(GNU_CONFIGURE)
. if !empty(USE_BUILTIN.iconv:M[nN][oO])