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