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 | |
| 9 | EXTRA_AUTORECONF += "--exclude=autoheader" |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 10 | EXTRA_OECONF = "--enable-job-control --without-bash-malloc" |
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 | |
| 17 | ALTERNATIVE_${PN} = "sh" |
| 18 | ALTERNATIVE_LINK_NAME[sh] = "${base_bindir}/sh" |
| 19 | ALTERNATIVE_TARGET[sh] = "${base_bindir}/bash" |
| 20 | ALTERNATIVE_PRIORITY = "100" |
| 21 | |
| 22 | RDEPENDS_${PN} += "base-files" |
| 23 | RDEPENDS_${PN}_class-nativesdk = "" |
| 24 | RDEPENDS_${PN}-ptest += "make" |
| 25 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 26 | USERADD_PACKAGES = "${PN}-ptest" |
| 27 | USERADD_PARAM_${PN}-ptest = "--create-home --user-group test" |
| 28 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 29 | do_configure_prepend () { |
| 30 | if [ ! -e ${S}/acinclude.m4 ]; then |
| 31 | cat ${S}/aclocal.m4 > ${S}/acinclude.m4 |
| 32 | fi |
| 33 | } |
| 34 | |
| 35 | do_compile_ptest () { |
| 36 | oe_runmake buildtest |
| 37 | } |
| 38 | |
| 39 | do_install_append () { |
| 40 | # Move /usr/bin/bash to /bin/bash, if need |
| 41 | if [ "${base_bindir}" != "${bindir}" ]; then |
| 42 | mkdir -p ${D}${base_bindir} |
| 43 | mv ${D}${bindir}/bash ${D}${base_bindir} |
| 44 | fi |
| 45 | } |
| 46 | do_install_append_class-target () { |
| 47 | # Clean host path in bashbug |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 48 | sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \ |
| 49 | -e "s,-I${WORKDIR}/\S* ,,g" ${D}${bindir}/bashbug |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | do_install_ptest () { |
| 53 | make INSTALL_TEST_DIR=${D}${PTEST_PATH}/tests install-test |
| 54 | cp ${B}/Makefile ${D}${PTEST_PATH} |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 55 | sed -i -e 's/^Makefile/_Makefile/' -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \ |
| 56 | -e "s,${S},,g" -e "s,${B},,g" -e "s,${STAGING_DIR_NATIVE},,g" ${D}${PTEST_PATH}/Makefile |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | pkg_postinst_${PN} () { |
| 60 | grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells |
| 61 | } |
| 62 | |
| 63 | pkg_postrm_${PN} () { |
| 64 | printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells |
| 65 | } |