| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/app-shells/bash/bash-4.2_p10.ebuild,v 1.5 2011/10/07 20:01:04 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-4.2-patches/
|
| 11 |
PLEVEL=${PV##*_p}
|
| 12 |
MY_PV=${PV/_p*}
|
| 13 |
MY_PV=${MY_PV/_/-}
|
| 14 |
MY_P=${PN}-${MY_PV}
|
| 15 |
[[ ${PV} != *_p* ]] && PLEVEL=0
|
| 16 |
READLINE_VER=6.1
|
| 17 |
READLINE_PLEVEL=0 # both readline patches are also released as bash patches
|
| 18 |
patches() {
|
| 19 |
local opt=$1 plevel=${2:-${PLEVEL}} pn=${3:-${PN}} pv=${4:-${MY_PV}}
|
| 20 |
[[ ${plevel} -eq 0 ]] && return 1
|
| 21 |
eval set -- {1..${plevel}}
|
| 22 |
set -- $(printf "${pn}${pv/\.}-%03d " "$@")
|
| 23 |
if [[ ${opt} == -s ]] ; then
|
| 24 |
echo "${@/#/${DISTDIR}/}"
|
| 25 |
else
|
| 26 |
local u
|
| 27 |
for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${pn} ; do
|
| 28 |
printf "${u}/${pn}-${pv}-patches/%s " "$@"
|
| 29 |
done
|
| 30 |
fi
|
| 31 |
}
|
| 32 |
|
| 33 |
DESCRIPTION="The standard GNU Bourne again shell"
|
| 34 |
HOMEPAGE="http://tiswww.case.edu/php/chet/bash/bashtop.html"
|
| 35 |
SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)
|
| 36 |
$(patches ${READLINE_PLEVEL} readline ${READLINE_VER})"
|
| 37 |
|
| 38 |
LICENSE="GPL-3"
|
| 39 |
SLOT="0"
|
| 40 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
|
| 41 |
IUSE="afs bashlogger examples mem-scramble +net nls plugins vanilla"
|
| 42 |
|
| 43 |
DEPEND=">=sys-libs/ncurses-5.2-r2
|
| 44 |
nls? ( virtual/libintl )"
|
| 45 |
RDEPEND="${DEPEND}
|
| 46 |
!<sys-apps/portage-2.1.6.7_p1
|
| 47 |
!<sys-apps/paludis-0.26.0_alpha5"
|
| 48 |
# we only need yacc when the .y files get patched (bash42-005)
|
| 49 |
DEPEND+=" virtual/yacc"
|
| 50 |
|
| 51 |
S=${WORKDIR}/${MY_P}
|
| 52 |
|
| 53 |
pkg_setup() {
|
| 54 |
if is-flag -malign-double ; then #7332
|
| 55 |
eerror "Detected bad CFLAGS '-malign-double'. Do not use this"
|
| 56 |
eerror "as it breaks LFS (struct stat64) on x86."
|
| 57 |
die "remove -malign-double from your CFLAGS mr ricer"
|
| 58 |
fi
|
| 59 |
if use bashlogger ; then
|
| 60 |
ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
|
| 61 |
ewarn "This will log ALL output you enter into the shell, you have been warned."
|
| 62 |
fi
|
| 63 |
}
|
| 64 |
|
| 65 |
src_unpack() {
|
| 66 |
unpack ${MY_P}.tar.gz
|
| 67 |
cd "${S}"
|
| 68 |
|
| 69 |
# Include official patches
|
| 70 |
[[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
|
| 71 |
cd lib/readline
|
| 72 |
[[ ${READLINE_PLEVEL} -gt 0 ]] && epatch $(patches -s ${READLINE_PLEVEL} readline ${READLINE_VER})
|
| 73 |
cd ../..
|
| 74 |
|
| 75 |
epatch "${FILESDIR}"/${PN}-4.2-execute-job-control.patch #383237
|
| 76 |
epatch "${FILESDIR}"/${PN}-4.2-parallel-build.patch
|
| 77 |
}
|
| 78 |
|
| 79 |
src_compile() {
|
| 80 |
local myconf=
|
| 81 |
|
| 82 |
# For descriptions of these, see config-top.h
|
| 83 |
# bashrc/#26952 bash_logout/#90488 ssh/#24762
|
| 84 |
append-cppflags \
|
| 85 |
-DDEFAULT_PATH_VALUE=\'\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"\' \
|
| 86 |
-DSTANDARD_UTILS_PATH=\'\"/bin:/usr/bin:/sbin:/usr/sbin\"\' \
|
| 87 |
-DSYS_BASHRC=\'\"/etc/bash/bashrc\"\' \
|
| 88 |
-DSYS_BASH_LOGOUT=\'\"/etc/bash/bash_logout\"\' \
|
| 89 |
-DNON_INTERACTIVE_LOGIN_SHELLS \
|
| 90 |
-DSSH_SOURCE_BASHRC \
|
| 91 |
$(use bashlogger && echo -DSYSLOG_HISTORY)
|
| 92 |
|
| 93 |
# Always use the buildin readline, else if we update readline
|
| 94 |
# bash gets borked as readline is usually not binary compadible
|
| 95 |
# between minor versions.
|
| 96 |
#myconf="${myconf} $(use_with !readline installed-readline)"
|
| 97 |
myconf="${myconf} --without-installed-readline"
|
| 98 |
|
| 99 |
# Don't even think about building this statically without
|
| 100 |
# reading Bug 7714 first. If you still build it statically,
|
| 101 |
# don't come crying to us with bugs ;).
|
| 102 |
#use static && export LDFLAGS="${LDFLAGS} -static"
|
| 103 |
use nls || myconf="${myconf} --disable-nls"
|
| 104 |
|
| 105 |
# Force linking with system curses ... the bundled termcap lib
|
| 106 |
# sucks bad compared to ncurses
|
| 107 |
myconf="${myconf} --with-curses"
|
| 108 |
|
| 109 |
use plugins && append-ldflags -Wl,-rpath,/usr/$(get_libdir)/bash
|
| 110 |
econf \
|
| 111 |
$(use_with afs) \
|
| 112 |
$(use_enable net net-redirections) \
|
| 113 |
--disable-profiling \
|
| 114 |
$(use_enable mem-scramble) \
|
| 115 |
$(use_with mem-scramble bash-malloc) \
|
| 116 |
${myconf} || die
|
| 117 |
emake || die "make failed"
|
| 118 |
|
| 119 |
if use plugins ; then
|
| 120 |
emake -C examples/loadables all others || die
|
| 121 |
fi
|
| 122 |
}
|
| 123 |
|
| 124 |
src_install() {
|
| 125 |
emake install DESTDIR="${D}" || die
|
| 126 |
|
| 127 |
dodir /bin
|
| 128 |
mv "${D}"/usr/bin/bash "${D}"/bin/ || die
|
| 129 |
dosym bash /bin/rbash
|
| 130 |
|
| 131 |
insinto /etc/bash
|
| 132 |
doins "${FILESDIR}"/{bashrc,bash_logout}
|
| 133 |
insinto /etc/skel
|
| 134 |
for f in bash{_logout,_profile,rc} ; do
|
| 135 |
newins "${FILESDIR}"/dot-${f} .${f}
|
| 136 |
done
|
| 137 |
|
| 138 |
sed -i -e "s:#${USERLAND}#@::" "${D}"/etc/skel/.bashrc "${D}"/etc/bash/bashrc
|
| 139 |
sed -i -e '/#@/d' "${D}"/etc/skel/.bashrc "${D}"/etc/bash/bashrc
|
| 140 |
|
| 141 |
if use plugins ; then
|
| 142 |
exeinto /usr/$(get_libdir)/bash
|
| 143 |
doexe $(echo examples/loadables/*.o | sed 's:\.o::g') || die
|
| 144 |
fi
|
| 145 |
|
| 146 |
if use examples ; then
|
| 147 |
for d in examples/{functions,misc,scripts,scripts.noah,scripts.v2} ; do
|
| 148 |
exeinto /usr/share/doc/${PF}/${d}
|
| 149 |
insinto /usr/share/doc/${PF}/${d}
|
| 150 |
for f in ${d}/* ; do
|
| 151 |
if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
|
| 152 |
doexe ${f}
|
| 153 |
else
|
| 154 |
doins ${f}
|
| 155 |
fi
|
| 156 |
done
|
| 157 |
done
|
| 158 |
fi
|
| 159 |
|
| 160 |
doman doc/*.1
|
| 161 |
dodoc README NEWS AUTHORS CHANGES COMPAT Y2K doc/FAQ doc/INTRO
|
| 162 |
dosym bash.info /usr/share/info/bashref.info
|
| 163 |
}
|
| 164 |
|
| 165 |
pkg_preinst() {
|
| 166 |
if [[ -e ${ROOT}/etc/bashrc ]] && [[ ! -d ${ROOT}/etc/bash ]] ; then
|
| 167 |
mkdir -p "${ROOT}"/etc/bash
|
| 168 |
mv -f "${ROOT}"/etc/bashrc "${ROOT}"/etc/bash/
|
| 169 |
fi
|
| 170 |
|
| 171 |
if [[ -L ${ROOT}/bin/sh ]]; then
|
| 172 |
# rewrite the symlink to ensure that its mtime changes. having /bin/sh
|
| 173 |
# missing even temporarily causes a fatal error with paludis.
|
| 174 |
local target=$(readlink "${ROOT}"/bin/sh)
|
| 175 |
local tmp=$(emktemp "${ROOT}"/bin)
|
| 176 |
ln -sf "${target}" "${tmp}"
|
| 177 |
mv -f "${tmp}" "${ROOT}"/bin/sh
|
| 178 |
fi
|
| 179 |
}
|
| 180 |
|
| 181 |
pkg_postinst() {
|
| 182 |
# If /bin/sh does not exist, provide it
|
| 183 |
if [[ ! -e ${ROOT}/bin/sh ]]; then
|
| 184 |
ln -sf bash "${ROOT}"/bin/sh
|
| 185 |
fi
|
| 186 |
}
|