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