blob: 1d08526c9e758bfcbdc80733567a46e17b0a523a [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "An sh-compatible command language interpreter"
2HOMEPAGE = "http://tiswww.case.edu/php/chet/bash/bashtop.html"
3SECTION = "base/shell"
4
Patrick Williamsc0f7c042017-02-23 20:41:17 -06005DEPENDS = "ncurses bison-native virtual/libiconv"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05006
7inherit autotools gettext texinfo update-alternatives ptest
8
9EXTRA_AUTORECONF += "--exclude=autoheader"
Patrick Williamsf1e5d692016-03-30 15:21:19 -050010EXTRA_OECONF = "--enable-job-control --without-bash-malloc"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050011
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.
15CFLAGS += "-DNON_INTERACTIVE_LOGIN_SHELLS"
16
17ALTERNATIVE_${PN} = "sh"
18ALTERNATIVE_LINK_NAME[sh] = "${base_bindir}/sh"
19ALTERNATIVE_TARGET[sh] = "${base_bindir}/bash"
20ALTERNATIVE_PRIORITY = "100"
21
22RDEPENDS_${PN} += "base-files"
23RDEPENDS_${PN}_class-nativesdk = ""
24RDEPENDS_${PN}-ptest += "make"
25
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050026USERADD_PACKAGES = "${PN}-ptest"
27USERADD_PARAM_${PN}-ptest = "--create-home --user-group test"
28
Patrick Williamsc124f4f2015-09-15 14:41:29 -050029do_configure_prepend () {
30 if [ ! -e ${S}/acinclude.m4 ]; then
31 cat ${S}/aclocal.m4 > ${S}/acinclude.m4
32 fi
33}
34
35do_compile_ptest () {
36 oe_runmake buildtest
37}
38
39do_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}
46do_install_append_class-target () {
47 # Clean host path in bashbug
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050048 sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \
49 -e "s,-I${WORKDIR}/\S* ,,g" ${D}${bindir}/bashbug
Patrick Williamsc124f4f2015-09-15 14:41:29 -050050}
51
52do_install_ptest () {
53 make INSTALL_TEST_DIR=${D}${PTEST_PATH}/tests install-test
54 cp ${B}/Makefile ${D}${PTEST_PATH}
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050055 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 Williamsc124f4f2015-09-15 14:41:29 -050057}
58
59pkg_postinst_${PN} () {
60 grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells
61}
62
63pkg_postrm_${PN} () {
64 printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells
65}