blob: 7350601c655a15e49d88b4002ec5523f12f0fe8b [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "An sh-compatible command language interpreter"
2HOMEPAGE = "http://tiswww.case.edu/php/chet/bash/bashtop.html"
Andrew Geissler95ac1b82021-03-31 14:34:31 -05003DESCRIPTION = "Bash is the GNU Project's Bourne Again SHell, a complete implementation of the IEEE POSIX and Open Group shell specification with interactive command line editing, job control on architectures that support it, csh-like features such as history substitution and brace expansion, and a slew of other features."
Patrick Williamsc124f4f2015-09-15 14:41:29 -05004SECTION = "base/shell"
5
Patrick Williamsc0f7c042017-02-23 20:41:17 -06006DEPENDS = "ncurses bison-native virtual/libiconv"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05007
8inherit autotools gettext texinfo update-alternatives ptest
9
Andrew Geisslerd1e89492021-02-12 15:35:20 -060010EXTRA_AUTORECONF += "--exclude=autoheader"
Brad Bishopd5ae7d92018-06-14 09:52:03 -070011EXTRA_OECONF = "--enable-job-control --without-bash-malloc bash_cv_wexitstatus_offset=8"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050012
13# If NON_INTERACTIVE_LOGIN_SHELLS is defined, all login shells read the
14# startup files, even if they are not interactive.
15# This is what other major distros do. And this is what we wanted. See bug#5359 and bug#7137.
16CFLAGS += "-DNON_INTERACTIVE_LOGIN_SHELLS"
17
Andrew Geisslerd1e89492021-02-12 15:35:20 -060018# This can vary depending upon the host
19CFLAGS += "-DHEREDOC_PIPESIZE=65536"
20
21# Disable bracketed paste mode by default (enabled by default in bash 5.1). It
22# causes a lot of garbage in non-interactive shells
23CFLAGS += "-DBRACKETED_PASTE_DEFAULT=0"
24
Brad Bishop6e60e8b2018-02-01 10:27:11 -050025ALTERNATIVE_${PN} = "bash sh"
26ALTERNATIVE_LINK_NAME[bash] = "${base_bindir}/bash"
27ALTERNATIVE_TARGET[bash] = "${base_bindir}/bash"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028ALTERNATIVE_LINK_NAME[sh] = "${base_bindir}/sh"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050029ALTERNATIVE_TARGET[sh] = "${base_bindir}/bash.${BPN}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050030ALTERNATIVE_PRIORITY = "100"
31
32RDEPENDS_${PN} += "base-files"
33RDEPENDS_${PN}_class-nativesdk = ""
Brad Bishop15ae2502019-06-18 21:44:24 -040034RDEPENDS_${PN}-ptest += "make coreutils perl sed shadow util-linux-setpriv"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050035
Brad Bishop15ae2502019-06-18 21:44:24 -040036RDEPENDS_${PN}-ptest_append_libc-glibc = " \
37 glibc-gconv-big5hkscs \
38 glibc-gconv-iso8859-1 \
39 glibc-utils \
40 locale-base-de-de \
41 locale-base-en-us \
42 locale-base-fr-fr \
43 locale-base-fr-fr.iso-8859-1 \
44 locale-base-zh-hk.big5-hkscs \
45 "
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050046
Brad Bishopd7bf8c12018-02-25 22:55:05 -050047CACHED_CONFIGUREVARS += "headersdir=${includedir}/${PN}"
48
Andrew Geisslerd1e89492021-02-12 15:35:20 -060049do_configure_prepend () {
50 if [ ! -e ${S}/acinclude.m4 ]; then
51 cat ${S}/aclocal.m4 > ${S}/acinclude.m4
52 fi
53}
54
Brad Bishopc8f47122019-06-24 09:36:18 -040055do_compile_prepend() {
56 # Remove any leftover .build files. This ensures that bash always has the
57 # same version number and keeps builds reproducible
58 rm -f ${B}/.build
59}
60
Patrick Williamsc124f4f2015-09-15 14:41:29 -050061do_compile_ptest () {
62 oe_runmake buildtest
63}
64
65do_install_append () {
66 # Move /usr/bin/bash to /bin/bash, if need
67 if [ "${base_bindir}" != "${bindir}" ]; then
68 mkdir -p ${D}${base_bindir}
69 mv ${D}${bindir}/bash ${D}${base_bindir}
70 fi
71}
72do_install_append_class-target () {
Brad Bishopd7bf8c12018-02-25 22:55:05 -050073 # Clean buildhost references in bashbug
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050074 sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050075 -e "s,-I${WORKDIR}/\S* ,,g" \
76 -e 's|${DEBUG_PREFIX_MAP}||g' \
77 ${D}${bindir}/bashbug
78
79 # Clean buildhost references in bash.pc
80 sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \
81 ${D}${libdir}/pkgconfig/bash.pc
82
83 # Clean buildhost references in Makefile.inc
84 sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \
85 -e 's|${DEBUG_PREFIX_MAP}||g' \
86 -e 's:${HOSTTOOLS_DIR}/::g' \
87 -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
88 ${D}${libdir}/bash/Makefile.inc
Patrick Williamsc124f4f2015-09-15 14:41:29 -050089}
90
91do_install_ptest () {
92 make INSTALL_TEST_DIR=${D}${PTEST_PATH}/tests install-test
93 cp ${B}/Makefile ${D}${PTEST_PATH}
Andrew Geisslerc926e172021-05-07 16:11:35 -050094 cp ${B}/config.h ${D}${PTEST_PATH}
95 cp ${B}/version.h ${D}${PTEST_PATH}
96 cp ${S}/y.tab.[ch] ${D}${PTEST_PATH}
Brad Bishop15ae2502019-06-18 21:44:24 -040097 install -D ${WORKDIR}/run-bash-ptests ${D}${PTEST_PATH}/run-bash-ptests
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050098 sed -i -e 's/^Makefile/_Makefile/' -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050099 -e 's|${DEBUG_PREFIX_MAP}||g' \
100 -e "s,${S},,g" -e "s,${B},,g" -e "s,${STAGING_DIR_NATIVE},,g" \
101 -e 's:${HOSTTOOLS_DIR}/::g' \
Brad Bishop15ae2502019-06-18 21:44:24 -0400102 -e 's:${UNINATIVE_LOADER}:${base_bindir}/false:g' \
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500103 ${D}${PTEST_PATH}/Makefile
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500104}
Brad Bishop15ae2502019-06-18 21:44:24 -0400105# The uninative loader is different on i386 & x86_64 hosts. Since it is only
106# being replaced with /bin/false anyway, it doesn't need to be part of the task
107# hash
108do_install_ptest[vardepsexclude] += "UNINATIVE_LOADER"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500109
110pkg_postinst_${PN} () {
111 grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells
112}
113
114pkg_postrm_${PN} () {
115 printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells
116}
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500117
118PACKAGES += "${PN}-bashbug"
119FILES_${PN} = "${bindir}/bash ${base_bindir}/bash.bash"
120FILES_${PN}-bashbug = "${bindir}/bashbug"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500121
122PACKAGE_BEFORE_PN += "${PN}-loadable"
123RDEPENDS_${PN}-loadable += "${PN}"
124FILES_${PN}-loadable += "${libdir}/bash/*"
125
126RPROVIDES_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '/bin/sh /bin/bash', '', d)}"