xref: /OK3568_Linux_fs/buildroot/package/bash/bash.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1################################################################################
2#
3# bash
4#
5################################################################################
6
7BASH_VERSION = 5.1.16
8BASH_SITE = $(BR2_GNU_MIRROR)/bash
9BASH_DEPENDENCIES = ncurses readline host-bison
10BASH_LICENSE = GPL-3.0+
11BASH_LICENSE_FILES = COPYING
12BASH_CPE_ID_VENDOR = gnu
13
14# We want the bash binary in /bin
15BASH_CONF_OPTS = \
16	--bindir=/bin \
17	--with-installed-readline \
18	--without-bash-malloc
19
20BASH_CONF_ENV += \
21	ac_cv_rl_prefix="$(STAGING_DIR)" \
22	ac_cv_rl_version="$(READLINE_VERSION)" \
23	bash_cv_getcwd_malloc=yes \
24	bash_cv_job_control_missing=present \
25	bash_cv_sys_named_pipes=present \
26	bash_cv_func_sigsetjmp=present \
27	bash_cv_printf_a_format=yes
28
29# The static build needs some trickery
30ifeq ($(BR2_STATIC_LIBS),y)
31BASH_CONF_OPTS += --enable-static-link
32# bash wants to redefine the getenv() function. To check whether this is
33# possible, AC_TRY_RUN is used which is not possible in
34# cross-compilation.
35# On uClibc, redefining getenv is not possible; on glibc and musl it is.
36# Related:
37# http://lists.gnu.org/archive/html/bug-bash/2012-03/msg00052.html
38ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
39BASH_CONF_ENV += bash_cv_getenv_redef=no
40else
41BASH_CONF_ENV += bash_cv_getenv_redef=yes
42endif
43endif
44
45define BASH_REMOVE_UNUSED_FILES
46	rm -f $(TARGET_DIR)/bin/bashbug
47endef
48BASH_POST_INSTALL_TARGET_HOOKS += BASH_REMOVE_UNUSED_FILES
49
50ifeq ($(BR2_PACKAGE_BASH_LOADABLE_EXAMPLES),y)
51define BASH_REMOVE_LOADABLE_UNUSED_FILES
52	rm -f $(TARGET_DIR)/usr/lib/bash/Makefile.inc
53	rm -f $(TARGET_DIR)/usr/lib/bash/loadables.h
54endef
55BASH_POST_INSTALL_TARGET_HOOKS += BASH_REMOVE_LOADABLE_UNUSED_FILES
56else
57define BASH_REMOVE_LOADABLE_EXAMPLES
58	rm -rf $(TARGET_DIR)/usr/lib/bash
59endef
60BASH_POST_INSTALL_TARGET_HOOKS += BASH_REMOVE_LOADABLE_EXAMPLES
61endif
62
63# Add /bin/bash to /etc/shells otherwise some login tools like dropbear
64# can reject the user connection. See man shells.
65define BASH_ADD_MKSH_TO_SHELLS
66	grep -qsE '^/bin/bash$$' $(TARGET_DIR)/etc/shells \
67		|| echo "/bin/bash" >> $(TARGET_DIR)/etc/shells
68endef
69BASH_TARGET_FINALIZE_HOOKS += BASH_ADD_MKSH_TO_SHELLS
70
71define BASH_INSTALL_TARGET_ENV
72	$(INSTALL) -D -m 0644 $(BASH_PKGDIR)/bash.bashrc \
73		$(TARGET_DIR)/etc/bash.bashrc
74endef
75BASH_POST_INSTALL_TARGET_HOOKS += BASH_INSTALL_TARGET_ENV
76
77$(eval $(autotools-package))
78