1eb8dc403SDave CobbleySUMMARY = "An sh-compatible command language interpreter" 2eb8dc403SDave CobbleyHOMEPAGE = "http://tiswww.case.edu/php/chet/bash/bashtop.html" 3*95ac1b8dSAndrew GeisslerDESCRIPTION = "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." 4eb8dc403SDave CobbleySECTION = "base/shell" 5eb8dc403SDave Cobbley 6eb8dc403SDave CobbleyDEPENDS = "ncurses bison-native virtual/libiconv" 7eb8dc403SDave Cobbley 8eb8dc403SDave Cobbleyinherit autotools gettext texinfo update-alternatives ptest 9eb8dc403SDave Cobbley 10d1e89497SAndrew GeisslerEXTRA_AUTORECONF += "--exclude=autoheader" 11d5ae7d90SBrad BishopEXTRA_OECONF = "--enable-job-control --without-bash-malloc bash_cv_wexitstatus_offset=8" 12eb8dc403SDave Cobbley 13eb8dc403SDave Cobbley# If NON_INTERACTIVE_LOGIN_SHELLS is defined, all login shells read the 14eb8dc403SDave Cobbley# startup files, even if they are not interactive. 15eb8dc403SDave Cobbley# This is what other major distros do. And this is what we wanted. See bug#5359 and bug#7137. 16eb8dc403SDave CobbleyCFLAGS += "-DNON_INTERACTIVE_LOGIN_SHELLS" 17eb8dc403SDave Cobbley 18d1e89497SAndrew Geissler# This can vary depending upon the host 19d1e89497SAndrew GeisslerCFLAGS += "-DHEREDOC_PIPESIZE=65536" 20d1e89497SAndrew Geissler 21d1e89497SAndrew Geissler# Disable bracketed paste mode by default (enabled by default in bash 5.1). It 22d1e89497SAndrew Geissler# causes a lot of garbage in non-interactive shells 23d1e89497SAndrew GeisslerCFLAGS += "-DBRACKETED_PASTE_DEFAULT=0" 24d1e89497SAndrew Geissler 25eb8dc403SDave CobbleyALTERNATIVE_${PN} = "bash sh" 26eb8dc403SDave CobbleyALTERNATIVE_LINK_NAME[bash] = "${base_bindir}/bash" 27eb8dc403SDave CobbleyALTERNATIVE_TARGET[bash] = "${base_bindir}/bash" 28eb8dc403SDave CobbleyALTERNATIVE_LINK_NAME[sh] = "${base_bindir}/sh" 29eb8dc403SDave CobbleyALTERNATIVE_TARGET[sh] = "${base_bindir}/bash.${BPN}" 30eb8dc403SDave CobbleyALTERNATIVE_PRIORITY = "100" 31eb8dc403SDave Cobbley 32eb8dc403SDave CobbleyRDEPENDS_${PN} += "base-files" 33eb8dc403SDave CobbleyRDEPENDS_${PN}_class-nativesdk = "" 3415ae2509SBrad BishopRDEPENDS_${PN}-ptest += "make coreutils perl sed shadow util-linux-setpriv" 35eb8dc403SDave Cobbley 3615ae2509SBrad BishopRDEPENDS_${PN}-ptest_append_libc-glibc = " \ 3715ae2509SBrad Bishop glibc-gconv-big5hkscs \ 3815ae2509SBrad Bishop glibc-gconv-iso8859-1 \ 3915ae2509SBrad Bishop glibc-utils \ 4015ae2509SBrad Bishop locale-base-de-de \ 4115ae2509SBrad Bishop locale-base-en-us \ 4215ae2509SBrad Bishop locale-base-fr-fr \ 4315ae2509SBrad Bishop locale-base-fr-fr.iso-8859-1 \ 4415ae2509SBrad Bishop locale-base-zh-hk.big5-hkscs \ 4515ae2509SBrad Bishop " 46eb8dc403SDave Cobbley 47eb8dc403SDave CobbleyCACHED_CONFIGUREVARS += "headersdir=${includedir}/${PN}" 48eb8dc403SDave Cobbley 49d1e89497SAndrew Geisslerdo_configure_prepend () { 50d1e89497SAndrew Geissler if [ ! -e ${S}/acinclude.m4 ]; then 51d1e89497SAndrew Geissler cat ${S}/aclocal.m4 > ${S}/acinclude.m4 52d1e89497SAndrew Geissler fi 53d1e89497SAndrew Geissler} 54d1e89497SAndrew Geissler 55c8f47128SBrad Bishopdo_compile_prepend() { 56c8f47128SBrad Bishop # Remove any leftover .build files. This ensures that bash always has the 57c8f47128SBrad Bishop # same version number and keeps builds reproducible 58c8f47128SBrad Bishop rm -f ${B}/.build 59c8f47128SBrad Bishop} 60c8f47128SBrad Bishop 61eb8dc403SDave Cobbleydo_compile_ptest () { 62eb8dc403SDave Cobbley oe_runmake buildtest 63eb8dc403SDave Cobbley} 64eb8dc403SDave Cobbley 65eb8dc403SDave Cobbleydo_install_append () { 66eb8dc403SDave Cobbley # Move /usr/bin/bash to /bin/bash, if need 67eb8dc403SDave Cobbley if [ "${base_bindir}" != "${bindir}" ]; then 68eb8dc403SDave Cobbley mkdir -p ${D}${base_bindir} 69eb8dc403SDave Cobbley mv ${D}${bindir}/bash ${D}${base_bindir} 70eb8dc403SDave Cobbley fi 71eb8dc403SDave Cobbley} 72eb8dc403SDave Cobbleydo_install_append_class-target () { 73eb8dc403SDave Cobbley # Clean buildhost references in bashbug 74eb8dc403SDave Cobbley sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \ 75eb8dc403SDave Cobbley -e "s,-I${WORKDIR}/\S* ,,g" \ 76eb8dc403SDave Cobbley -e 's|${DEBUG_PREFIX_MAP}||g' \ 77eb8dc403SDave Cobbley ${D}${bindir}/bashbug 78eb8dc403SDave Cobbley 79eb8dc403SDave Cobbley # Clean buildhost references in bash.pc 80eb8dc403SDave Cobbley sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \ 81eb8dc403SDave Cobbley ${D}${libdir}/pkgconfig/bash.pc 82eb8dc403SDave Cobbley 83eb8dc403SDave Cobbley # Clean buildhost references in Makefile.inc 84eb8dc403SDave Cobbley sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \ 85eb8dc403SDave Cobbley -e 's|${DEBUG_PREFIX_MAP}||g' \ 86eb8dc403SDave Cobbley -e 's:${HOSTTOOLS_DIR}/::g' \ 87eb8dc403SDave Cobbley -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \ 88eb8dc403SDave Cobbley ${D}${libdir}/bash/Makefile.inc 89eb8dc403SDave Cobbley} 90eb8dc403SDave Cobbley 91eb8dc403SDave Cobbleydo_install_ptest () { 92eb8dc403SDave Cobbley make INSTALL_TEST_DIR=${D}${PTEST_PATH}/tests install-test 93eb8dc403SDave Cobbley cp ${B}/Makefile ${D}${PTEST_PATH} 9415ae2509SBrad Bishop install -D ${WORKDIR}/run-bash-ptests ${D}${PTEST_PATH}/run-bash-ptests 95eb8dc403SDave Cobbley sed -i -e 's/^Makefile/_Makefile/' -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \ 96eb8dc403SDave Cobbley -e 's|${DEBUG_PREFIX_MAP}||g' \ 97eb8dc403SDave Cobbley -e "s,${S},,g" -e "s,${B},,g" -e "s,${STAGING_DIR_NATIVE},,g" \ 98eb8dc403SDave Cobbley -e 's:${HOSTTOOLS_DIR}/::g' \ 9915ae2509SBrad Bishop -e 's:${UNINATIVE_LOADER}:${base_bindir}/false:g' \ 100eb8dc403SDave Cobbley ${D}${PTEST_PATH}/Makefile 101eb8dc403SDave Cobbley} 10215ae2509SBrad Bishop# The uninative loader is different on i386 & x86_64 hosts. Since it is only 10315ae2509SBrad Bishop# being replaced with /bin/false anyway, it doesn't need to be part of the task 10415ae2509SBrad Bishop# hash 10515ae2509SBrad Bishopdo_install_ptest[vardepsexclude] += "UNINATIVE_LOADER" 106eb8dc403SDave Cobbley 107eb8dc403SDave Cobbleypkg_postinst_${PN} () { 108eb8dc403SDave Cobbley grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells 109eb8dc403SDave Cobbley} 110eb8dc403SDave Cobbley 111eb8dc403SDave Cobbleypkg_postrm_${PN} () { 112eb8dc403SDave Cobbley printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells 113eb8dc403SDave Cobbley} 114eb8dc403SDave Cobbley 115eb8dc403SDave CobbleyPACKAGES += "${PN}-bashbug" 116eb8dc403SDave CobbleyFILES_${PN} = "${bindir}/bash ${base_bindir}/bash.bash" 117eb8dc403SDave CobbleyFILES_${PN}-bashbug = "${bindir}/bashbug" 118eb8dc403SDave Cobbley 119eb8dc403SDave CobbleyPACKAGE_BEFORE_PN += "${PN}-loadable" 120eb8dc403SDave CobbleyRDEPENDS_${PN}-loadable += "${PN}" 121eb8dc403SDave CobbleyFILES_${PN}-loadable += "${libdir}/bash/*" 122eb8dc403SDave Cobbley 123eb8dc403SDave CobbleyRPROVIDES_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '/bin/sh /bin/bash', '', d)}" 124