1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit eutils flag-o-matic toolchain-funcs
9 # See ftp://ftp.cwru.edu/pub/bash/bash-2.05b-patches/
14 [[ ${PV} != *_p* ]] && PLEVEL=0
16 local opt=$1 plevel=${2:-${PLEVEL}} pn=${3:-${PN}} pv=${4:-${MY_PV}}
17 [[ ${plevel} -eq 0 ]] && return 1
18 eval set -- {1..${plevel}}
19 set -- $(printf "${pn}${pv/\.}-%03d " "$@")
20 if [[ ${opt} == -s ]] ; then
21 echo "${@/#/${DISTDIR}/}"
24 for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${pn} ; do
25 printf "${u}/${pn}-${pv}-patches/%s " "$@"
30 DESCRIPTION="The standard GNU Bourne again shell"
31 HOMEPAGE="http://tiswww.case.edu/php/chet/bash/bashtop.html"
32 SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
36 KEYWORDS="~alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sparc x86"
37 IUSE="afs +net nls +readline static"
39 LIB_DEPEND=">=sys-libs/ncurses-5.2-r2[static-libs(+)]
40 nls? ( virtual/libintl )
41 readline? ( >=sys-libs/readline-6.2[static-libs(+)] )"
42 RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} )"
44 static? ( ${LIB_DEPEND} )"
49 if is-flag -malign-double ; then #7332
50 eerror "Detected bad CFLAGS '-malign-double'. Do not use this"
51 eerror "as it breaks LFS (struct stat64) on x86."
52 die "remove -malign-double from your CFLAGS mr ricer"
61 # Include official patches
62 [[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
64 # Clean out local libs so we know we use system ones
65 rm -rf lib/{readline,termcap}/*
66 touch lib/{readline,termcap}/Makefile.in # for config.status
67 sed -ri -e 's:\$[(](RL|HIST)_LIBSRC[)]/[[:alpha:]]*.h::g' Makefile.in || die
69 epatch "${FILESDIR}"/${PN}-2.05b-destdir.patch
70 epatch "${FILESDIR}"/autoconf-mktime-2.53.patch #220040
71 epatch "${FILESDIR}"/${PN}-2.05b-protos.patch
72 epatch "${FILESDIR}"/${PN}-2.05b-empty-herestring.patch
73 epatch "${FILESDIR}"/${PN}-2.05b-rbash.patch #26854
74 epatch "${FILESDIR}"/${PN}-2.05b-parallel-build.patch #41002
75 epatch "${FILESDIR}"/${PN}-2.05b-jobs.patch
76 epatch "${FILESDIR}"/${PN}-2.05b-fix-job-warning.patch
77 epatch "${FILESDIR}"/${PN}-3.1-dev-fd-buffer-overflow.patch #431850
85 # Force pgrp synchronization
86 # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=81653
87 export bash_cv_pgrp_pipe=yes
89 # For descriptions of these, see config-top.h
90 # bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
92 -DDEFAULT_PATH_VALUE=\'\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"\' \
93 -DSTANDARD_UTILS_PATH=\'\"/bin:/usr/bin:/sbin:/usr/sbin\"\' \
94 -DSYS_BASHRC=\'\"/etc/bash/bashrc\"\' \
95 -DSYS_BASH_LOGOUT=\'\"/etc/bash/bash_logout\"\' \
96 -DNON_INTERACTIVE_LOGIN_SHELLS \
98 -DUSE_MKTEMP -DUSE_MKSTEMP
100 use static && append-ldflags -static
101 use nls || myconf+=( --disable-nls )
103 # Historically, we always used the builtin readline, but since
104 # our handling of SONAME upgrades has gotten much more stable
105 # in the PM (and the readline ebuild itself preserves the old
106 # libs during upgrades), linking against the system copy should
108 # Exact cached version here doesn't really matter as long as it
109 # is at least what's in the DEPEND up above.
110 export ac_cv_rl_version=6.2
112 # Force linking with system curses ... the bundled termcap lib
113 # sucks bad compared to ncurses. For the most part, ncurses
114 # is here because readline needs it. But bash itself calls
115 # ncurses in one or two small places :(.
118 # This old autoconf script does not re-exec itself properly and fails when
119 # /bin/sh is not bash. Rather than try to regen everything, just force the
120 # use of bash directly.
121 CONFIG_SHELL="/bin/bash" \
123 --with-installed-readline=. \
126 $(use_enable net net-redirections) \
127 --disable-profiling \
128 --without-gnu-malloc \
129 $(use_enable readline) \
130 $(use_enable readline history) \
131 $(use_enable readline bang-history) \
137 newbin bash bash-${SLOT}
139 newman doc/bash.1 bash-${SLOT}.1
140 newman doc/builtins.1 builtins-${SLOT}.1
142 insinto /usr/share/info
143 newins doc/bashref.info bash-${SLOT}.info
144 dosym bash-${SLOT}.info /usr/share/info/bashref-${SLOT}.info
146 dodoc README NEWS AUTHORS CHANGES COMPAT Y2K doc/FAQ doc/INTRO