7 |
7 |
|
8 |
8 |
# Uncomment if we have a patchset
|
9 |
9 |
GENTOO_PATCH_DEV="sam"
|
10 |
|
GENTOO_PATCH_VER="${PV}"
|
|
10 |
GENTOO_PATCH_VER="${PV}-r2"
|
11 |
11 |
|
12 |
12 |
# Official patchlevel
|
13 |
|
# See ftp://ftp.cwru.edu/pub/bash/bash-4.2-patches/
|
|
13 |
# See ftp://ftp.cwru.edu/pub/bash/bash-4.3-patches/
|
14 |
14 |
PLEVEL="${PV##*_p}"
|
15 |
15 |
MY_PV="${PV/_p*}"
|
16 |
16 |
MY_PV="${MY_PV/_/-}"
|
... | ... | |
31 |
31 |
fi
|
32 |
32 |
}
|
33 |
33 |
|
|
34 |
# The version of readline this bash normally ships with.
|
|
35 |
READLINE_VER="6.3"
|
|
36 |
|
34 |
37 |
DESCRIPTION="The standard GNU Bourne again shell"
|
35 |
38 |
HOMEPAGE="https://tiswww.case.edu/php/chet/bash/bashtop.html"
|
36 |
39 |
SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
|
|
40 |
[[ ${PV} == *_rc* ]] && SRC_URI+=" ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
|
37 |
41 |
|
38 |
42 |
if [[ -n ${GENTOO_PATCH_VER} ]] ; then
|
39 |
43 |
SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
|
... | ... | |
42 |
46 |
LICENSE="GPL-3"
|
43 |
47 |
SLOT="${MY_PV}"
|
44 |
48 |
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 sparc x86"
|
45 |
|
IUSE="afs mem-scramble +net nls +readline static"
|
|
49 |
IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline"
|
46 |
50 |
|
47 |
|
LIB_DEPEND=">=sys-libs/ncurses-5.2-r2[static-libs(+)]
|
48 |
|
nls? ( virtual/libintl )
|
49 |
|
readline? ( >=sys-libs/readline-6.2[static-libs(+)] )"
|
50 |
|
RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} )"
|
51 |
|
DEPEND="${RDEPEND}
|
52 |
|
static? ( ${LIB_DEPEND} )"
|
|
51 |
DEPEND=">=sys-libs/ncurses-5.2-r2:0=
|
|
52 |
readline? ( >=sys-libs/readline-${READLINE_VER}:0= )
|
|
53 |
nls? ( virtual/libintl )"
|
|
54 |
RDEPEND="${DEPEND}
|
|
55 |
!<sys-apps/portage-2.1.6.7_p1"
|
53 |
56 |
# We only need bison (yacc) when the .y files get patched (bash42-005)
|
54 |
57 |
BDEPEND="sys-devel/bison"
|
55 |
58 |
|
56 |
|
S="${WORKDIR}/${MY_P}"
|
57 |
|
|
58 |
59 |
PATCHES=(
|
59 |
|
"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-4.2-execute-job-control.patch # bug #383237
|
60 |
|
"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-4.2-parallel-build.patch
|
61 |
|
"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-4.2-no-readline.patch
|
62 |
|
"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-4.2-read-retry.patch # bug #447810
|
63 |
|
"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-4.2-speed-up-read-N.patch
|
|
60 |
"${WORKDIR}"/${P}-r2-patches/${PN}-4.3-mapfile-improper-array-name-validation.patch
|
|
61 |
"${WORKDIR}"/${P}-r2-patches/${PN}-4.3-arrayfunc.patch
|
|
62 |
"${WORKDIR}"/${P}-r2-patches/${PN}-4.3-protos.patch
|
|
63 |
"${WORKDIR}"/${P}-r2-patches/${PN}-4.4-popd-offset-overflow.patch # bug #600174
|
64 |
64 |
)
|
65 |
65 |
|
|
66 |
S="${WORKDIR}/${MY_P}"
|
|
67 |
|
66 |
68 |
pkg_setup() {
|
67 |
69 |
# bug #7332
|
68 |
70 |
if is-flag -malign-double ; then
|
... | ... | |
70 |
72 |
eerror "as it breaks LFS (struct stat64) on x86."
|
71 |
73 |
die "remove -malign-double from your CFLAGS mr ricer"
|
72 |
74 |
fi
|
|
75 |
|
|
76 |
if use bashlogger ; then
|
|
77 |
ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
|
|
78 |
ewarn "This will log ALL output you enter into the shell, you have been warned."
|
|
79 |
fi
|
73 |
80 |
}
|
74 |
81 |
|
75 |
82 |
src_unpack() {
|
... | ... | |
84 |
91 |
# Include official patches
|
85 |
92 |
[[ ${PLEVEL} -gt 0 ]] && eapply -p0 $(patches -s)
|
86 |
93 |
|
87 |
|
# Clean out local libs so we know we use system ones
|
88 |
|
rm -rf lib/{readline,termcap}/* || die
|
89 |
|
touch lib/{readline,termcap}/Makefile.in || die # for config.status
|
90 |
|
sed -ri -e 's:\$[{(](RL|HIST)_LIBSRC[)}]/[[:alpha:]_-]*\.h::g' Makefile.in || die
|
|
94 |
# Clean out local libs so we know we use system ones w/releases.
|
|
95 |
if [[ ${PV} != *_rc* ]] ; then
|
|
96 |
rm -rf lib/{readline,termcap}/* || die
|
|
97 |
touch lib/{readline,termcap}/Makefile.in || die # for config.status
|
|
98 |
sed -ri -e 's:\$[{(](RL|HIST)_LIBSRC[)}]/[[:alpha:]_-]*\.h::g' Makefile.in || die
|
|
99 |
fi
|
91 |
100 |
|
92 |
|
# Avoid regenerating docs after patches #407985
|
|
101 |
# Avoid regenerating docs after patches, bug #407985
|
93 |
102 |
sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
|
94 |
103 |
touch -r . doc/* || die
|
95 |
104 |
|
... | ... | |
105 |
114 |
unset YACC
|
106 |
115 |
|
107 |
116 |
local myconf=(
|
108 |
|
--with-installed-readline=.
|
|
117 |
--docdir='$(datarootdir)'/doc/${PF}
|
|
118 |
--htmldir='$(docdir)/html'
|
109 |
119 |
|
110 |
120 |
# Force linking with system curses ... the bundled termcap lib
|
111 |
121 |
# sucks bad compared to ncurses. For the most part, ncurses
|
... | ... | |
126 |
136 |
# For descriptions of these, see config-top.h
|
127 |
137 |
# bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
|
128 |
138 |
append-cppflags \
|
129 |
|
-DDEFAULT_PATH_VALUE=\'\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"\' \
|
130 |
|
-DSTANDARD_UTILS_PATH=\'\"/bin:/usr/bin:/sbin:/usr/sbin\"\' \
|
131 |
|
-DSYS_BASHRC=\'\"/etc/bash/bashrc\"\' \
|
132 |
|
-DSYS_BASH_LOGOUT=\'\"/etc/bash/bash_logout\"\' \
|
|
139 |
-DDEFAULT_PATH_VALUE=\'\""${EPREFIX}"/usr/local/sbin:"${EPREFIX}"/usr/local/bin:"${EPREFIX}"/usr/sbin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/bin\"\' \
|
|
140 |
-DSTANDARD_UTILS_PATH=\'\""${EPREFIX}"/bin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/usr/sbin\"\' \
|
|
141 |
-DSYS_BASHRC=\'\""${EPREFIX}"/etc/bash/bashrc\"\' \
|
|
142 |
-DSYS_BASH_LOGOUT=\'\""${EPREFIX}"/etc/bash/bash_logout\"\' \
|
133 |
143 |
-DNON_INTERACTIVE_LOGIN_SHELLS \
|
134 |
144 |
-DSSH_SOURCE_BASHRC \
|
135 |
|
-DUSE_MKTEMP -DUSE_MKSTEMP
|
|
145 |
-DUSE_MKTEMP -DUSE_MKSTEMP \
|
|
146 |
$(use bashlogger && echo -DSYSLOG_HISTORY)
|
136 |
147 |
|
137 |
|
use static && append-ldflags -static
|
|
148 |
# Don't even think about building this statically without
|
|
149 |
# reading bug #7714 first. If you still build it statically,
|
|
150 |
# don't come crying to us with bugs ;).
|
|
151 |
#use static && export LDFLAGS="${LDFLAGS} -static"
|
138 |
152 |
use nls || myconf+=( --disable-nls )
|
139 |
153 |
|
140 |
154 |
# Historically, we always used the builtin readline, but since
|
... | ... | |
144 |
158 |
# be safe.
|
145 |
159 |
# Exact cached version here doesn't really matter as long as it
|
146 |
160 |
# is at least what's in the DEPEND up above.
|
147 |
|
export ac_cv_rl_version=6.2
|
|
161 |
export ac_cv_rl_version=${READLINE_VER}
|
|
162 |
|
|
163 |
if [[ ${PV} != *_rc* ]] ; then
|
|
164 |
# Use system readline only with released versions.
|
|
165 |
myconf+=( --with-installed-readline=. )
|
|
166 |
fi
|
|
167 |
|
|
168 |
if use plugins ; then
|
|
169 |
append-ldflags -Wl,-rpath,/usr/$(get_libdir)/bash
|
|
170 |
else
|
|
171 |
# Disable the plugins logic by hand since bash doesn't
|
|
172 |
# provide a way of doing it.
|
|
173 |
export ac_cv_func_dl{close,open,sym}=no \
|
|
174 |
ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
|
|
175 |
|
|
176 |
sed -i \
|
|
177 |
-e '/LOCAL_LDFLAGS=/s:-rdynamic::' \
|
|
178 |
configure || die
|
|
179 |
fi
|
148 |
180 |
|
149 |
181 |
# bug #444070
|
150 |
182 |
tc-export AR
|
... | ... | |
152 |
184 |
econf "${myconf[@]}"
|
153 |
185 |
}
|
154 |
186 |
|
|
187 |
src_compile() {
|
|
188 |
emake
|
|
189 |
|
|
190 |
if use plugins ; then
|
|
191 |
emake -C examples/loadables all others
|
|
192 |
fi
|
|
193 |
}
|
|
194 |
|
155 |
195 |
src_install() {
|
156 |
196 |
into /
|
157 |
197 |
newbin bash bash-${SLOT}
|