blob: c06f157b8a68d508d17af98258df6d2f8dfd4ad8 [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
5DEPENDS = "ncurses bison-native"
6
7inherit autotools gettext texinfo update-alternatives ptest
8
9EXTRA_AUTORECONF += "--exclude=autoheader"
10EXTRA_OECONF = "--enable-job-control"
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.
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
26do_configure_prepend () {
27 if [ ! -e ${S}/acinclude.m4 ]; then
28 cat ${S}/aclocal.m4 > ${S}/acinclude.m4
29 fi
30}
31
32do_compile_ptest () {
33 oe_runmake buildtest
34}
35
36do_install_append () {
37 # Move /usr/bin/bash to /bin/bash, if need
38 if [ "${base_bindir}" != "${bindir}" ]; then
39 mkdir -p ${D}${base_bindir}
40 mv ${D}${bindir}/bash ${D}${base_bindir}
41 fi
42}
43do_install_append_class-target () {
44 # Clean host path in bashbug
45 sed -i -e "s,${STAGING_DIR_TARGET},,g" ${D}${bindir}/bashbug
46}
47
48do_install_ptest () {
49 make INSTALL_TEST_DIR=${D}${PTEST_PATH}/tests install-test
50 cp ${B}/Makefile ${D}${PTEST_PATH}
51 sed -i 's/^Makefile/_Makefile/' ${D}${PTEST_PATH}/Makefile
52}
53
54pkg_postinst_${PN} () {
55 grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells
56}
57
58pkg_postrm_${PN} () {
59 printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells
60}