1################################################################################
2#
3# gettext-gnu
4#
5################################################################################
6
7# Please keep in sync with GETTEXT_TINY_ARCHIVE_VERSION in
8# gettext-tiny/gettext-tiny.mk
9GETTEXT_GNU_VERSION = 0.22.4
10GETTEXT_GNU_SITE = $(BR2_GNU_MIRROR)/gettext
11GETTEXT_GNU_SOURCE = gettext-$(GETTEXT_GNU_VERSION).tar.xz
12GETTEXT_GNU_INSTALL_STAGING = YES
13GETTEXT_GNU_LICENSE = LGPL-2.1+ (libintl), GPL-3.0+ (the rest)
14GETTEXT_GNU_LICENSE_FILES = COPYING gettext-runtime/intl/COPYING.LIB
15GETTEXT_GNU_CPE_ID_VENDOR = gnu
16GETTEXT_GNU_CPE_ID_PRODUCT = gettext
17GETTEXT_GNU_PROVIDES = gettext
18GETTEXT_GNU_DEPENDENCIES = $(if $(BR2_PACKAGE_LIBICONV),libiconv)
19
20# Avoid using the bundled subset of libxml2
21HOST_GETTEXT_GNU_DEPENDENCIES = host-libxml2
22
23GETTEXT_GNU_CONF_OPTS += \
24	--disable-libasprintf \
25	--disable-acl \
26	--disable-openmp \
27	--disable-rpath \
28	--disable-java \
29	--disable-native-java \
30	--disable-csharp \
31	--disable-relocatable \
32	--without-emacs
33
34HOST_GETTEXT_GNU_CONF_OPTS = \
35	--disable-libasprintf \
36	--disable-acl \
37	--disable-openmp \
38	--disable-rpath \
39	--disable-java \
40	--disable-native-java \
41	--disable-csharp \
42	--disable-relocatable \
43	--without-emacs
44
45# Force the build of libintl, even if the C library provides a stub
46# gettext implementation
47ifeq ($(BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL),y)
48GETTEXT_GNU_CONF_OPTS += --with-included-gettext
49else
50GETTEXT_GNU_CONF_OPTS += --without-included-gettext
51endif
52
53# For the target version, we only need the runtime.
54GETTEXT_GNU_SUBDIR = gettext-runtime
55# For the host variant, we only need the tools, but those need the
56# runtime, so it is much simpler to build the whole package. _SUBDIR
57# for the host is inherited from the target if not set or empty, so
58# we need to explicitly set it to build the whole package.
59HOST_GETTEXT_GNU_SUBDIR = .
60
61# Disable the build of documentation and examples of gettext-tools,
62# and the build of documentation and tests of gettext-runtime.
63define HOST_GETTEXT_GNU_DISABLE_UNNEEDED
64	$(SED) '/^SUBDIRS/s/ doc //;/^SUBDIRS/s/examples$$//' $(@D)/gettext-tools/Makefile.in
65	$(SED) '/^SUBDIRS/s/ doc //;/^SUBDIRS/s/tests$$//' $(@D)/gettext-runtime/Makefile.in
66endef
67
68GETTEXT_GNU_POST_PATCH_HOOKS += HOST_GETTEXT_GNU_DISABLE_UNNEEDED
69HOST_GETTEXT_GNU_POST_PATCH_HOOKS += HOST_GETTEXT_GNU_DISABLE_UNNEEDED
70
71define GETTEXT_GNU_REMOVE_UNNEEDED
72	$(RM) -rf $(TARGET_DIR)/usr/share/gettext/ABOUT-NLS
73	rmdir --ignore-fail-on-non-empty $(TARGET_DIR)/usr/share/gettext
74endef
75
76GETTEXT_GNU_POST_INSTALL_TARGET_HOOKS += GETTEXT_GNU_REMOVE_UNNEEDED
77
78# Force build with NLS support, otherwise libintl is not built
79# This is needed because some packages (eg. libglib2) requires
80# locales, but do not properly depend on BR2_ENABLE_LOCALE, and
81# instead select BR2_PACKAGE_GETTEXT_GNU. Those packages need to be
82# fixed before we can remove the following 3 lines... :-(
83ifeq ($(BR2_ENABLE_LOCALE),)
84GETTEXT_GNU_CONF_OPTS += --enable-nls
85endif
86
87# Disable interactive confirmation in host gettextize for package fixups
88define HOST_GETTEXT_GNU_GETTEXTIZE_CONFIRMATION
89	$(SED) '/read dummy/d' $(HOST_DIR)/bin/gettextize
90endef
91HOST_GETTEXT_GNU_POST_INSTALL_HOOKS += HOST_GETTEXT_GNU_GETTEXTIZE_CONFIRMATION
92
93$(eval $(autotools-package))
94$(eval $(host-autotools-package))
95