pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc Greatly simplify the logic that tries to determine whe...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/6bfadd93a15d
branches:  trunk
changeset: 539111:6bfadd93a15d
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Wed Feb 27 22:10:34 2008 +0000

description:
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:

 converters/libiconv/buildlink3.mk |    4 +-
 converters/libiconv/builtin.mk    |   69 ++++++++++++-------------
 devel/gettext-lib/buildlink3.mk   |   25 ++++++++-
 devel/gettext-lib/builtin.mk      |  100 ++++++++++++-------------------------
 4 files changed, 91 insertions(+), 107 deletions(-)

diffs (truncated from 353 to 300 lines):

diff -r 82b11bbcfc18 -r 6bfadd93a15d converters/libiconv/buildlink3.mk
--- a/converters/libiconv/buildlink3.mk Wed Feb 27 21:52:16 2008 +0000
+++ b/converters/libiconv/buildlink3.mk Wed Feb 27 22:10:34 2008 +0000
@@ -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_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 -r 82b11bbcfc18 -r 6bfadd93a15d converters/libiconv/builtin.mk
--- a/converters/libiconv/builtin.mk    Wed Feb 27 21:52:16 2008 +0000
+++ b/converters/libiconv/builtin.mk    Wed Feb 27 22:10:34 2008 +0000
@@ -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 @@
 .        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 @@
 .  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 @@
 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])
diff -r 82b11bbcfc18 -r 6bfadd93a15d devel/gettext-lib/buildlink3.mk
--- a/devel/gettext-lib/buildlink3.mk   Wed Feb 27 21:52:16 2008 +0000
+++ b/devel/gettext-lib/buildlink3.mk   Wed Feb 27 22:10:34 2008 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: buildlink3.mk,v 1.29 2008/01/23 17:35:20 tnn Exp $
+# $NetBSD: buildlink3.mk,v 1.30 2008/02/27 22:10:34 jlam Exp $
 
 BUILDLINK_DEPTH:=      ${BUILDLINK_DEPTH}+
 GETTEXT_BUILDLINK3_MK:=        ${GETTEXT_BUILDLINK3_MK}+
@@ -14,16 +14,35 @@
 .if !empty(GETTEXT_BUILDLINK3_MK:M+)
 BUILDLINK_API_DEPENDS.gettext+=        gettext-lib>=0.14.5
 BUILDLINK_PKGSRCDIR.gettext?=  ../../devel/gettext-lib
+BUILDLINK_LIBNAME.gettext=     intl
+BUILDLINK_LDADD.gettext=       ${BUILDLINK_LIBNAME.gettext:S/^/-l/:S/^-l$//}
+BUILDLINK_LDADD.gettext+=      ${BUILDLINK_LDADD.iconv}
 .endif # GETTEXT_BUILDLINK3_MK
 
 .include "../../mk/bsd.fast.prefs.mk"
 
+# Some GNU configure scripts generated with an older and broken gettext.m4
+# fail to detect if gettext is present or not because it fails to add
+# "-lintl" to the linker command line.
+#
+# If BROKEN_GETTEXT_DETECTION is "yes", then automatically add "-lintl"
+# to LIBS to workaround this brokenness.
+#
+BROKEN_GETTEXT_DETECTION?=     no
+.  if !empty(BROKEN_GETTEXT_DETECTION:M[yY][eE][sS])
+BUILDLINK_LIBS.gettext+=       ${BUILDLINK_LDADD.gettext}
+CONFIGURE_ENV+=                        INTLLIBS="${BUILDLINK_LDADD.gettext}"
+.  endif
+
 CHECK_BUILTIN.gettext:=        yes
 .include "../../devel/gettext-lib/builtin.mk"
 CHECK_BUILTIN.gettext:=        no
 
-.if !empty(USE_BUILTIN.gettext:M[nN][oO])
-.  include "../../converters/libiconv/buildlink3.mk"
+# A built-in gettext is always going to use a built-in iconv.
+.if !empty(USE_BUILTIN.gettext:M[yY][eE][sS])
+USE_BUILTIN.iconv=     yes
 .endif
 
+.include "../../converters/libiconv/buildlink3.mk"
+
 BUILDLINK_DEPTH:=      ${BUILDLINK_DEPTH:S/+$//}
diff -r 82b11bbcfc18 -r 6bfadd93a15d devel/gettext-lib/builtin.mk
--- a/devel/gettext-lib/builtin.mk      Wed Feb 27 21:52:16 2008 +0000
+++ b/devel/gettext-lib/builtin.mk      Wed Feb 27 22:10:34 2008 +0000
@@ -1,16 +1,18 @@
-# $NetBSD: builtin.mk,v 1.37 2008/01/25 14:42:27 joerg Exp $
+# $NetBSD: builtin.mk,v 1.38 2008/02/27 22:10:34 jlam Exp $
 
 .include "../../mk/bsd.fast.prefs.mk"
 
 BUILTIN_PKG:=  gettext
 
 BUILTIN_FIND_LIBS:=                    intl
-BUILTIN_FIND_FILES_VAR:=               H_GETTEXT _BLTN_H_GETTEXT
+BUILTIN_FIND_FILES_VAR:=               H_GETTEXT H_NGETTEXT_GETTEXT    \
+                                       H_GLIBC_GETTEXT
 BUILTIN_FIND_FILES.H_GETTEXT=          /usr/include/libintl.h
-BUILTIN_FIND_FILES._BLTN_H_GETTEXT=    /usr/include/libintl.h
-.if ${OPSYS} != "Linux"
 BUILTIN_FIND_GREP.H_GETTEXT=           \#define[       ]*__USE_GNU_GETTEXT
-.endif
+BUILTIN_FIND_FILES.H_NGETTEXT_GETTEXT= /usr/include/libintl.h
+BUILTIN_FIND_GREP.H_NGETTEXT_GETTEXT=  char.*ngettext
+BUILTIN_FIND_FILES.H_GLIBC_GETTEXT=    /usr/include/libintl.h
+BUILTIN_FIND_GREP.H_GLIBC_GETTEXT=     This file is part of the GNU C Library
 
 .include "../../mk/buildlink3/bsd.builtin.mk"
 
@@ -28,22 +30,9 @@
 .endif
 MAKEVARS+=     IS_BUILTIN.gettext
 
-.if !defined(BUILTIN_GETTEXT_NGETTEXT)
-BUILTIN_GETTEXT_NGETTEXT=      no
-.  if empty(_BLTN_H_GETTEXT:M__nonexistent__)
-BUILTIN_GETTEXT_NGETTEXT!=                                             \
-       if ${GREP} -q "char.*ngettext" ${_BLTN_H_GETTEXT:Q}; then       \
-               ${ECHO} yes;                                            \
-       else                                                            \
-               ${ECHO} no;                                             \
-       fi
-.  endif
-.endif
-MAKEVARS+=     BUILTIN_GETTEXT_NGETTEXT
-
 ###
 ### Determine whether we should use the built-in implementation if it
-### exists, and uset USE_BUILTIN.<pkg> appropriate ("yes" or "no").
+### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
 ###
 .if !defined(USE_BUILTIN.gettext)
 .  if ${PREFER.gettext} == "pkgsrc"
@@ -51,45 +40,38 @@
 .  else
 USE_BUILTIN.gettext=   ${IS_BUILTIN.gettext}
 .    if defined(BUILTIN_PKG.gettext) && \
-        !empty(IS_BUILTIN.gettext:M[yY][eE][sS])
+       !empty(IS_BUILTIN.gettext:M[yY][eE][sS])
 USE_BUILTIN.gettext=   yes
 .      for _dep_ in ${BUILDLINK_API_DEPENDS.gettext}
-.        if !empty(USE_BUILTIN.gettext:M[yY][eE][sS])
+.       if !empty(USE_BUILTIN.gettext:M[yY][eE][sS])
 USE_BUILTIN.gettext!=                                                  \
        if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.gettext:Q}; then \
                ${ECHO} yes;                                            \
        else                                                            \
                ${ECHO} no;                                             \
        fi
-.        endif
+.       endif
 .      endfor
 .    endif
-.    if !defined(_BLTN_REPLACE.gettext)
-_BLTN_REPLACE.gettext= no
 # XXX
 # XXX By default, assume that the native gettext implementation is good
 # XXX enough to replace GNU gettext if it is part of glibc (the GNU C
 # XXX Library).
 # XXX
-.      if empty(_BLTN_H_GETTEXT:M__nonexistent__)
-_BLTN_REPLACE.gettext!=                                                        \
-       if ${GREP} -q "This file is part of the GNU C Library" ${_BLTN_H_GETTEXT:Q}; then \
-               ${ECHO} yes;                                            \
-       else                                                            \
-               ${ECHO} no;                                             \
-       fi
-.      endif
-.    endif
-MAKEVARS+=     _BLTN_REPLACE.gettext
-.    if !empty(_BLTN_REPLACE.gettext:M[yY][eE][sS])
+.    if empty(H_GLIBC_GETTEXT:M__nonexistent__) && \
+       empty(H_GLIBC_GETTEXT:M${LOCALBASE}/*) && \
+       !empty(BUILTIN_LIB_FOUND.intl:M[nN][oO])
 USE_BUILTIN.gettext=   yes
+H_GETTEXT=             ${H_GLIBC_GETTEXT}
 .    endif
 # XXX
 # XXX By default, assume that the native gettext implementation is good
 # XXX enough to replace GNU gettext if it supplies ngettext().
 # XXX
-.    if !empty(BUILTIN_GETTEXT_NGETTEXT:M[yY][eE][sS])
+.    if empty(H_NGETTEXT_GETTEXT:M__nonexistent__) && \
+       empty(H_NGETTEXT_GETTEXT:M${LOCALBASE}/*)
 USE_BUILTIN.gettext=   yes
+H_GETTEXT=             ${H_NGETTEXT_GETTEXT}
 .    endif
 #
 # Some platforms don't have a gettext implementation that can replace
@@ -105,6 +87,15 @@
 .endif
 MAKEVARS+=     USE_BUILTIN.gettext
 
+# Define BUILTIN_LIBNAME.gettext to be the base name of the built-in
+# gettext library.
+#
+.if !empty(BUILTIN_LIB_FOUND.intl:M[yY][eE][sS])
+BUILTIN_LIBNAME.gettext=       intl
+.else
+BUILTIN_LIBNAME.gettext=       # empty (part of the C library)
+.endif
+
 ###
 ### The section below only applies if we are not including this file
 ### solely to determine whether a built-in implementation exists.
@@ -112,41 +103,13 @@
 CHECK_BUILTIN.gettext?=        no



Home | Main Index | Thread Index | Old Index