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