3 |
3 |
|
4 |
4 |
EAPI=7
|
5 |
5 |
|
6 |
|
inherit flag-o-matic toolchain-funcs prefix
|
|
6 |
VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/chetramey.asc
|
|
7 |
inherit flag-o-matic toolchain-funcs prefix verify-sig
|
7 |
8 |
|
8 |
9 |
# Uncomment if we have a patchset
|
9 |
10 |
GENTOO_PATCH_DEV="sam"
|
10 |
11 |
GENTOO_PATCH_VER="${PV}"
|
11 |
12 |
|
12 |
13 |
# Official patchlevel
|
13 |
|
# See ftp://ftp.cwru.edu/pub/bash/bash-5.0-patches/
|
|
14 |
# See ftp://ftp.cwru.edu/pub/bash/bash-5.1-patches/
|
14 |
15 |
PLEVEL="${PV##*_p}"
|
15 |
16 |
MY_PV="${PV/_p*}"
|
16 |
17 |
MY_PV="${MY_PV/_/-}"
|
17 |
18 |
MY_P="${PN}-${MY_PV}"
|
|
19 |
MY_PATCHES=()
|
|
20 |
|
18 |
21 |
is_release() {
|
19 |
22 |
case ${PV} in
|
20 |
|
*_alpha*|*_beta*|*_rc*) return 1 ;;
|
21 |
|
*) return 0 ;;
|
|
23 |
*_alpha*|*_beta*|*_rc*)
|
|
24 |
return 1
|
|
25 |
;;
|
|
26 |
*)
|
|
27 |
return 0
|
|
28 |
;;
|
22 |
29 |
esac
|
23 |
30 |
}
|
|
31 |
|
24 |
32 |
[[ ${PV} != *_p* ]] && PLEVEL=0
|
25 |
|
patches() {
|
26 |
|
local opt=${1} plevel=${2:-${PLEVEL}} pn=${3:-${PN}} pv=${4:-${MY_PV}}
|
27 |
|
[[ ${plevel} -eq 0 ]] && return 1
|
28 |
|
eval set -- {1..${plevel}}
|
29 |
|
set -- $(printf "${pn}${pv/\.}-%03d " "$@")
|
30 |
|
if [[ ${opt} == -s ]] ; then
|
31 |
|
echo "${@/#/${DISTDIR}/}"
|
32 |
|
else
|
33 |
|
local u
|
34 |
|
for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${pn} ; do
|
35 |
|
printf "${u}/${pn}-${pv}-patches/%s " "$@"
|
36 |
|
done
|
37 |
|
fi
|
38 |
|
}
|
39 |
33 |
|
40 |
34 |
# The version of readline this bash normally ships with.
|
41 |
|
READLINE_VER="8.0"
|
|
35 |
READLINE_VER="8.1"
|
42 |
36 |
|
43 |
37 |
DESCRIPTION="The standard GNU Bourne again shell"
|
44 |
38 |
HOMEPAGE="https://tiswww.case.edu/php/chet/bash/bashtop.html"
|
|
39 |
|
45 |
40 |
if is_release ; then
|
46 |
|
SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
|
|
41 |
SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz"
|
|
42 |
SRC_URI+=" verify-sig? ( mirror://gnu/bash/${MY_P}.tar.gz.sig )"
|
|
43 |
|
|
44 |
if [[ ${PLEVEL} -gt 0 ]] ; then
|
|
45 |
# bash-5.1 -> bash51
|
|
46 |
my_p=${PN}$(ver_rs 1-2 '' $(ver_cut 1-2))
|
|
47 |
|
|
48 |
patch_url=
|
|
49 |
my_patch_index=
|
|
50 |
|
|
51 |
upstream_url_base="mirror://gnu/bash"
|
|
52 |
mirror_url_base="ftp://ftp.cwru.edu/pub/bash"
|
|
53 |
|
|
54 |
for ((my_patch_index=1; my_patch_index <= ${PLEVEL} ; my_patch_index++)) ; do
|
|
55 |
printf -v mangled_patch_ver ${my_p}-%03d ${my_patch_index}
|
|
56 |
patch_url="${upstream_url_base}/${MY_P}-patches/${mangled_patch_ver}"
|
|
57 |
|
|
58 |
SRC_URI+=" ${patch_url}"
|
|
59 |
SRC_URI+=" verify-sig? ( ${patch_url}.sig )"
|
|
60 |
|
|
61 |
# Add in the mirror URL too.
|
|
62 |
SRC_URI+=" ${patch_url/${upstream_url_base}/${mirror_url_base}}"
|
|
63 |
SRC_URI+=" verify-sig? ( ${patch_url/${upstream_url_base}/${mirror_url_base}} )"
|
|
64 |
|
|
65 |
MY_PATCHES+=( "${DISTDIR}"/${mangled_patch_ver} )
|
|
66 |
done
|
|
67 |
|
|
68 |
unset my_p patch_url my_patch_index upstream_url_base mirror_url_base
|
|
69 |
fi
|
47 |
70 |
else
|
48 |
71 |
SRC_URI="ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
|
|
72 |
SRC_URI+=" verify-sig? ( ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz.sig )"
|
49 |
73 |
fi
|
50 |
74 |
|
51 |
75 |
if [[ -n ${GENTOO_PATCH_VER} ]] ; then
|
... | ... | |
54 |
78 |
|
55 |
79 |
LICENSE="GPL-3"
|
56 |
80 |
SLOT="0"
|
57 |
|
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris"
|
|
81 |
[[ "${PV}" == *_rc* ]] || \
|
|
82 |
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
|
58 |
83 |
IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline"
|
59 |
84 |
|
60 |
85 |
DEPEND="
|
... | ... | |
65 |
90 |
RDEPEND="
|
66 |
91 |
${DEPEND}
|
67 |
92 |
"
|
68 |
|
# We only need bison (yacc) when the .y files get patched (bash42-005)
|
69 |
|
BDEPEND="sys-devel/bison"
|
|
93 |
# We only need bison (yacc) when the .y files get patched (bash42-005, bash51-011)
|
|
94 |
BDEPEND="sys-devel/bison
|
|
95 |
verify-sig? ( sec-keys/openpgp-keys-chetramey )"
|
70 |
96 |
|
71 |
97 |
S="${WORKDIR}/${MY_P}"
|
72 |
98 |
|
73 |
99 |
PATCHES=(
|
74 |
100 |
# Patches from Chet sent to bashbug ml
|
75 |
|
"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-5.0-history-append.patch
|
76 |
101 |
"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-5.0-syslog-history-extern.patch
|
77 |
102 |
)
|
78 |
103 |
|
... | ... | |
91 |
116 |
}
|
92 |
117 |
|
93 |
118 |
src_unpack() {
|
94 |
|
unpack ${MY_P}.tar.gz
|
|
119 |
if [[ ${PV} == 9999 ]] ; then
|
|
120 |
git-r3_src_unpack
|
|
121 |
else
|
|
122 |
if use verify-sig ; then
|
|
123 |
verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.gz{,.sig}
|
|
124 |
|
|
125 |
local patch
|
|
126 |
for patch in "${MY_PATCHES[@]}" ; do
|
|
127 |
verify-sig_verify_detached ${patch}{,.sig}
|
|
128 |
done
|
|
129 |
fi
|
95 |
130 |
|
96 |
|
if [[ -n ${GENTOO_PATCH_VER} ]] ; then
|
97 |
|
unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
|
|
131 |
unpack ${MY_P}.tar.gz
|
|
132 |
|
|
133 |
if [[ -n ${GENTOO_PATCH_VER} ]] ; then
|
|
134 |
unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
|
|
135 |
fi
|
98 |
136 |
fi
|
99 |
137 |
}
|
100 |
138 |
|
101 |
139 |
src_prepare() {
|
102 |
140 |
# Include official patches
|
103 |
|
[[ ${PLEVEL} -gt 0 ]] && eapply -p0 $(patches -s)
|
|
141 |
[[ ${PLEVEL} -gt 0 ]] && eapply -p0 "${MY_PATCHES[@]}"
|
104 |
142 |
|
105 |
143 |
# Clean out local libs so we know we use system ones w/releases.
|
106 |
144 |
if is_release ; then
|
... | ... | |
178 |
216 |
fi
|
179 |
217 |
|
180 |
218 |
if use plugins ; then
|
181 |
|
append-ldflags -Wl,-rpath,/usr/$(get_libdir)/bash
|
|
219 |
append-ldflags -Wl,-rpath,"${EPREFIX}"/usr/$(get_libdir)/bash
|
182 |
220 |
else
|
183 |
221 |
# Disable the plugins logic by hand since bash doesn't
|
184 |
222 |
# provide a way of doing it.
|
... | ... | |
264 |
302 |
done
|
265 |
303 |
fi
|
266 |
304 |
|
267 |
|
doman doc/*.1
|
|
305 |
# Install bash_builtins.1 and rbash.1
|
|
306 |
emake -C doc DESTDIR="${D}" install_builtins
|
|
307 |
sed 's:bash\.1:man1/&:' doc/rbash.1 > "${T}"/rbash.1 || die
|
|
308 |
doman "${T}"/rbash.1
|
|
309 |
|
268 |
310 |
newdoc CWRU/changelog ChangeLog
|
269 |
311 |
dosym bash.info /usr/share/info/bashref.info
|
270 |
312 |
}
|