| 1 |
# Copyright 1999-2010 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/app-shells/bash/bash-3.2_p50.ebuild,v 1.1 2010/01/21 05:43:22 vapier Exp $
|
| 4 |
|
| 5 |
EAPI=1
|
| 6 |
|
| 7 |
inherit eutils flag-o-matic toolchain-funcs multilib
|
| 8 |
|
| 9 |
# Official patchlevel
|
| 10 |
# See ftp://ftp.cwru.edu/pub/bash/bash-3.2-patches/
|
| 11 |
PLEVEL=${PV##*_p}
|
| 12 |
MY_PV=${PV/_p*}
|
| 13 |
MY_P=${PN}-${MY_PV}
|
| 14 |
READLINE_VER=5.2
|
| 15 |
READLINE_PLEVEL=0 # both readline patches are also released as bash patches
|
| 16 |
|
| 17 |
DESCRIPTION="The standard GNU Bourne again shell"
|
| 18 |
HOMEPAGE="http://tiswww.case.edu/php/chet/bash/bashtop.html"
|
| 19 |
SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz
|
| 20 |
ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz
|
| 21 |
$(for ((i=1; i<=PLEVEL; i++)); do
|
| 22 |
printf 'ftp://ftp.cwru.edu/pub/bash/bash-%s-patches/bash%s-%03d\n' \
|
| 23 |
${MY_PV} ${MY_PV/\.} ${i}
|
| 24 |
printf 'mirror://gnu/bash/bash-%s-patches/bash%s-%03d\n' \
|
| 25 |
${MY_PV} ${MY_PV/\.} ${i}
|
| 26 |
done)
|
| 27 |
$(for ((i=1; i<=READLINE_PLEVEL; i++)); do
|
| 28 |
printf 'ftp://ftp.cwru.edu/pub/bash/readline-%s-patches/readline%s-%03d\n' \
|
| 29 |
${READLINE_VER} ${READLINE_VER/\.} ${i}
|
| 30 |
printf 'mirror://gnu/bash/readline-%s-patches/readline%s-%03d\n' \
|
| 31 |
${READLINE_VER} ${READLINE_VER/\.} ${i}
|
| 32 |
done)"
|
| 33 |
|
| 34 |
LICENSE="GPL-2"
|
| 35 |
SLOT="0"
|
| 36 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
|
| 37 |
IUSE="afs bashlogger examples +net nls plugins vanilla"
|
| 38 |
|
| 39 |
DEPEND=">=sys-libs/ncurses-5.2-r2
|
| 40 |
nls? ( virtual/libintl )"
|
| 41 |
RDEPEND="${DEPEND}
|
| 42 |
!<sys-apps/portage-2.1.5
|
| 43 |
!<sys-apps/paludis-0.26.0_alpha5"
|
| 44 |
|
| 45 |
S=${WORKDIR}/${MY_P}
|
| 46 |
|
| 47 |
pkg_setup() {
|
| 48 |
if is-flag -malign-double ; then #7332
|
| 49 |
eerror "Detected bad CFLAGS '-malign-double'. Do not use this"
|
| 50 |
eerror "as it breaks LFS (struct stat64) on x86."
|
| 51 |
die "remove -malign-double from your CFLAGS mr ricer"
|
| 52 |
fi
|
| 53 |
}
|
| 54 |
|
| 55 |
src_unpack() {
|
| 56 |
unpack ${MY_P}.tar.gz
|
| 57 |
cd "${S}"
|
| 58 |
|
| 59 |
# Include official patches
|
| 60 |
local i
|
| 61 |
for ((i=1; i<=PLEVEL; i++)); do
|
| 62 |
epatch "${DISTDIR}"/${PN}${MY_PV/\.}-$(printf '%03d' ${i})
|
| 63 |
done
|
| 64 |
cd lib/readline
|
| 65 |
for ((i=1; i<=READLINE_PLEVEL; i++)); do
|
| 66 |
epatch "${DISTDIR}"/readline${READLINE_VER/\.}-$(printf '%03d' ${i})
|
| 67 |
done
|
| 68 |
cd ../..
|
| 69 |
|
| 70 |
if ! use vanilla ; then
|
| 71 |
epatch "${FILESDIR}"/autoconf-mktime-2.59.patch #220040
|
| 72 |
epatch "${FILESDIR}"/${PN}-3.1-gentoo.patch
|
| 73 |
epatch "${FILESDIR}"/${PN}-3.2-loadables.patch
|
| 74 |
epatch "${FILESDIR}"/${PN}-3.2-protos.patch
|
| 75 |
epatch "${FILESDIR}"/${PN}-3.2-session-leader.patch #231775
|
| 76 |
epatch "${FILESDIR}"/${PN}-3.2-parallel-build.patch #189671
|
| 77 |
epatch "${FILESDIR}"/${PN}-3.2-ldflags-for-build.patch #211947
|
| 78 |
|
| 79 |
# Fix process substitution on BSD.
|
| 80 |
epatch "${FILESDIR}"/${PN}-3.2-process-subst.patch
|
| 81 |
|
| 82 |
epatch "${FILESDIR}"/${PN}-3.2-ulimit.patch
|
| 83 |
# Don't barf on handled signals in scripts
|
| 84 |
epatch "${FILESDIR}"/${PN}-3.0-trap-fg-signals.patch
|
| 85 |
epatch "${FILESDIR}"/${PN}-3.2-dev-fd-test-as-user.patch #131875
|
| 86 |
# Log bash commands to syslog #91327
|
| 87 |
if use bashlogger ; then
|
| 88 |
echo
|
| 89 |
ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
|
| 90 |
ewarn "This will log ALL output you enter into the shell, you have been warned."
|
| 91 |
ebeep
|
| 92 |
epause
|
| 93 |
epatch "${FILESDIR}"/${PN}-3.1-bash-logger.patch
|
| 94 |
fi
|
| 95 |
fi
|
| 96 |
|
| 97 |
epatch "${FILESDIR}"/${PN}-3.0-configs.patch
|
| 98 |
}
|
| 99 |
|
| 100 |
src_compile() {
|
| 101 |
local myconf=
|
| 102 |
|
| 103 |
# Always use the buildin readline, else if we update readline
|
| 104 |
# bash gets borked as readline is usually not binary compadible
|
| 105 |
# between minor versions.
|
| 106 |
#myconf="${myconf} $(use_with !readline installed-readline)"
|
| 107 |
myconf="${myconf} --without-installed-readline"
|
| 108 |
|
| 109 |
# Don't even think about building this statically without
|
| 110 |
# reading Bug 7714 first. If you still build it statically,
|
| 111 |
# don't come crying to use with bugs ;).
|
| 112 |
#use static && export LDFLAGS="${LDFLAGS} -static"
|
| 113 |
use nls || myconf="${myconf} --disable-nls"
|
| 114 |
|
| 115 |
# Force linking with system curses ... the bundled termcap lib
|
| 116 |
# sucks bad compared to ncurses
|
| 117 |
myconf="${myconf} --with-curses"
|
| 118 |
|
| 119 |
# Default path is to use /usr/local/..... regardless. This little
|
| 120 |
# magic will set the default path to /usr/..... and keep us from
|
| 121 |
# worrying about the rest of the path getting out of sync with the
|
| 122 |
# ebuild code.
|
| 123 |
eval $(echo export $(ac_default_prefix=/usr; eval echo $(grep DEBUGGER_START_FILE= configure)))
|
| 124 |
|
| 125 |
use plugins && append-ldflags -Wl,-rpath,/usr/$(get_libdir)/bash
|
| 126 |
econf \
|
| 127 |
$(use_with afs) \
|
| 128 |
$(use_enable net net-redirections) \
|
| 129 |
--disable-profiling \
|
| 130 |
--without-gnu-malloc \
|
| 131 |
${myconf} || die
|
| 132 |
emake || die "make failed"
|
| 133 |
|
| 134 |
if use plugins ; then
|
| 135 |
emake -C examples/loadables all others || die
|
| 136 |
fi
|
| 137 |
}
|
| 138 |
|
| 139 |
src_install() {
|
| 140 |
emake install DESTDIR="${D}" || die
|
| 141 |
|
| 142 |
dodir /bin
|
| 143 |
mv "${D}"/usr/bin/bash "${D}"/bin/ || die
|
| 144 |
dosym bash /bin/rbash
|
| 145 |
|
| 146 |
insinto /etc/bash
|
| 147 |
doins "${FILESDIR}"/{bashrc,bash_logout}
|
| 148 |
insinto /etc/skel
|
| 149 |
for f in bash{_logout,_profile,rc} ; do
|
| 150 |
newins "${FILESDIR}"/dot-${f} .${f}
|
| 151 |
done
|
| 152 |
|
| 153 |
sed -i -e "s:#${USERLAND}#@::" "${D}"/etc/skel/.bashrc "${D}"/etc/bash/bashrc
|
| 154 |
sed -i -e '/#@/d' "${D}"/etc/skel/.bashrc "${D}"/etc/bash/bashrc
|
| 155 |
|
| 156 |
if use plugins ; then
|
| 157 |
exeinto /usr/$(get_libdir)/bash
|
| 158 |
doexe $(echo examples/loadables/*.o | sed 's:\.o::g') || die
|
| 159 |
fi
|
| 160 |
|
| 161 |
if use examples ; then
|
| 162 |
for d in examples/{functions,misc,scripts,scripts.noah,scripts.v2} ; do
|
| 163 |
exeinto /usr/share/doc/${PF}/${d}
|
| 164 |
insinto /usr/share/doc/${PF}/${d}
|
| 165 |
for f in ${d}/* ; do
|
| 166 |
if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
|
| 167 |
doexe ${f}
|
| 168 |
else
|
| 169 |
doins ${f}
|
| 170 |
fi
|
| 171 |
done
|
| 172 |
done
|
| 173 |
fi
|
| 174 |
|
| 175 |
doman doc/*.1
|
| 176 |
dodoc README NEWS AUTHORS CHANGES COMPAT Y2K doc/FAQ doc/INTRO
|
| 177 |
dosym bash.info /usr/share/info/bashref.info
|
| 178 |
}
|
| 179 |
|
| 180 |
pkg_preinst() {
|
| 181 |
if [[ -e ${ROOT}/etc/bashrc ]] && [[ ! -d ${ROOT}/etc/bash ]] ; then
|
| 182 |
mkdir -p "${ROOT}"/etc/bash
|
| 183 |
mv -f "${ROOT}"/etc/bashrc "${ROOT}"/etc/bash/
|
| 184 |
fi
|
| 185 |
|
| 186 |
if [[ -L ${ROOT}/bin/sh ]]; then
|
| 187 |
# rewrite the symlink to ensure that its mtime changes. having /bin/sh
|
| 188 |
# missing even temporarily causes a fatal error with paludis.
|
| 189 |
local target=$(readlink "${ROOT}"/bin/sh)
|
| 190 |
ln -sf "${target}" "${ROOT}"/bin/sh
|
| 191 |
fi
|
| 192 |
}
|
| 193 |
|
| 194 |
pkg_postinst() {
|
| 195 |
# If /bin/sh does not exist, provide it
|
| 196 |
if [[ ! -e ${ROOT}/bin/sh ]]; then
|
| 197 |
ln -sf bash "${ROOT}"/bin/sh
|
| 198 |
fi
|
| 199 |
}
|