Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | SUMMARY = "An sh-compatible command language interpreter" |
| 2 | HOMEPAGE = "http://tiswww.case.edu/php/chet/bash/bashtop.html" |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 3 | DESCRIPTION = "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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 4 | SECTION = "base/shell" |
| 5 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 6 | DEPENDS = "ncurses bison-native virtual/libiconv" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 7 | |
| 8 | inherit autotools gettext texinfo update-alternatives ptest |
| 9 | |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 10 | EXTRA_AUTORECONF += "--exclude=autoheader" |
Brad Bishop | d5ae7d9 | 2018-06-14 09:52:03 -0700 | [diff] [blame] | 11 | EXTRA_OECONF = "--enable-job-control --without-bash-malloc bash_cv_wexitstatus_offset=8" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 12 | |
| 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. |
| 16 | CFLAGS += "-DNON_INTERACTIVE_LOGIN_SHELLS" |
| 17 | |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 18 | # This can vary depending upon the host |
| 19 | CFLAGS += "-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 |
| 23 | CFLAGS += "-DBRACKETED_PASTE_DEFAULT=0" |
| 24 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 25 | ALTERNATIVE:${PN} = "bash sh" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 26 | ALTERNATIVE_LINK_NAME[bash] = "${base_bindir}/bash" |
| 27 | ALTERNATIVE_TARGET[bash] = "${base_bindir}/bash" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 28 | ALTERNATIVE_LINK_NAME[sh] = "${base_bindir}/sh" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 29 | ALTERNATIVE_TARGET[sh] = "${base_bindir}/bash.${BPN}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 30 | ALTERNATIVE_PRIORITY = "100" |
| 31 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 32 | RDEPENDS:${PN} += "base-files" |
| 33 | RDEPENDS:${PN}:class-nativesdk = "" |
| 34 | RDEPENDS:${PN}-ptest += "make coreutils perl sed shadow util-linux-setpriv" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 35 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 36 | RDEPENDS:${PN}-ptest:append:libc-glibc = " \ |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 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 Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 46 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 47 | CACHED_CONFIGUREVARS += "headersdir=${includedir}/${PN}" |
| 48 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 49 | do_configure:prepend () { |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 50 | if [ ! -e ${S}/acinclude.m4 ]; then |
| 51 | cat ${S}/aclocal.m4 > ${S}/acinclude.m4 |
| 52 | fi |
| 53 | } |
| 54 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 55 | do_compile:prepend() { |
Brad Bishop | c8f4712 | 2019-06-24 09:36:18 -0400 | [diff] [blame] | 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 61 | do_compile_ptest () { |
| 62 | oe_runmake buildtest |
| 63 | } |
| 64 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 65 | do_install:append () { |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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 | } |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 72 | do_install:append:class-target () { |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 73 | # Clean buildhost references in bashbug |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 74 | sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 75 | -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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | do_install_ptest () { |
| 92 | make INSTALL_TEST_DIR=${D}${PTEST_PATH}/tests install-test |
| 93 | cp ${B}/Makefile ${D}${PTEST_PATH} |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 94 | 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 Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 97 | install -D ${WORKDIR}/run-bash-ptests ${D}${PTEST_PATH}/run-bash-ptests |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 98 | sed -i -e 's/^Makefile/_Makefile/' -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 99 | -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 Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 102 | -e 's:${UNINATIVE_LOADER}:${base_bindir}/false:g' \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 103 | ${D}${PTEST_PATH}/Makefile |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 104 | } |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 105 | # 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 |
| 108 | do_install_ptest[vardepsexclude] += "UNINATIVE_LOADER" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 109 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 110 | pkg_postinst:${PN} () { |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 111 | grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells |
| 112 | } |
| 113 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 114 | pkg_postrm:${PN} () { |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 115 | printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells |
| 116 | } |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 117 | |
| 118 | PACKAGES += "${PN}-bashbug" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 119 | FILES:${PN} = "${bindir}/bash ${base_bindir}/bash.bash" |
| 120 | FILES:${PN}-bashbug = "${bindir}/bashbug" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 121 | |
| 122 | PACKAGE_BEFORE_PN += "${PN}-loadable" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 123 | RDEPENDS:${PN}-loadable += "${PN}" |
| 124 | FILES:${PN}-loadable += "${libdir}/bash/*" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 125 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 126 | RPROVIDES:${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '/bin/sh /bin/bash', '', d)}" |