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" |
| 3 | SECTION = "base/shell" |
| 4 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 5 | DEPENDS = "ncurses bison-native virtual/libiconv" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 6 | |
| 7 | inherit autotools gettext texinfo update-alternatives ptest |
| 8 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 9 | EXTRA_AUTORECONF += "--exclude=autoheader --exclude=aclocal" |
Brad Bishop | d5ae7d9 | 2018-06-14 09:52:03 -0700 | [diff] [blame] | 10 | 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] | 11 | |
| 12 | # If NON_INTERACTIVE_LOGIN_SHELLS is defined, all login shells read the |
| 13 | # startup files, even if they are not interactive. |
| 14 | # This is what other major distros do. And this is what we wanted. See bug#5359 and bug#7137. |
| 15 | CFLAGS += "-DNON_INTERACTIVE_LOGIN_SHELLS" |
| 16 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 17 | ALTERNATIVE_${PN} = "bash sh" |
| 18 | ALTERNATIVE_LINK_NAME[bash] = "${base_bindir}/bash" |
| 19 | ALTERNATIVE_TARGET[bash] = "${base_bindir}/bash" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 20 | ALTERNATIVE_LINK_NAME[sh] = "${base_bindir}/sh" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 21 | ALTERNATIVE_TARGET[sh] = "${base_bindir}/bash.${BPN}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 22 | ALTERNATIVE_PRIORITY = "100" |
| 23 | |
| 24 | RDEPENDS_${PN} += "base-files" |
| 25 | RDEPENDS_${PN}_class-nativesdk = "" |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 26 | RDEPENDS_${PN}-ptest += "make coreutils perl sed shadow util-linux-setpriv" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 27 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 28 | DEPENDS_append_libc-glibc = " virtual/libc-locale" |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 29 | RDEPENDS_${PN}-ptest_append_libc-glibc = " \ |
| 30 | glibc-gconv-big5hkscs \ |
| 31 | glibc-gconv-iso8859-1 \ |
| 32 | glibc-utils \ |
| 33 | locale-base-de-de \ |
| 34 | locale-base-en-us \ |
| 35 | locale-base-fr-fr \ |
| 36 | locale-base-fr-fr.iso-8859-1 \ |
| 37 | locale-base-zh-hk.big5-hkscs \ |
| 38 | " |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 39 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 40 | CACHED_CONFIGUREVARS += "headersdir=${includedir}/${PN}" |
| 41 | |
Brad Bishop | c8f4712 | 2019-06-24 09:36:18 -0400 | [diff] [blame] | 42 | do_compile_prepend() { |
| 43 | # Remove any leftover .build files. This ensures that bash always has the |
| 44 | # same version number and keeps builds reproducible |
| 45 | rm -f ${B}/.build |
| 46 | } |
| 47 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 48 | do_compile_ptest () { |
| 49 | oe_runmake buildtest |
| 50 | } |
| 51 | |
| 52 | do_install_append () { |
| 53 | # Move /usr/bin/bash to /bin/bash, if need |
| 54 | if [ "${base_bindir}" != "${bindir}" ]; then |
| 55 | mkdir -p ${D}${base_bindir} |
| 56 | mv ${D}${bindir}/bash ${D}${base_bindir} |
| 57 | fi |
| 58 | } |
| 59 | do_install_append_class-target () { |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 60 | # Clean buildhost references in bashbug |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 61 | sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 62 | -e "s,-I${WORKDIR}/\S* ,,g" \ |
| 63 | -e 's|${DEBUG_PREFIX_MAP}||g' \ |
| 64 | ${D}${bindir}/bashbug |
| 65 | |
| 66 | # Clean buildhost references in bash.pc |
| 67 | sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \ |
| 68 | ${D}${libdir}/pkgconfig/bash.pc |
| 69 | |
| 70 | # Clean buildhost references in Makefile.inc |
| 71 | sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \ |
| 72 | -e 's|${DEBUG_PREFIX_MAP}||g' \ |
| 73 | -e 's:${HOSTTOOLS_DIR}/::g' \ |
| 74 | -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \ |
| 75 | ${D}${libdir}/bash/Makefile.inc |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 76 | } |
| 77 | |
| 78 | do_install_ptest () { |
| 79 | make INSTALL_TEST_DIR=${D}${PTEST_PATH}/tests install-test |
| 80 | cp ${B}/Makefile ${D}${PTEST_PATH} |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 81 | install -D ${WORKDIR}/run-bash-ptests ${D}${PTEST_PATH}/run-bash-ptests |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 82 | 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] | 83 | -e 's|${DEBUG_PREFIX_MAP}||g' \ |
| 84 | -e "s,${S},,g" -e "s,${B},,g" -e "s,${STAGING_DIR_NATIVE},,g" \ |
| 85 | -e 's:${HOSTTOOLS_DIR}/::g' \ |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 86 | -e 's:${UNINATIVE_LOADER}:${base_bindir}/false:g' \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 87 | ${D}${PTEST_PATH}/Makefile |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 88 | } |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 89 | # The uninative loader is different on i386 & x86_64 hosts. Since it is only |
| 90 | # being replaced with /bin/false anyway, it doesn't need to be part of the task |
| 91 | # hash |
| 92 | do_install_ptest[vardepsexclude] += "UNINATIVE_LOADER" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 93 | |
| 94 | pkg_postinst_${PN} () { |
| 95 | grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells |
| 96 | } |
| 97 | |
| 98 | pkg_postrm_${PN} () { |
| 99 | printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells |
| 100 | } |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 101 | |
| 102 | PACKAGES += "${PN}-bashbug" |
| 103 | FILES_${PN} = "${bindir}/bash ${base_bindir}/bash.bash" |
| 104 | FILES_${PN}-bashbug = "${bindir}/bashbug" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 105 | |
| 106 | PACKAGE_BEFORE_PN += "${PN}-loadable" |
| 107 | RDEPENDS_${PN}-loadable += "${PN}" |
| 108 | FILES_${PN}-loadable += "${libdir}/bash/*" |
| 109 | |
| 110 | RPROVIDES_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '/bin/sh /bin/bash', '', d)}" |