Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/
Date: Tue, 15 Jan 2019 01:05:39
Message-Id: 1547514322.d1906c39529bc3af416fcc4e7b1edc4901981b71.whissi@gentoo
1 commit: d1906c39529bc3af416fcc4e7b1edc4901981b71
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 15 01:02:46 2019 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 15 01:05:22 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d1906c39
7
8 app-shells/bash: define SHOBJ_STATUS; fix static build
9
10 Link: http://lists.gnu.org/archive/html/bug-bash/2016-10/msg00004.html
11 Bug: https://bugs.gentoo.org/675414
12 Package-Manager: Portage-2.3.55, Repoman-2.3.12
13 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
14
15 app-shells/bash/bash-4.4_p23-r1.ebuild | 260 +++++++++++++++++++++
16 .../bash/files/bash-4.4-set-SHOBJ_STATUS.patch | 14 ++
17 2 files changed, 274 insertions(+)
18
19 diff --git a/app-shells/bash/bash-4.4_p23-r1.ebuild b/app-shells/bash/bash-4.4_p23-r1.ebuild
20 new file mode 100644
21 index 00000000000..506c772dc1b
22 --- /dev/null
23 +++ b/app-shells/bash/bash-4.4_p23-r1.ebuild
24 @@ -0,0 +1,260 @@
25 +# Copyright 1999-2019 Gentoo Authors
26 +# Distributed under the terms of the GNU General Public License v2
27 +
28 +EAPI=6
29 +
30 +inherit flag-o-matic toolchain-funcs multilib prefix
31 +
32 +# Official patchlevel
33 +# See ftp://ftp.cwru.edu/pub/bash/bash-4.4-patches/
34 +PLEVEL=${PV##*_p}
35 +MY_PV=${PV/_p*}
36 +MY_PV=${MY_PV/_/-}
37 +MY_P=${PN}-${MY_PV}
38 +is_release() {
39 + case ${PV} in
40 + *_alpha*|*_beta*|*_rc*) return 1 ;;
41 + *) return 0 ;;
42 + esac
43 +}
44 +[[ ${PV} != *_p* ]] && PLEVEL=0
45 +patches() {
46 + local opt=$1 plevel=${2:-${PLEVEL}} pn=${3:-${PN}} pv=${4:-${MY_PV}}
47 + [[ ${plevel} -eq 0 ]] && return 1
48 + eval set -- {1..${plevel}}
49 + set -- $(printf "${pn}${pv/\.}-%03d " "$@")
50 + if [[ ${opt} == -s ]] ; then
51 + echo "${@/#/${DISTDIR}/}"
52 + else
53 + local u
54 + for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${pn} ; do
55 + printf "${u}/${pn}-${pv}-patches/%s " "$@"
56 + done
57 + fi
58 +}
59 +
60 +# The version of readline this bash normally ships with.
61 +READLINE_VER="7.0"
62 +
63 +DESCRIPTION="The standard GNU Bourne again shell"
64 +HOMEPAGE="http://tiswww.case.edu/php/chet/bash/bashtop.html"
65 +if is_release ; then
66 + SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
67 +else
68 + SRC_URI="ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
69 +fi
70 +
71 +LICENSE="GPL-3"
72 +SLOT="0"
73 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
74 +IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline"
75 +
76 +DEPEND="
77 + >=sys-libs/ncurses-5.2-r2:0=
78 + readline? ( >=sys-libs/readline-${READLINE_VER}:0= )
79 + nls? ( virtual/libintl )
80 +"
81 +RDEPEND="
82 + ${DEPEND}
83 + !<sys-apps/portage-2.1.6.7_p1
84 +"
85 +# we only need yacc when the .y files get patched (bash42-005)
86 +#DEPEND+=" virtual/yacc"
87 +
88 +S="${WORKDIR}/${MY_P}"
89 +
90 +pkg_setup() {
91 + if is-flag -malign-double ; then #7332
92 + eerror "Detected bad CFLAGS '-malign-double'. Do not use this"
93 + eerror "as it breaks LFS (struct stat64) on x86."
94 + die "remove -malign-double from your CFLAGS mr ricer"
95 + fi
96 + if use bashlogger ; then
97 + ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
98 + ewarn "This will log ALL output you enter into the shell, you have been warned."
99 + fi
100 +}
101 +
102 +src_unpack() {
103 + unpack ${MY_P}.tar.gz
104 +}
105 +
106 +src_prepare() {
107 + # Include official patches
108 + [[ ${PLEVEL} -gt 0 ]] && eapply -p0 $(patches -s)
109 +
110 + eapply "${FILESDIR}/${PN}-4.4-jobs_overflow.patch" #644720
111 + eapply "${FILESDIR}/${PN}-4.4-set-SHOBJ_STATUS.patch" #644720
112 +
113 + # Clean out local libs so we know we use system ones w/releases.
114 + if is_release ; then
115 + rm -rf lib/{readline,termcap}/*
116 + touch lib/{readline,termcap}/Makefile.in # for config.status
117 + sed -ri -e 's:\$[(](RL|HIST)_LIBSRC[)]/[[:alpha:]]*.h::g' Makefile.in || die
118 + fi
119 +
120 + # Prefixify hardcoded path names. No-op for non-prefix.
121 + hprefixify pathnames.h.in
122 +
123 + # Avoid regenerating docs after patches #407985
124 + sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
125 + touch -r . doc/*
126 +
127 + eapply_user
128 +}
129 +
130 +src_configure() {
131 + local myconf=(
132 + --disable-profiling
133 + --docdir='$(datarootdir)'/doc/${PF}
134 + --htmldir='$(docdir)/html'
135 + --with-curses
136 + $(use_enable mem-scramble)
137 + $(use_enable net net-redirections)
138 + $(use_enable readline)
139 + $(use_enable readline bang-history)
140 + $(use_enable readline history)
141 + $(use_with afs)
142 + $(use_with mem-scramble bash-malloc)
143 + )
144 +
145 + # For descriptions of these, see config-top.h
146 + # bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
147 + append-cppflags \
148 + -DDEFAULT_PATH_VALUE=\'\"${EPREFIX}/usr/local/sbin:${EPREFIX}/usr/local/bin:${EPREFIX}/usr/sbin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/bin\"\' \
149 + -DSTANDARD_UTILS_PATH=\'\"${EPREFIX}/bin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/usr/sbin\"\' \
150 + -DSYS_BASHRC=\'\"${EPREFIX}/etc/bash/bashrc\"\' \
151 + -DSYS_BASH_LOGOUT=\'\"${EPREFIX}/etc/bash/bash_logout\"\' \
152 + -DNON_INTERACTIVE_LOGIN_SHELLS \
153 + -DSSH_SOURCE_BASHRC \
154 + $(use bashlogger && echo -DSYSLOG_HISTORY)
155 +
156 + # Don't even think about building this statically without
157 + # reading Bug 7714 first. If you still build it statically,
158 + # don't come crying to us with bugs ;).
159 + #use static && export LDFLAGS="${LDFLAGS} -static"
160 + use nls || myconf+=( --disable-nls )
161 +
162 + # Historically, we always used the builtin readline, but since
163 + # our handling of SONAME upgrades has gotten much more stable
164 + # in the PM (and the readline ebuild itself preserves the old
165 + # libs during upgrades), linking against the system copy should
166 + # be safe.
167 + # Exact cached version here doesn't really matter as long as it
168 + # is at least what's in the DEPEND up above.
169 + export ac_cv_rl_version=${READLINE_VER%%_*}
170 +
171 + # Force linking with system curses ... the bundled termcap lib
172 + # sucks bad compared to ncurses. For the most part, ncurses
173 + # is here because readline needs it. But bash itself calls
174 + # ncurses in one or two small places :(.
175 +
176 + if is_release ; then
177 + # Use system readline only with released versions.
178 + myconf+=( --with-installed-readline=. )
179 + fi
180 +
181 + if use plugins; then
182 + append-ldflags -Wl,-rpath,/usr/$(get_libdir)/bash
183 + else
184 + # Disable the plugins logic by hand since bash doesn't
185 + # provide a way of doing it.
186 + export ac_cv_func_dl{close,open,sym}=no \
187 + ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
188 + sed -i \
189 + -e '/LOCAL_LDFLAGS=/s:-rdynamic::' \
190 + configure || die
191 + fi
192 + tc-export AR #444070
193 + econf "${myconf[@]}"
194 +}
195 +
196 +src_compile() {
197 + emake
198 +
199 + if use plugins ; then
200 + emake -C examples/loadables all others
201 + fi
202 +}
203 +
204 +src_install() {
205 + local d f
206 +
207 + default
208 +
209 + dodir /bin
210 + mv "${ED%/}"/usr/bin/bash "${ED%/}"/bin/ || die
211 + dosym bash /bin/rbash
212 +
213 + insinto /etc/bash
214 + doins "${FILESDIR}"/bash_logout
215 + doins "$(prefixify_ro "${FILESDIR}"/bashrc)"
216 + keepdir /etc/bash/bashrc.d
217 + insinto /etc/skel
218 + for f in bash{_logout,_profile,rc} ; do
219 + newins "${FILESDIR}"/dot-${f} .${f}
220 + done
221 +
222 + local sed_args=(
223 + -e "s:#${USERLAND}#@::"
224 + -e '/#@/d'
225 + )
226 + if ! use readline ; then
227 + sed_args+=( #432338
228 + -e '/^shopt -s histappend/s:^:#:'
229 + -e 's:use_color=true:use_color=false:'
230 + )
231 + fi
232 + sed -i \
233 + "${sed_args[@]}" \
234 + "${ED%/}"/etc/skel/.bashrc \
235 + "${ED%/}"/etc/bash/bashrc || die
236 +
237 + if use plugins ; then
238 + exeinto /usr/$(get_libdir)/bash
239 + doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
240 + insinto /usr/include/bash-plugins
241 + doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
242 + fi
243 +
244 + if use examples ; then
245 + for d in examples/{functions,misc,scripts,startup-files} ; do
246 + exeinto /usr/share/doc/${PF}/${d}
247 + insinto /usr/share/doc/${PF}/${d}
248 + for f in ${d}/* ; do
249 + if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
250 + doexe ${f}
251 + else
252 + doins ${f}
253 + fi
254 + done
255 + done
256 + fi
257 +
258 + doman doc/*.1
259 + newdoc CWRU/changelog ChangeLog
260 + dosym bash.info /usr/share/info/bashref.info
261 +}
262 +
263 +pkg_preinst() {
264 + if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then
265 + mkdir -p "${EROOT}"/etc/bash
266 + mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
267 + fi
268 +
269 + if [[ -L ${EROOT}/bin/sh ]] ; then
270 + # rewrite the symlink to ensure that its mtime changes. having /bin/sh
271 + # missing even temporarily causes a fatal error with paludis.
272 + local target=$(readlink "${EROOT}"/bin/sh)
273 + local tmp=$(emktemp "${EROOT}"/bin)
274 + ln -sf "${target}" "${tmp}"
275 + mv -f "${tmp}" "${EROOT}"/bin/sh
276 + fi
277 +}
278 +
279 +pkg_postinst() {
280 + # If /bin/sh does not exist, provide it
281 + if [[ ! -e ${EROOT}/bin/sh ]] ; then
282 + ln -sf bash "${EROOT}"/bin/sh
283 + fi
284 +}
285
286 diff --git a/app-shells/bash/files/bash-4.4-set-SHOBJ_STATUS.patch b/app-shells/bash/files/bash-4.4-set-SHOBJ_STATUS.patch
287 new file mode 100644
288 index 00000000000..96302c2030e
289 --- /dev/null
290 +++ b/app-shells/bash/files/bash-4.4-set-SHOBJ_STATUS.patch
291 @@ -0,0 +1,14 @@
292 +http://lists.gnu.org/archive/html/bug-bash/2016-10/msg00004.html
293 +
294 +--- a/configure
295 ++++ b/configure
296 +@@ -16124,6 +16124,9 @@ $as_echo_n "checking shared object configuration for loadable builtins... " >&6;
297 +
298 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SHOBJ_STATUS" >&5
299 + $as_echo "$SHOBJ_STATUS" >&6; }
300 ++else
301 ++ SHOBJ_STATUS=unsupported
302 ++
303 + fi
304 +
305 + # try to create a directory tree if the source is elsewhere