diff options
author | jlam <jlam@pkgsrc.org> | 2004-11-14 04:05:16 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2004-11-14 04:05:16 +0000 |
commit | 7d3cec1b2bdc4582a2e7d4a8ecb471a9f4efe703 (patch) | |
tree | df934268af98086cae172413a77b72eed3983f41 /devel/gettext-lib | |
parent | 0e4ac068ffa1a6ef91b5e3fe9d071620261eb03f (diff) | |
download | pkgsrc-7d3cec1b2bdc4582a2e7d4a8ecb471a9f4efe703.tar.gz |
Follow the recommended template for builtin.mk files: glibc's gettext
is _not_ GNU gettext, so it's presence should not set IS_BUILTIN.gettext
to "yes", but it _can_ set USE_BUILTIN.gettext to "yes" to force that
it be used.
Also, create a new variable BROKEN_GETTEXT_DETECTION, which is yes/no
depending on whether or not a package's GNU configure script properly
detects -lintl. This variable currently defaults to "yes", but should
eventually be set to "no" and overridden on a package-by-package basis
for those packages that truly are broken.
Diffstat (limited to 'devel/gettext-lib')
-rw-r--r-- | devel/gettext-lib/builtin.mk | 127 |
1 files changed, 75 insertions, 52 deletions
diff --git a/devel/gettext-lib/builtin.mk b/devel/gettext-lib/builtin.mk index 19b9cf85b10..dfd2522ffd3 100644 --- a/devel/gettext-lib/builtin.mk +++ b/devel/gettext-lib/builtin.mk @@ -1,4 +1,4 @@ -# $NetBSD: builtin.mk,v 1.11 2004/10/14 03:16:35 minskim Exp $ +# $NetBSD: builtin.mk,v 1.12 2004/11/14 04:05:16 jlam Exp $ .if !defined(_BLNK_LIBINTL_FOUND) _BLNK_LIBINTL_FOUND!= \ @@ -14,33 +14,22 @@ _LIBINTL_H= /usr/include/libintl.h .if !defined(IS_BUILTIN.gettext) IS_BUILTIN.gettext= no -. if exists(${_LIBINTL_H}) -. if !empty(_BLNK_LIBINTL_FOUND:M[Nn][Oo]) -IS_BUILTIN.gettext!= \ - if ${GREP} -q "This file is part of the GNU C Library" ${_LIBINTL_H}; then \ - ${ECHO} "yes"; \ - else \ - ${ECHO} "no"; \ - fi -. endif -. if !empty(_BLNK_LIBINTL_FOUND:M[yY][eE][sS]) +. if exists(${_LIBINTL_H}) && !empty(_BLNK_LIBINTL_FOUND:M[yY][eE][sS]) IS_BUILTIN.gettext!= \ if ${GREP} -q "\#define[ ]*__USE_GNU_GETTEXT" ${_LIBINTL_H}; then \ ${ECHO} "yes"; \ else \ ${ECHO} "no"; \ fi -. endif - -. if !empty(IS_BUILTIN.gettext:M[yY][eE][sS]) +. endif +. if !empty(IS_BUILTIN.gettext:M[yY][eE][sS]) # XXX -# XXX Consider the native libintl to be gettext-lib-0.10.35nb1. +# XXX Consider the native libintl to be gettext-lib-0.10.35nb1 until we +# XXX find a way to more accurately determine the version. # XXX BUILTIN_PKG.gettext= gettext-lib-0.10.35nb1 BUILDLINK_VARS+= BUILTIN_PKG.gettext -. endif . endif -BUILDLINK_VARS+= IS_BUILTIN.gettext .endif # IS_BUILTIN.gettext #.if defined(USE_BUILTIN.iconv) && !empty(USE_BUILTIN.iconv:M[nN][oO]) @@ -66,34 +55,47 @@ USE_BUILTIN.gettext!= \ . endif . if ${PREFER.gettext} == "native" -# -# By default, assume that the native gettext implementation is good -# enough if it has a prototype for ngettext(). -# -. if exists(${_LIBINTL_H}) +# XXX +# XXX By default, assume that the native gettext implementation is good +# XXX enough if it has a prototype for ngettext(). +# XXX +. if !defined(_GETTEXT_NGETTEXT) && exists(${_LIBINTL_H}) _GETTEXT_NGETTEXT!= \ - if ${GREP} -q ngettext ${_LIBINTL_H}; then \ - echo yes; \ + if ${GREP} -q "char.*ngettext" ${_LIBINTL_H}; then \ + ${ECHO} "yes"; \ else \ - echo no; \ + ${ECHO} "no"; \ fi -. if !empty(_GETTEXT_NGETTEXT:Myes) +BUILDLINK_VARS+= _GETTEXT_NGETTEXT +. if !empty(_GETTEXT_NGETTEXT:M[yY][eE][sS]) USE_BUILTIN.gettext= yes . else USE_BUILTIN.gettext= no . endif +. endif +# XXX +# XXX By default, assume the native gettext on Linux systems using GLIBC +# XXX supports the GNU gettext API, and use it. +# XXX +. if (${OPSYS} == "Linux") && exists(${_LIBICONV_H}) +USE_BUILTIN.gettext!= \ + if ${GREP} -q "This file is part of the GNU C Library" ${_LIBINTL_H}; then \ + ${ECHO} "yes"; \ + else \ + ${ECHO} "no"; \ + fi +. endif # # The listed platforms have an implementation of gettext that isn't # GNUish enough. # _INCOMPAT_GETTEXT= SunOS-*-* -. for _pattern_ in ${_INCOMPAT_GETTEXT} ${INCOMPAT_GETTEXT} -. if !empty(MACHINE_PLATFORM:M${_pattern_}) +. for _pattern_ in ${_INCOMPAT_GETTEXT} ${INCOMPAT_GETTEXT} +. if !empty(MACHINE_PLATFORM:M${_pattern_}) USE_BUILTIN.gettext= no -. endif -. endfor -. endif -. endif +. endif +. endfor +. endif # PREFER.gettext == "native" . if defined(USE_GNU_GETTEXT) . if !empty(IS_BUILTIN.gettext:M[nN][oO]) || \ @@ -106,8 +108,28 @@ USE_BUILTIN.gettext= no CHECK_BUILTIN.gettext?= no .if !empty(CHECK_BUILTIN.gettext:M[nN][oO]) +###################################################################### +# If we are using the builtin gettext implementation... +###################################################################### +.if !empty(USE_BUILTIN.gettext:M[yY][eE][sS]) +. if ${_BLNK_LIBINTL_FOUND} == "yes" +_BLNK_LIBINTL= -lintl +. else +_BLNK_LIBINTL= # empty +BUILDLINK_TRANSFORM+= rm:-lintl +. endif +.endif + +###################################################################### +# If we are using pkgsrc gettext implementation... +###################################################################### .if !empty(USE_BUILTIN.gettext:M[nN][oO]) _BLNK_LIBINTL= -lintl +# +# Determine if we need to include the libiconv buildlink3.mk file. +# We need to if we're using the pkgsrc gettext, and the version is +# at least gettext>=0.11.5nb1. +# _GETTEXT_ICONV_DEPENDS= gettext-lib>=0.11.5nb1 . if !defined(_GETTEXT_NEEDS_ICONV) _GETTEXT_NEEDS_ICONV?= no @@ -115,7 +137,7 @@ _GETTEXT_NEEDS_ICONV?= no . if !empty(_GETTEXT_NEEDS_ICONV:M[nN][oO]) _GETTEXT_NEEDS_ICONV!= \ if ${PKG_INFO} -qe '${_depend_}'; then \ - pkg=`cd ${_PKG_DBDIR}; ${PKG_ADMIN} -b -S lsbest '${_depend_}'`; \ + pkg=`${PKG_BEST_EXISTS} '${_depend_}'`; \ if ${PKG_INFO} -qN "$$pkg" | ${GREP} -q "libiconv-[0-9]"; then \ ${ECHO} "yes"; \ else \ @@ -127,7 +149,7 @@ _GETTEXT_NEEDS_ICONV!= \ . endif . endfor . endif -. if ${_GETTEXT_NEEDS_ICONV} == "yes" +. if !empty(_GETTEXT_NEEDS_ICONV:M[yY][eE][sS]) . for _mkfile_ in buildlink3.mk builtin.mk . if exists(../../converters/libiconv/${_mkfile_}) BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+ @@ -140,35 +162,36 @@ _BLNK_LIBINTL+= ${BUILDLINK_LDADD.iconv} . endif .endif -.if !empty(USE_BUILTIN.gettext:M[yY][eE][sS]) -. if ${_BLNK_LIBINTL_FOUND} == "yes" -_BLNK_LIBINTL= -lintl -. else -_BLNK_LIBINTL= # empty -BUILDLINK_TRANSFORM+= rm:-lintl -. 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. +# 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 defined(GNU_CONFIGURE) -LIBS+= ${BUILDLINK_LDADD.gettext} +# If BROKEN_GETTEXT_DETECTION is "yes", then automatically add "-lintl" +# (and "-liconv" if necessary) to LIBS to workaround this brokenness. +# +# XXX Nowadays, most packages' GNU configure scripts correctly detect +# XXX -lintl, so this should really default to "no", but we'll leave it +# XXX as "yes" until we can do a full bulk build test. +# +BROKEN_GETTEXT_DETECTION?= yes +.if !empty(BROKEN_GETTEXT_DETECTION:M[yY][eE][sS]) +BUILDLINK_LIBS.gettext+= ${BUILDLINK_LDADD.gettext} CONFIGURE_ENV+= INTLLIBS="${BUILDLINK_LDADD.gettext}" . if !empty(USE_BUILTIN.gettext:M[yY][eE][sS]) -. if ${_BLNK_LIBINTL_FOUND} == "yes" +. if !empty(_BLNK_LIBINTL_FOUND:M[yY][eE][sS]) CONFIGURE_ENV+= gt_cv_func_gnugettext1_libintl="yes" -. if defined(_GETTEXT_NGETTEXT) && !empty(_GETTEXT_NGETTEXT:Myes) +. if defined(_GETTEXT_NGETTEXT) && !empty(_GETTEXT_NGETTEXT:M[yY][eE][sS]) CONFIGURE_ENV+= gt_cv_func_gnugettext2_libintl="yes" . endif . endif . endif +.endif # BROKEN_GETTEXT_DETECTION + +.if defined(GNU_CONFIGURE) . if !empty(USE_BUILTIN.gettext:M[nN][oO]) -CONFIGURE_ARGS+= --with-libintl-prefix=${BUILDLINK_PREFIX.gettext} +CONFIGURE_ARGS+= --with-libintl-prefix="${BUILDLINK_PREFIX.gettext}" . else CONFIGURE_ARGS+= --without-libintl-prefix . endif |