| 1 |
# Copyright 1999-2006 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: $ |
| 4 |
|
| 5 |
EAPI="prefix" |
| 6 |
|
| 7 |
inherit eutils flag-o-matic toolchain-funcs |
| 8 |
|
| 9 |
# Official patchlevel |
| 10 |
# See ftp://ftp.cwru.edu/pub/bash/bash-3.1-patches/ |
| 11 |
PLEVEL=${PV##*_p} |
| 12 |
MY_PV=${PV/_p*} |
| 13 |
MY_P=${PN}-${MY_PV} |
| 14 |
READLINE_VER=5.1 |
| 15 |
READLINE_PLEVEL=1 |
| 16 |
|
| 17 |
DESCRIPTION="The standard GNU Bourne again shell" |
| 18 |
HOMEPAGE="http://cnswww.cns.cwru.edu/~chet/bash/bashtop.html" |
| 19 |
# Hit the GNU mirrors before hitting Chet's site |
| 20 |
SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz |
| 21 |
ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz |
| 22 |
$(for ((i=1; i<=PLEVEL; i++)); do |
| 23 |
printf 'ftp://ftp.cwru.edu/pub/bash/bash-%s-patches/bash%s-%03d\n' \ |
| 24 |
${MY_PV} ${MY_PV/\.} ${i} |
| 25 |
printf 'mirror://gnu/bash/bash-%s-patches/bash%s-%03d\n' \ |
| 26 |
${MY_PV} ${MY_PV/\.} ${i} |
| 27 |
done) |
| 28 |
$(for ((i=1; i<=READLINE_PLEVEL; i++)); do |
| 29 |
printf 'ftp://ftp.cwru.edu/pub/bash/readline-%s-patches/readline%s-%03d\n' \ |
| 30 |
${READLINE_VER} ${READLINE_VER/\.} ${i} |
| 31 |
printf 'mirror://gnu/bash/readline-%s-patches/readline%s-%03d\n' \ |
| 32 |
${READLINE_VER} ${READLINE_VER/\.} ${i} |
| 33 |
done)" |
| 34 |
|
| 35 |
LICENSE="GPL-2" |
| 36 |
SLOT="0" |
| 37 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc-macos ~ppc64 ~s390 ~sh ~sparc ~x86" |
| 38 |
IUSE="afs nls build bashlogger unicode" |
| 39 |
|
| 40 |
DEPEND=">=sys-libs/ncurses-5.2-r2" |
| 41 |
|
| 42 |
S=${WORKDIR}/${MY_P} |
| 43 |
|
| 44 |
src_unpack() { |
| 45 |
unpack ${MY_P}.tar.gz |
| 46 |
cd "${S}" |
| 47 |
epatch "${FILESDIR}"/${PN}-3.1-gentoo.patch |
| 48 |
|
| 49 |
# Include official patches |
| 50 |
local i |
| 51 |
for ((i=1; i<=PLEVEL; i++)); do |
| 52 |
epatch "${DISTDIR}"/${PN}${MY_PV/\.}-$(printf '%03d' ${i}) |
| 53 |
done |
| 54 |
cd lib/readline |
| 55 |
for ((i=1; i<=READLINE_PLEVEL; i++)); do |
| 56 |
epatch "${DISTDIR}"/readline${READLINE_VER/\.}-$(printf '%03d' ${i}) |
| 57 |
done |
| 58 |
cd ../.. |
| 59 |
|
| 60 |
# Fall back to /etc/inputrc |
| 61 |
epatch "${FILESDIR}"/${PN}-3.0-etc-inputrc.patch |
| 62 |
# Add more ulimit options (from Fedora) |
| 63 |
epatch "${FILESDIR}"/${MY_P}-ulimit.patch |
| 64 |
# Fix a memleak in read_builtin (from Fedora) |
| 65 |
epatch "${FILESDIR}"/${PN}-3.0-read-memleak.patch |
| 66 |
# Don't barf on handled signals in scripts |
| 67 |
epatch "${FILESDIR}"/${PN}-3.0-trap-fg-signals.patch |
| 68 |
# Fix -/bin/bash login shell #118257 |
| 69 |
epatch "${FILESDIR}"/bash-3.1-fix-dash-login-shell.patch |
| 70 |
# # Fix generation of signals list when cross-compiling |
| 71 |
# epatch "${FILESDIR}"/${PN}-3.0-cross-signals.patch |
| 72 |
# Log bash commands to syslog #91327 |
| 73 |
if use bashlogger ; then |
| 74 |
echo |
| 75 |
ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs." |
| 76 |
ewarn "This will log ALL output you enter into the shell, you have been warned." |
| 77 |
ebeep |
| 78 |
epause |
| 79 |
epatch "${FILESDIR}"/${PN}-3.1-bash-logger.patch |
| 80 |
fi |
| 81 |
|
| 82 |
epatch "${FILESDIR}"/${PN}-3.0-configs.patch |
| 83 |
|
| 84 |
sed -i 's:-lcurses:-lncurses:' configure || die "sed configure" |
| 85 |
|
| 86 |
epatch "${FILESDIR}"/${PN}-3.0-pathnames.patch |
| 87 |
sed -i -e "s:\@PREFIX\@:${PREFIX}:g" config-top.h pathnames.h.in \ |
| 88 |
|| die "sed failed." |
| 89 |
} |
| 90 |
|
| 91 |
src_compile() { |
| 92 |
filter-flags -malign-double |
| 93 |
|
| 94 |
local myconf= |
| 95 |
|
| 96 |
# Always use the buildin readline, else if we update readline |
| 97 |
# bash gets borked as readline is usually not binary compadible |
| 98 |
# between minor versions. |
| 99 |
#myconf="${myconf} $(use_with !readline installed-readline)" |
| 100 |
myconf="${myconf} --without-installed-readline" |
| 101 |
|
| 102 |
# Don't even think about building this statically without |
| 103 |
# reading Bug 7714 first. If you still build it statically, |
| 104 |
# don't come crying to use with bugs ;). |
| 105 |
#use static && export LDFLAGS="${LDFLAGS} -static" |
| 106 |
use nls || myconf="${myconf} --disable-nls" |
| 107 |
|
| 108 |
# Force linking with system curses ... the bundled termcap lib |
| 109 |
# sucks bad compared to ncurses |
| 110 |
export bash_cv_termcap_lib=libcurses |
| 111 |
myconf="${myconf} --with-curses" |
| 112 |
|
| 113 |
econf \ |
| 114 |
$(use_with afs) \ |
| 115 |
--disable-profiling \ |
| 116 |
--without-gnu-malloc \ |
| 117 |
${myconf} || die |
| 118 |
emake -j1 || die "make failed" # see bug 102426 |
| 119 |
} |
| 120 |
|
| 121 |
src_install() { |
| 122 |
einstall || die |
| 123 |
|
| 124 |
dodir /bin |
| 125 |
mv "${D}"/usr/bin/bash "${D}"/bin/ |
| 126 |
[[ ${USERLAND} != "BSD" ]] && dosym bash /bin/sh |
| 127 |
dosym bash /bin/rbash |
| 128 |
|
| 129 |
insinto /etc/bash |
| 130 |
doins "${FILESDIR}"/{bashrc,bash_logout} |
| 131 |
insinto /etc/skel |
| 132 |
for f in bash{_logout,_profile,rc} ; do |
| 133 |
newins "${FILESDIR}"/dot-${f} .${f} |
| 134 |
done |
| 135 |
|
| 136 |
if use build ; then |
| 137 |
rm -rf "${D}"/usr |
| 138 |
else |
| 139 |
doman doc/*.1 |
| 140 |
dodoc README NEWS AUTHORS CHANGES COMPAT Y2K doc/FAQ doc/INTRO |
| 141 |
dosym bash.info.gz /usr/share/info/bashref.info.gz |
| 142 |
fi |
| 143 |
} |
| 144 |
|
| 145 |
pkg_preinst() { |
| 146 |
if [[ -e ${ROOT}/etc/bashrc ]] && [[ ! -d ${ROOT}/etc/bash ]] ; then |
| 147 |
mkdir -p "${ROOT}"/etc/bash |
| 148 |
mv -f "${ROOT}"/etc/bashrc "${ROOT}"/etc/bash/ |
| 149 |
fi |
| 150 |
|
| 151 |
# our bash_logout is just a place holder so dont |
| 152 |
# force users to go through etc-update all the time |
| 153 |
if [[ -e ${ROOT}/etc/bash/bash_logout ]] ; then |
| 154 |
rm -f "${D}"/etc/bash/bash_logout |
| 155 |
fi |
| 156 |
} |