/[gentoo-x86]/app-shells/bash/bash-4.2_p10.ebuild
Gentoo

Contents of /app-shells/bash/bash-4.2_p10.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Mon May 16 10:36:26 2011 UTC (3 years, 4 months ago) by nyhm
Branch: MAIN
Changes since 1.1: +4 -2 lines
Rewrite /bin/sh symlink atomically, bug #367241

(Portage version: 2.2.0_alpha33/cvs/Linux x86_64)

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.2_p10.ebuild,v 1.1 2011/05/09 14:56:18 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.7.16
47 !<sys-apps/paludis-0.26.0_alpha5"
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 cd lib/readline
70 [[ ${READLINE_PLEVEL} -gt 0 ]] && epatch $(patches -s ${READLINE_PLEVEL} readline ${READLINE_VER})
71 cd ../..
72 }
73
74 src_compile() {
75 local myconf=
76
77 # For descriptions of these, see config-top.h
78 # bashrc/#26952 bash_logout/#90488 ssh/#24762
79 append-cppflags \
80 -DDEFAULT_PATH_VALUE=\'\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"\' \
81 -DSTANDARD_UTILS_PATH=\'\"/bin:/usr/bin:/sbin:/usr/sbin\"\' \
82 -DSYS_BASHRC=\'\"/etc/bash/bashrc\"\' \
83 -DSYS_BASH_LOGOUT=\'\"/etc/bash/bash_logout\"\' \
84 -DNON_INTERACTIVE_LOGIN_SHELLS \
85 -DSSH_SOURCE_BASHRC \
86 $(use bashlogger && echo -DSYSLOG_HISTORY)
87
88 # Always use the buildin readline, else if we update readline
89 # bash gets borked as readline is usually not binary compadible
90 # between minor versions.
91 #myconf="${myconf} $(use_with !readline installed-readline)"
92 myconf="${myconf} --without-installed-readline"
93
94 # Don't even think about building this statically without
95 # reading Bug 7714 first. If you still build it statically,
96 # don't come crying to us with bugs ;).
97 #use static && export LDFLAGS="${LDFLAGS} -static"
98 use nls || myconf="${myconf} --disable-nls"
99
100 # Force linking with system curses ... the bundled termcap lib
101 # sucks bad compared to ncurses
102 myconf="${myconf} --with-curses"
103
104 use plugins && append-ldflags -Wl,-rpath,/usr/$(get_libdir)/bash
105 econf \
106 $(use_with afs) \
107 $(use_enable net net-redirections) \
108 --disable-profiling \
109 $(use_enable mem-scramble) \
110 $(use_with mem-scramble bash-malloc) \
111 ${myconf} || die
112 emake || die "make failed"
113
114 if use plugins ; then
115 emake -C examples/loadables all others || die
116 fi
117 }
118
119 src_install() {
120 emake install DESTDIR="${D}" || die
121
122 dodir /bin
123 mv "${D}"/usr/bin/bash "${D}"/bin/ || die
124 dosym bash /bin/rbash
125
126 insinto /etc/bash
127 doins "${FILESDIR}"/{bashrc,bash_logout}
128 insinto /etc/skel
129 for f in bash{_logout,_profile,rc} ; do
130 newins "${FILESDIR}"/dot-${f} .${f}
131 done
132
133 sed -i -e "s:#${USERLAND}#@::" "${D}"/etc/skel/.bashrc "${D}"/etc/bash/bashrc
134 sed -i -e '/#@/d' "${D}"/etc/skel/.bashrc "${D}"/etc/bash/bashrc
135
136 if use plugins ; then
137 exeinto /usr/$(get_libdir)/bash
138 doexe $(echo examples/loadables/*.o | sed 's:\.o::g') || die
139 fi
140
141 if use examples ; then
142 for d in examples/{functions,misc,scripts,scripts.noah,scripts.v2} ; do
143 exeinto /usr/share/doc/${PF}/${d}
144 insinto /usr/share/doc/${PF}/${d}
145 for f in ${d}/* ; do
146 if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
147 doexe ${f}
148 else
149 doins ${f}
150 fi
151 done
152 done
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 }

  ViewVC Help
Powered by ViewVC 1.1.20