tech-pkg archive

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

xgettext with UI files support



Hi,

My commit to x11/gtk3 was wrong.
How about the following patches?
If REQUIRE_XGETTEXT_WITH_UI_FILES_SUPPORT=yes, xgettext>=0.18.3 from
devel/gettext-tools is used.

Index: mk/tools/gettext.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/tools/gettext.mk,v
retrieving revision 1.20
diff -u -r1.20 gettext.mk
--- mk/tools/gettext.mk	16 Feb 2015 10:40:40 -0000	1.20
+++ mk/tools/gettext.mk	15 Jun 2015 14:59:08 -0000
@@ -39,7 +39,7 @@
 # is no native tool available.  Don't add "msgfmt" to this list as it's
 # treated specially below.
 #
-_TOOLS.gettext-tools=		gettext msgmerge xgettext msgconv autopoint
+_TOOLS.gettext-tools=		gettext msgmerge msgconv autopoint
 _TOOLS_DEP.gettext-tools=	gettext-tools>=0.15
 
 .for _t_ in ${_TOOLS.gettext-tools}
@@ -132,6 +132,65 @@
 .  endif
 .endif
 
+###
+### Handle "xgettext".  We use either the pkgsrc version or the built-in
+### version of xgettext depending on availability and version.
+###
+.if !defined(TOOLS_IGNORE.xgettext) && !empty(USE_TOOLS:C/:.*//:Mxgettext)
+.  if !empty(PKGPATH:Mdevel/gettext-tools)
+MAKEFLAGS+=		TOOLS_IGNORE.xgettext=
+.  elif !empty(REQUIRE_XGETTEXT_WITH_UI_FILES_SUPPORT:M[Yy][Ee][Ss])
+#
+# If we're not using the builtin gettext implementation, then we should
+# definitely be using the pkgsrc version of gettext (gettext-tools).
+#
+CHECK_BUILTIN.gettext:=	yes
+.    include "../../devel/gettext-lib/builtin.mk"
+CHECK_BUILTIN.gettext:=	no
+.    if !empty(USE_BUILTIN.gettext:M[nN][oO])
+_TOOLS_USE_PKGSRC.xgettext=	yes
+.    endif
+
+_TOOLS_USE_PKGSRC.xgettext?=	no
+.    if empty(_TOOLS_USE_PKGSRC.xgettext:M[Yy][Ee][Ss]) && \
+	defined(TOOLS_PLATFORM.xgettext) && !empty(TOOLS_PLATFORM.xgettext)
+#
+# XGETTEXT_SUPPORTS_UI_FILES: Yes for xgettext >= 0.18.3
+#
+# Determine if the platform-supplied xgettext is new enough to support
+# the UI files.  We need at least 0.18.3 for GNU xgettext.
+#
+_TOOLS_VERSION.xgettext!=	${TOOLS_PLATFORM.xgettext} --version |	\
+				${AWK} '{ print $$4; exit }'
+.      if !defined(XGETTEXT_SUPPORTS_UI_FILES)
+XGETTEXT_SUPPORTS_UI_FILES!=						\
+	if ${PKG_ADMIN} pmatch "gettext<0.18.3"			\
+			gettext-${_TOOLS_VERSION.xgettext:Q}; then	\
+		${ECHO} no;						\
+	else								\
+		${ECHO} yes;						\
+	fi
+.      endif
+.    else
+_TOOLS_USE_PKGSRC.xgettext=	yes
+.    endif
+XGETTEXT_SUPPORTS_UI_FILES?=	no
+
+.    if ${XGETTEXT_SUPPORTS_UI_FILES} == "no"
+_TOOLS_USE_PKGSRC.xgettext=	yes
+.    endif
+
+.    if !empty(_TOOLS_USE_PKGSRC.xgettext:M[yY][eE][sS])
+TOOLS_CREATE+=		xgettext
+TOOLS_DEPENDS.xgettext?=${_TOOLS_DEP.gettext-tools}:../../devel/gettext-tools
+TOOLS_FIND_PREFIX+=	TOOLS_PREFIX.xgettext=${TOOLS_DEPENDS.xgettext:C/:.*//}
+TOOLS_PATH.xgettext=	${TOOLS_PREFIX.xgettext}/bin/msgfmt
+.    endif
+.  else
+USE_TOOLS+=	xgettext
+.  endif
+.endif
+
 .for _t_ in ${_TOOLS.gettext-tools}
 .  if !defined(TOOLS_IGNORE.${_t_}) && !empty(USE_TOOLS:C/:.*//:M${_t_})
 .    if !empty(_TOOLS_USE_PKGSRC.msgfmt:M[yY][eE][sS])
Index: x11/gtk3/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/x11/gtk3/Makefile,v
retrieving revision 1.64
diff -u -r1.64 Makefile
--- x11/gtk3/Makefile	15 Jun 2015 01:39:06 -0000	1.64
+++ x11/gtk3/Makefile	15 Jun 2015 14:59:08 -0000
@@ -13,12 +13,12 @@
 LICENSE=	gnu-lgpl-v2.1
 
 USE_PKGLOCALEDIR=	yes
-USE_TOOLS+=		gmake perl pkg-config bash
+USE_TOOLS+=		gmake perl pkg-config bash msgfmt xgettext
+REQUIRE_XGETTEXT_WITH_UI_FILES_SUPPORT=yes
 USE_LANGUAGES=		c c++
 USE_LIBTOOL=		yes
 PTHREAD_AUTO_VARS=	yes
 BUILD_DEPENDS+=		gdbus-codegen-[0-9]*:../../devel/gdbus-codegen
-TOOL_DEPENDS+=		gettext-tools>=0.19.4nb1:../../devel/gettext-tools
 
 GNU_CONFIGURE=		yes
 # XXX there is a subtle bashism in "configure" or a bug in NetBSD's sh

--
Ryo ONODERA // ryo_on%yk.rim.or.jp@localhost
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3


Home | Main Index | Thread Index | Old Index