diff options
author | jlam <jlam@pkgsrc.org> | 2005-06-01 18:02:37 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2005-06-01 18:02:37 +0000 |
commit | 95fd1f6ec9ce583a46e4351179d93b744a17d1ad (patch) | |
tree | 614ebca62dbe176d9c75cab1cfeef7c554a336c9 /devel/gettext-lib | |
parent | 6469e231c2dabc4fdb3edae536776b2c90cf5616 (diff) | |
download | pkgsrc-95fd1f6ec9ce583a46e4351179d93b744a17d1ad.tar.gz |
Massive cleanup of buildlink3.mk and builtin.mk files in pkgsrc.
Several changes are involved since they are all interrelated. These
changes affect about 1000 files.
The first major change is rewriting bsd.builtin.mk as well as all of
the builtin.mk files to follow the new example in bsd.builtin.mk.
The loop to include all of the builtin.mk files needed by the package
is moved from bsd.builtin.mk and into bsd.buildlink3.mk. bsd.builtin.mk
is now included by each of the individual builtin.mk files and provides
some common logic for all of the builtin.mk files. Currently, this
includes the computation for whether the native or pkgsrc version of
the package is preferred. This causes USE_BUILTIN.* to be correctly
set when one builtin.mk file includes another.
The second major change is teach the builtin.mk files to consider
files under ${LOCALBASE} to be from pkgsrc-controlled packages. Most
of the builtin.mk files test for the presence of built-in software by
checking for the existence of certain files, e.g. <pthread.h>, and we
now assume that if that file is under ${LOCALBASE}, then it must be
from pkgsrc. This modification is a nod toward LOCALBASE=/usr. The
exceptions to this new check are the X11 distribution packages, which
are handled specially as noted below.
The third major change is providing builtin.mk and version.mk files
for each of the X11 distribution packages in pkgsrc. The builtin.mk
file can detect whether the native X11 distribution is the same as
the one provided by pkgsrc, and the version.mk file computes the
version of the X11 distribution package, whether it's built-in or not.
The fourth major change is that the buildlink3.mk files for X11 packages
that install parts which are part of X11 distribution packages, e.g.
Xpm, Xcursor, etc., now use imake to query the X11 distribution for
whether the software is already provided by the X11 distribution.
This is more accurate than grepping for a symbol name in the imake
config files. Using imake required sprinkling various builtin-imake.mk
helper files into pkgsrc directories. These files are used as input
to imake since imake can't use stdin for that purpose.
The fifth major change is in how packages note that they use X11.
Instead of setting USE_X11, package Makefiles should now include
x11.buildlink3.mk instead. This causes the X11 package buildlink3
and builtin logic to be executed at the correct place for buildlink3.mk
and builtin.mk files that previously set USE_X11, and fixes packages
that relied on buildlink3.mk files to implicitly note that X11 is
needed. Package buildlink3.mk should also include x11.buildlink3.mk
when linking against the package libraries requires also linking
against the X11 libraries. Where it was obvious, redundant inclusions
of x11.buildlink3.mk have been removed.
Diffstat (limited to 'devel/gettext-lib')
-rw-r--r-- | devel/gettext-lib/buildlink3.mk | 5 | ||||
-rw-r--r-- | devel/gettext-lib/builtin.mk | 220 |
2 files changed, 137 insertions, 88 deletions
diff --git a/devel/gettext-lib/buildlink3.mk b/devel/gettext-lib/buildlink3.mk index 4c5a7058a19..a2a5df03042 100644 --- a/devel/gettext-lib/buildlink3.mk +++ b/devel/gettext-lib/buildlink3.mk @@ -1,4 +1,4 @@ -# $NetBSD: buildlink3.mk,v 1.22 2005/04/19 14:55:30 epg Exp $ +# $NetBSD: buildlink3.mk,v 1.23 2005/06/01 18:02:43 jlam Exp $ BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+ GETTEXT_BUILDLINK3_MK:= ${GETTEXT_BUILDLINK3_MK}+ @@ -16,6 +16,7 @@ BUILDLINK_RECOMMENDED.gettext+= gettext-lib>=0.11.5nb4 BUILDLINK_PKGSRCDIR.gettext?= ../../devel/gettext-lib .endif # GETTEXT_BUILDLINK3_MK -.include "../../converters/libiconv/buildlink3.mk" +# Let the gettext-lib/builtin.mk pull in libiconv if it's needed. +#.include "../../converters/libiconv/buildlink3.mk" BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//} diff --git a/devel/gettext-lib/builtin.mk b/devel/gettext-lib/builtin.mk index c65092c06a5..d7b3922122b 100644 --- a/devel/gettext-lib/builtin.mk +++ b/devel/gettext-lib/builtin.mk @@ -1,121 +1,170 @@ -# $NetBSD: builtin.mk,v 1.22 2005/05/24 05:43:37 jlam Exp $ +# $NetBSD: builtin.mk,v 1.23 2005/06/01 18:02:43 jlam Exp $ -BUILDLINK_FIND_LIBS:= intl -.include "../../mk/buildlink3/find-libs.mk" +BUILTIN_PKG:= gettext -_BLNK_LIBINTL_H= /usr/include/libintl.h +BUILTIN_FIND_LIBS:= intl +BUILTIN_FIND_FILES_VAR:= H_GETTEXT +BUILTIN_FIND_FILES.H_GETTEXT= /usr/include/libintl.h +BUILTIN_FIND_GREP.H_GETTEXT= \#define[ ]*__USE_GNU_GETTEXT +.include "../../mk/buildlink3/bsd.builtin.mk" + +### +### Determine if there is a built-in implementation of the package and +### set IS_BUILTIN.<pkg> appropriately ("yes" or "no"). +### .if !defined(IS_BUILTIN.gettext) IS_BUILTIN.gettext= no -. if exists(${_BLNK_LIBINTL_H}) && \ - !empty(BUILDLINK_LIB_FOUND.intl:M[yY][eE][sS]) -IS_BUILTIN.gettext!= \ - if ${GREP} -q "\#define[ ]*__USE_GNU_GETTEXT" ${_BLNK_LIBINTL_H}; then \ - ${ECHO} "yes"; \ - else \ - ${ECHO} "no"; \ - fi -. endif -. if !empty(IS_BUILTIN.gettext:M[yY][eE][sS]) -# XXX -# 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 +. if empty(H_GETTEXT:M${LOCALBASE}/*) && exists(${H_GETTEXT}) && \ + !empty(BUILTIN_LIB_FOUND.intl:M[yY][eE][sS]) +IS_BUILTIN.gettext= yes . endif -.endif # IS_BUILTIN.gettext +.endif +MAKEVARS+= IS_BUILTIN.gettext -.if !defined(USE_BUILTIN.gettext) -USE_BUILTIN.gettext?= ${IS_BUILTIN.gettext} -PREFER.gettext?= pkgsrc +_BLTNH_GETTEXT= /usr/include/libintl.h +.if !defined(BUILTIN_GETTEXT_NGETTEXT) && exists(${_BLTNH_GETTEXT}) +BUILTIN_GETTEXT_NGETTEXT!= \ + if ${GREP} -q "char.*ngettext" ${_BLTNH_GETTEXT:Q}; then \ + ${ECHO} yes; \ + else \ + ${ECHO} no; \ + fi +.endif +MAKEVARS+= BUILTIN_GETTEXT_NGETTEXT -. if defined(BUILTIN_PKG.gettext) +### +### Determine whether we should use the built-in implementation if it +### exists, and uset USE_BUILTIN.<pkg> appropriate ("yes" or "no"). +### +.if !defined(USE_BUILTIN.gettext) +. if ${PREFER.gettext} == "pkgsrc" +USE_BUILTIN.gettext= no +. else +USE_BUILTIN.gettext= ${IS_BUILTIN.gettext} +. if defined(BUILTIN_PKG.gettext) && \ + !empty(IS_BUILTIN.gettext:M[yY][eE][sS]) USE_BUILTIN.gettext= yes -. for _depend_ in ${BUILDLINK_DEPENDS.gettext} -. if !empty(USE_BUILTIN.gettext:M[yY][eE][sS]) -USE_BUILTIN.gettext!= \ - if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.gettext}; then \ - ${ECHO} "yes"; \ +. for _dep_ in ${BUILDLINK_DEPENDS.gettext} +. 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"; \ + ${ECHO} no; \ fi -. endif -. endfor -. endif - -. if ${PREFER.gettext} == "native" +. endif +. endfor +. endif +. if !defined(_BLNK_REPLACE.gettext) +_BLNK_REPLACE.gettext= no # XXX # XXX By default, assume that the native gettext implementation is good -# XXX enough if it has a prototype for ngettext(). +# XXX enough to replace GNU gettext if it is part of glibc (the GNU C +# XXX Library). # XXX -. if !defined(_GETTEXT_NGETTEXT) && exists(${_BLNK_LIBINTL_H}) -_GETTEXT_NGETTEXT!= \ - if ${GREP} -q "char.*ngettext" ${_BLNK_LIBINTL_H}; then \ - ${ECHO} "yes"; \ +. if exists(${_BLTNH_GETTEXT}) +_BLNK_REPLACE.gettext!= \ + if ${GREP} -q "This file is part of the GNU C Library" ${_BLTNH_GETTEXT:Q}; then \ + ${ECHO} yes; \ else \ - ${ECHO} "no"; \ + ${ECHO} no; \ fi -BUILDLINK_VARS+= _GETTEXT_NGETTEXT -. if !empty(_GETTEXT_NGETTEXT:M[yY][eE][sS]) -USE_BUILTIN.gettext= yes -. else -USE_BUILTIN.gettext= no . endif . endif +MAKEVARS+= _BLNK_REPLACE.gettext +. if !empty(_BLNK_REPLACE.gettext:M[yY][eE][sS]) +USE_BUILTIN.gettext= yes +. endif # XXX -# XXX By default, assume the native gettext on Linux systems using GLIBC -# XXX supports the GNU gettext API, and use it. +# XXX By default, assume that the native gettext implementation is good +# XXX enough to replace GNU gettext if it supplies ngettext(). # XXX -. if (${OPSYS} == "Linux") -USE_BUILTIN.gettext!= \ - if ${GREP} -q "This file is part of the GNU C Library" ${_BLNK_LIBINTL_H}; then \ - ${ECHO} "yes"; \ - else \ - ${ECHO} "no"; \ - fi +. if !empty(BUILTIN_GETTEXT_NGETTEXT:M[yY][eE][sS]) +USE_BUILTIN.gettext= yes . endif # -# The listed platforms have an implementation of gettext that isn't -# GNUish enough. +# Some platforms don't have a gettext implementation that can replace +# GNU gettext. # -_INCOMPAT_GETTEXT= SunOS-*-* +_INCOMPAT_GETTEXT?= SunOS-*-* # XXX move to mk/platforms/SunOS.mk . for _pattern_ in ${_INCOMPAT_GETTEXT} ${INCOMPAT_GETTEXT} . if !empty(MACHINE_PLATFORM:M${_pattern_}) -USE_BUILTIN.gettext= no +USE_BUILTIN.gettext= no . endif . endfor -. endif # PREFER.gettext == "native" +. endif # PREFER.gettext +.endif +MAKEVARS+= USE_BUILTIN.gettext -. if defined(USE_GNU_GETTEXT) -. if !empty(IS_BUILTIN.gettext:M[nN][oO]) || \ - (${PREFER.gettext} == "pkgsrc") +# If USE_GNU_GETTEXT is defined, then force the use of a GNU gettext +# implementation. +# +.if defined(USE_GNU_GETTEXT) +. if !empty(IS_BUILTIN.gettext:M[nN][oO]) USE_BUILTIN.gettext= no -. endif . endif -.endif # USE_BUILTIN.gettext +.endif +### +### The section below only applies if we are not including this file +### solely to determine whether a built-in implementation exists. +### 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 ${BUILDLINK_LIB_FOUND.intl} == "yes" +. if !empty(USE_BUILTIN.gettext:M[yY][eE][sS]) +. if ${BUILTIN_LIB_FOUND.intl} == "yes" _BLNK_LIBINTL= -lintl -. else +. else _BLNK_LIBINTL= # empty BUILDLINK_TRANSFORM+= rm:-lintl +. endif . endif -.endif ###################################################################### # If we are using pkgsrc gettext implementation... ###################################################################### -.if !empty(USE_BUILTIN.gettext:M[nN][oO]) +. if !empty(USE_BUILTIN.gettext:M[nN][oO]) _BLNK_LIBINTL= -lintl -.endif +# +# Determine if we need to include the libiconv buildlink3.mk file. +# Since we're using the pkgsrc gettext, the only time we don't need +# iconv is if an already-installed gettext-lib package satisfied all +# of the gettext dependencies but is <0.11.5nb1. +# +_BLNK_GETTEXT_ICONV_DEPENDS= gettext-lib>=0.11.5nb1 +. if !defined(_BLNK_GETTEXT_NEEDS_ICONV) +_BLNK_GETTEXT_NEEDS_ICONV?= no +. for _dep_ in ${BUILDLINK_DEPENDS.gettext} +. if !empty(_BLNK_GETTEXT_NEEDS_ICONV:M[nN][oO]) +_BLNK_GETTEXT_NEEDS_ICONV!= \ + pkg=`${PKG_BEST_EXISTS} ${_dep_:Q}`; \ + if ${TEST} -z "$$pkg"; then \ + ${ECHO} yes; \ + elif ${PKG_ADMIN} pmatch ${_BLNK_GETTEXT_ICONV_DEPENDS:Q} "$$pkg"; then \ + ${ECHO} yes; \ + else \ + ${ECHO} no; \ + fi +. endif +. endfor +. endif +MAKEVARS+= _BLNK_GETTEXT_NEEDS_ICONV + +. if !empty(_BLNK_GETTEXT_NEEDS_ICONV:M[yY][eE][sS]) +. for _mkfile_ in buildlink3.mk builtin.mk +BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+ +. sinclude "../../converters/libiconv/${_mkfile_}" +BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//} +. endfor +BUILDLINK_DEPENDS.gettext+= ${_BLNK_GETTEXT_ICONV_DEPENDS} +_BLNK_LIBINTL+= ${BUILDLINK_LDADD.iconv} +. endif +. endif BUILDLINK_LDADD.gettext?= ${_BLNK_LIBINTL} @@ -131,34 +180,33 @@ BUILDLINK_LDADD.gettext?= ${_BLNK_LIBINTL} # 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]) +. if !empty(BROKEN_GETTEXT_DETECTION:M[yY][eE][sS]) BUILDLINK_LIBS.gettext+= ${BUILDLINK_LDADD.gettext} CONFIGURE_ENV+= INTLLIBS="${BUILDLINK_LDADD.gettext}" -.endif # BROKEN_GETTEXT_DETECTION +. endif # If using a built-in libintl that isn't from GNU gettext, then set up # some GNU configure variables that are checked by modern gettext.m4 # so that it will detect "GNU gettext" in the existing libintl. # -.if !empty(USE_BUILTIN.gettext:M[yY][eE][sS]) -. if !empty(BUILDLINK_LIB_FOUND.intl:M[yY][eE][sS]) +. if defined(GNU_CONFIGURE) +. if !empty(USE_BUILTIN.gettext:M[yY][eE][sS]) +. if !empty(BUILTIN_LIB_FOUND.intl:M[yY][eE][sS]) CONFIGURE_ENV+= gt_cv_func_gnugettext_libintl="yes" CONFIGURE_ENV+= gt_cv_func_gnugettext1_libintl="yes" -. if defined(_GETTEXT_NGETTEXT) && !empty(_GETTEXT_NGETTEXT:M[yY][eE][sS]) +. if !empty(BUILTIN_GETTEXT_NGETTEXT:M[yY][eE][sS]) CONFIGURE_ENV+= gt_cv_func_gnugettext2_libintl="yes" +. endif +. endif . endif -. endif -.endif - -.if defined(GNU_CONFIGURE) -. if !empty(USE_BUILTIN.gettext:M[nN][oO]) +. if !empty(USE_BUILTIN.gettext:M[nN][oO]) CONFIGURE_ARGS+= --with-libintl-prefix="${BUILDLINK_PREFIX.gettext}" -. else +. else CONFIGURE_ARGS+= --without-libintl-prefix +. endif . endif -.endif -.if defined(USE_MSGFMT_PLURALS) && !empty(USE_MSGFMT_PLURALS:M[Yy][Ee][Ss]) +. if defined(USE_MSGFMT_PLURALS) && !empty(USE_MSGFMT_PLURALS:M[Yy][Ee][Ss]) USE_PERL5?= build CONFIGURE_ENV+= MSGFMT=${BUILDLINK_DIR}/bin/msgfmt @@ -177,6 +225,6 @@ ${BUILDLINK_DIR}/bin/msgfmt: ${.CURDIR}/../../devel/gettext/files/msgfmt.pl -e "s|@MSGFMT@|"${BUILDLINK_PREFIX.gettext:Q}/bin/msgfmt"|g" \ > ${.TARGET} @${CHMOD} +x ${.TARGET} -.endif +. endif .endif # CHECK_BUILTIN.gettext |