blob: f4e1f7a11f4c91839b327e7a1eb21ca6b9e587a2 [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
Brad Bishop6e60e8b2018-02-01 10:27:11 -050017ALTERNATIVE_${PN} = "bash sh"
18ALTERNATIVE_LINK_NAME[bash] = "${base_bindir}/bash"
19ALTERNATIVE_TARGET[bash] = "${base_bindir}/bash"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050020ALTERNATIVE_LINK_NAME[sh] = "${base_bindir}/sh"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050021ALTERNATIVE_TARGET[sh] = "${base_bindir}/bash.${BPN}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050022ALTERNATIVE_PRIORITY = "100"
23
24RDEPENDS_${PN} += "base-files"
25RDEPENDS_${PN}_class-nativesdk = ""
26RDEPENDS_${PN}-ptest += "make"
27
Brad Bishopd7bf8c12018-02-25 22:55:05 -050028DEPENDS_append_libc-glibc = " glibc-locale"
29RDEPENDS_${PN}-ptest_append_libc-glibc = " locale-base-fr-fr locale-base-de-de"
30
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050031USERADD_PACKAGES = "${PN}-ptest"
32USERADD_PARAM_${PN}-ptest = "--create-home --user-group test"
33
Brad Bishopd7bf8c12018-02-25 22:55:05 -050034CACHED_CONFIGUREVARS += "headersdir=${includedir}/${PN}"
35
Patrick Williamsc124f4f2015-09-15 14:41:29 -050036do_configure_prepend () {
37 if [ ! -e ${S}/acinclude.m4 ]; then
38 cat ${S}/aclocal.m4 > ${S}/acinclude.m4
39 fi
40}
41
42do_compile_ptest () {
43 oe_runmake buildtest
44}
45
46do_install_append () {
47 # Move /usr/bin/bash to /bin/bash, if need
48 if [ "${base_bindir}" != "${bindir}" ]; then
49 mkdir -p ${D}${base_bindir}
50 mv ${D}${bindir}/bash ${D}${base_bindir}
51 fi
52}
53do_install_append_class-target () {
Brad Bishopd7bf8c12018-02-25 22:55:05 -050054 # Clean buildhost references in bashbug
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050055 sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050056 -e "s,-I${WORKDIR}/\S* ,,g" \
57 -e 's|${DEBUG_PREFIX_MAP}||g' \
58 ${D}${bindir}/bashbug
59
60 # Clean buildhost references in bash.pc
61 sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \
62 ${D}${libdir}/pkgconfig/bash.pc
63
64 # Clean buildhost references in Makefile.inc
65 sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \
66 -e 's|${DEBUG_PREFIX_MAP}||g' \
67 -e 's:${HOSTTOOLS_DIR}/::g' \
68 -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
69 ${D}${libdir}/bash/Makefile.inc
Patrick Williamsc124f4f2015-09-15 14:41:29 -050070}
71
72do_install_ptest () {
73 make INSTALL_TEST_DIR=${D}${PTEST_PATH}/tests install-test
74 cp ${B}/Makefile ${D}${PTEST_PATH}
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050075 sed -i -e 's/^Makefile/_Makefile/' -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050076 -e 's|${DEBUG_PREFIX_MAP}||g' \
77 -e "s,${S},,g" -e "s,${B},,g" -e "s,${STAGING_DIR_NATIVE},,g" \
78 -e 's:${HOSTTOOLS_DIR}/::g' \
79 ${D}${PTEST_PATH}/Makefile
Patrick Williamsc124f4f2015-09-15 14:41:29 -050080}
81
82pkg_postinst_${PN} () {
83 grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells
84}
85
86pkg_postrm_${PN} () {
87 printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells
88}
Brad Bishop6e60e8b2018-02-01 10:27:11 -050089
90PACKAGES += "${PN}-bashbug"
91FILES_${PN} = "${bindir}/bash ${base_bindir}/bash.bash"
92FILES_${PN}-bashbug = "${bindir}/bashbug"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050093
94PACKAGE_BEFORE_PN += "${PN}-loadable"
95RDEPENDS_${PN}-loadable += "${PN}"
96FILES_${PN}-loadable += "${libdir}/bash/*"
97
98RPROVIDES_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '/bin/sh /bin/bash', '', d)}"