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