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