1SUMMARY = "An sh-compatible command language interpreter" 2HOMEPAGE = "http://tiswww.case.edu/php/chet/bash/bashtop.html" 3DESCRIPTION = "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." 4SECTION = "base/shell" 5 6DEPENDS = "ncurses bison-native virtual/libiconv" 7 8inherit autotools gettext texinfo update-alternatives ptest 9 10EXTRA_AUTORECONF += "--exclude=autoheader" 11EXTRA_OECONF = "--enable-job-control --without-bash-malloc bash_cv_wexitstatus_offset=8" 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. 16CFLAGS += "-DNON_INTERACTIVE_LOGIN_SHELLS" 17 18# 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 25ALTERNATIVE:${PN} = "bash sh" 26ALTERNATIVE_LINK_NAME[bash] = "${base_bindir}/bash" 27ALTERNATIVE_TARGET[bash] = "${base_bindir}/bash" 28ALTERNATIVE_LINK_NAME[sh] = "${base_bindir}/sh" 29ALTERNATIVE_TARGET[sh] = "${base_bindir}/bash.${BPN}" 30ALTERNATIVE_PRIORITY = "100" 31 32RDEPENDS:${PN} += "base-files" 33RDEPENDS:${PN}:class-nativesdk = "" 34RDEPENDS:${PN}-ptest += "make coreutils perl sed shadow util-linux-setpriv" 35 36RDEPENDS:${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 " 46 47CACHED_CONFIGUREVARS += "headersdir=${includedir}/${PN}" 48 49do_configure:prepend () { 50 if [ ! -e ${S}/acinclude.m4 ]; then 51 cat ${S}/aclocal.m4 > ${S}/acinclude.m4 52 fi 53} 54 55do_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 61do_compile_ptest () { 62 oe_runmake buildtest 63} 64 65do_install:prepend () { 66 # Ensure determinism as this counter increases for each make call 67 rm -f ${B}/.build 68} 69 70do_install:append () { 71 # Move /usr/bin/bash to /bin/bash, if need 72 if [ "${base_bindir}" != "${bindir}" ]; then 73 mkdir -p ${D}${base_bindir} 74 mv ${D}${bindir}/bash ${D}${base_bindir} 75 fi 76} 77 78fix_absolute_paths () { 79 # Clean buildhost references in bashbug 80 sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \ 81 -e "s,-I${WORKDIR}/\S* ,,g" \ 82 -e 's|${DEBUG_PREFIX_MAP}||g' \ 83 ${D}${bindir}/bashbug 84 85 # Clean buildhost references in bash.pc 86 sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \ 87 ${D}${libdir}/pkgconfig/bash.pc 88 89 # Clean buildhost references in Makefile.inc 90 sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \ 91 -e 's|${DEBUG_PREFIX_MAP}||g' \ 92 -e 's:${HOSTTOOLS_DIR}/::g' \ 93 -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \ 94 ${D}${libdir}/bash/Makefile.inc 95} 96 97do_install:append:class-target () { 98 fix_absolute_paths 99} 100 101do_install:append:class-nativesdk () { 102 fix_absolute_paths 103} 104 105do_install_ptest () { 106 make INSTALL_TEST_DIR=${D}${PTEST_PATH}/tests install-test 107 cp ${B}/Makefile ${D}${PTEST_PATH} 108 cp ${B}/config.h ${D}${PTEST_PATH} 109 cp ${B}/version.h ${D}${PTEST_PATH} 110 cp ${S}/y.tab.[ch] ${D}${PTEST_PATH} 111 install -D ${UNPACKDIR}/run-bash-ptests ${D}${PTEST_PATH}/run-bash-ptests 112 sed -i -e 's/^Makefile/_Makefile/' -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \ 113 -e 's|${DEBUG_PREFIX_MAP}||g' \ 114 -e 's|${BUILD_LDFLAGS}||g' \ 115 -e "s,${S},,g" -e "s,${B},,g" -e "s,${STAGING_DIR_NATIVE},,g" \ 116 -e 's:${HOSTTOOLS_DIR}/::g' \ 117 -e 's:${UNINATIVE_LOADER}:${base_bindir}/false:g' \ 118 ${D}${PTEST_PATH}/Makefile 119} 120# The uninative loader is different on i386 & x86_64 hosts. Since it is only 121# being replaced with /bin/false anyway, it doesn't need to be part of the task 122# hash 123do_install_ptest[vardepsexclude] += "UNINATIVE_LOADER" 124 125pkg_postinst:${PN} () { 126 grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells 127} 128 129pkg_postrm:${PN} () { 130 printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells 131} 132 133PACKAGES += "${PN}-bashbug" 134FILES:${PN} = "${bindir}/bash ${base_bindir}/bash.bash" 135FILES:${PN}-bashbug = "${bindir}/bashbug" 136 137PACKAGE_BEFORE_PN += "${PN}-loadable" 138RDEPENDS:${PN}-loadable += "${PN}" 139FILES:${PN}-loadable += "${libdir}/bash/*" 140 141# Limit the RPROVIDES here to class target so that if usrmerge is enabled for nativesdk, it does not 142# include host system paths in /bin/ 143RPROVIDES:${PN}:append:class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '/bin/sh /bin/bash', '', d)}" 144