mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-28 17:11:34 +02:00
app-shells/bash: Sync with Gentoo
It's from Gentoo commit 1d15b220376e9da1251127d71f78203f5da3f9d7.
This commit is contained in:
parent
1e31f1961f
commit
a278ec8163
@ -23,6 +23,8 @@ DIST bash-5.1.tar.gz.sig 95 BLAKE2B ac9209d6a4ab4436c511a7a195594e9036d7d1aef788
|
|||||||
DIST bash-5.1_p16-patches.tar.xz 388 BLAKE2B 1575d54d311872c7ca71e13711fa0f7e3534fca16fd9d1ca045b6c696c9ca56f6a0ed5023a05d847ab5ddbefc22b8ef2c2a681f09571520f0294d83b495f0015 SHA512 c85e5b83f6ee1a7345647fa937d9718cab13be1a65886755d26a78d21fea4246650c7441a34fd729212e220366985b410562002d74c02c18de7ef0469b409ac7
|
DIST bash-5.1_p16-patches.tar.xz 388 BLAKE2B 1575d54d311872c7ca71e13711fa0f7e3534fca16fd9d1ca045b6c696c9ca56f6a0ed5023a05d847ab5ddbefc22b8ef2c2a681f09571520f0294d83b495f0015 SHA512 c85e5b83f6ee1a7345647fa937d9718cab13be1a65886755d26a78d21fea4246650c7441a34fd729212e220366985b410562002d74c02c18de7ef0469b409ac7
|
||||||
DIST bash-5.2.tar.gz 10950833 BLAKE2B 51b196e710794ebad8eac28c31c93eb99ac1a7db30919a13271e39e1cb66a0672f242df75fc7d71627ea873dfbce53ec35c0c56a71c5167143070a7811343fd9 SHA512 5647636223ba336bf33e0c65e516d8ebcf6932de8b44f37bc468eedb87579c628ad44213f78534beb10f47aebb9c6fa670cb0bed3b4e7717e5faf7e9a1ef81ae
|
DIST bash-5.2.tar.gz 10950833 BLAKE2B 51b196e710794ebad8eac28c31c93eb99ac1a7db30919a13271e39e1cb66a0672f242df75fc7d71627ea873dfbce53ec35c0c56a71c5167143070a7811343fd9 SHA512 5647636223ba336bf33e0c65e516d8ebcf6932de8b44f37bc468eedb87579c628ad44213f78534beb10f47aebb9c6fa670cb0bed3b4e7717e5faf7e9a1ef81ae
|
||||||
DIST bash-5.2.tar.gz.sig 95 BLAKE2B 2991b7c46ef1cdca08062f419be47fca7551f4c5d9aad8a5c1da74974f5e7707d23914b4cecf9b6c9610471146b2c49b611bb62a5d974f1c37cceb77b719851c SHA512 a161664f124f906be32709f66702f8f780e6d52e558ea45e71ec60a959c9435ff68477ee65a0a9f6c0051d5592f5044fb3b410cf3cd3ae5a8a323789b01be258
|
DIST bash-5.2.tar.gz.sig 95 BLAKE2B 2991b7c46ef1cdca08062f419be47fca7551f4c5d9aad8a5c1da74974f5e7707d23914b4cecf9b6c9610471146b2c49b611bb62a5d974f1c37cceb77b719851c SHA512 a161664f124f906be32709f66702f8f780e6d52e558ea45e71ec60a959c9435ff68477ee65a0a9f6c0051d5592f5044fb3b410cf3cd3ae5a8a323789b01be258
|
||||||
|
DIST bash-5.3-alpha.tar.gz 11195025 BLAKE2B b3325f6927d7dde86aae165891317b972f0b9814e134676b3d7d3aea81ce4d4cad1a01f160e290352072153ad3568ee21701a35190ef5e6274b3c03fc95c8d42 SHA512 52354eb7cd71330192ec76fdda04bcacf758a312e89b45558db5f5345f19b0d8e54732049934958cf89786f5bd7c538d88859eb8d8d22dabfc9ec7305263d10e
|
||||||
|
DIST bash-5.3-alpha.tar.gz.sig 95 BLAKE2B 69c8b33fe2a40498662ef084967701cff1926086785a41d6f49a3c2e2b9908499226d3d970bdb6397a74d3ccc22acb3651261ad2a421799eb135c64a78af8589 SHA512 c9587da66457e2010b0852c6dbf5949821a543b7f1b616a4d016df3477913e2a655c57289e83adeeb31b8b8afca22313e3af76cf727b93932d33a889c1263c20
|
||||||
DIST bash205b-001 1132 BLAKE2B 0c5eef29777d54ef05957ea3d63b1556fb380bd20c238dc28993d822b37bc4e78ff4048ad069f6b8cd25da77ccdeb7aecd86c4349cb9d81e5e94c7001eeae5e6 SHA512 5ce4357468821b05e747201f3aa57225ad8f540c9e2c87051720490e039c30b478b9b662a68f14a0800fefe40184e4495e2645665200f9d75e9a115b2ac08071
|
DIST bash205b-001 1132 BLAKE2B 0c5eef29777d54ef05957ea3d63b1556fb380bd20c238dc28993d822b37bc4e78ff4048ad069f6b8cd25da77ccdeb7aecd86c4349cb9d81e5e94c7001eeae5e6 SHA512 5ce4357468821b05e747201f3aa57225ad8f540c9e2c87051720490e039c30b478b9b662a68f14a0800fefe40184e4495e2645665200f9d75e9a115b2ac08071
|
||||||
DIST bash205b-002 755 BLAKE2B 6a6ed5679d451f02f8104b345c1722d11718ce3b4043b581c17786d40d8da69a34786fb56d0c363dba277b8e9dd33f12f70c9cc73a9fc39ba4a8319406f0458d SHA512 46947b0229478d5c2cfeff68b8ebc00e4ef0c8b94e336ca12f72b4490ba3622c0240c01c17c1641c3b07adc2c64ec94d6d780365e8990768ec8888f3a9526883
|
DIST bash205b-002 755 BLAKE2B 6a6ed5679d451f02f8104b345c1722d11718ce3b4043b581c17786d40d8da69a34786fb56d0c363dba277b8e9dd33f12f70c9cc73a9fc39ba4a8319406f0458d SHA512 46947b0229478d5c2cfeff68b8ebc00e4ef0c8b94e336ca12f72b4490ba3622c0240c01c17c1641c3b07adc2c64ec94d6d780365e8990768ec8888f3a9526883
|
||||||
DIST bash205b-003 2356 BLAKE2B b7887d00d92fd298cd07a15e1c73b516dabd22ecd74c97091636dd97a0cd55024ed698e5cc924c4311d994dd326b1ad074bea35e7650cf9cf4e25c60d2713fa7 SHA512 74528ca5d165b812d299f1c69b47757bd677c0b22ce4217e155cd641708b02364a93c6709fb57b546b376b36da74429a61493921c7c199563da40ddcf1c1f399
|
DIST bash205b-003 2356 BLAKE2B b7887d00d92fd298cd07a15e1c73b516dabd22ecd74c97091636dd97a0cd55024ed698e5cc924c4311d994dd326b1ad074bea35e7650cf9cf4e25c60d2713fa7 SHA512 74528ca5d165b812d299f1c69b47757bd677c0b22ce4217e155cd641708b02364a93c6709fb57b546b376b36da74429a61493921c7c199563da40ddcf1c1f399
|
||||||
|
358
sdk_container/src/third_party/portage-stable/app-shells/bash/bash-5.1_p16-r13.ebuild
vendored
Normal file
358
sdk_container/src/third_party/portage-stable/app-shells/bash/bash-5.1_p16-r13.ebuild
vendored
Normal file
@ -0,0 +1,358 @@
|
|||||||
|
# Copyright 1999-2024 Gentoo Authors
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
EAPI=8
|
||||||
|
|
||||||
|
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/chetramey.asc
|
||||||
|
inherit flag-o-matic toolchain-funcs prefix verify-sig
|
||||||
|
|
||||||
|
# Uncomment if we have a patchset.
|
||||||
|
#GENTOO_PATCH_DEV="sam"
|
||||||
|
#GENTOO_PATCH_VER="${PV}"
|
||||||
|
|
||||||
|
MY_PV=${PV/_p*}
|
||||||
|
MY_PV=${MY_PV/_/-}
|
||||||
|
MY_P=${PN}-${MY_PV}
|
||||||
|
MY_PATCHES=()
|
||||||
|
|
||||||
|
# Determine the patchlevel. See ftp://ftp.gnu.org/gnu/bash/bash-5.1-patches/.
|
||||||
|
case ${PV} in
|
||||||
|
*_p*)
|
||||||
|
PLEVEL=${PV##*_p}
|
||||||
|
;;
|
||||||
|
9999|*_alpha*|*_beta*|*_rc*)
|
||||||
|
# Set a negative patchlevel to indicate that it's a pre-release.
|
||||||
|
PLEVEL=-1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
PLEVEL=0
|
||||||
|
esac
|
||||||
|
|
||||||
|
# The version of readline this bash normally ships with. Note that we only use
|
||||||
|
# the bundled copy of readline for pre-releases.
|
||||||
|
READLINE_VER="8.1"
|
||||||
|
|
||||||
|
DESCRIPTION="The standard GNU Bourne again shell"
|
||||||
|
HOMEPAGE="https://tiswww.case.edu/php/chet/bash/bashtop.html https://git.savannah.gnu.org/cgit/bash.git"
|
||||||
|
|
||||||
|
if [[ ${PV} == 9999 ]]; then
|
||||||
|
EGIT_REPO_URI="https://git.savannah.gnu.org/git/bash.git"
|
||||||
|
EGIT_BRANCH=devel
|
||||||
|
inherit git-r3
|
||||||
|
else
|
||||||
|
my_urls=( {'mirror://gnu/bash','ftp://ftp.cwru.edu/pub/bash'}/"${MY_P}.tar.gz" )
|
||||||
|
|
||||||
|
# bash-5.1 -> bash51
|
||||||
|
my_p=${PN}$(ver_cut 1-2) my_p=${my_p/.}
|
||||||
|
|
||||||
|
for (( my_patch_idx = 1; my_patch_idx <= PLEVEL; my_patch_idx++ )); do
|
||||||
|
printf -v my_patch_ver %s-%03d "${my_p}" "${my_patch_idx}"
|
||||||
|
my_urls+=( {'mirror://gnu/bash','ftp://ftp.cwru.edu/pub/bash'}/"${MY_P}-patches/${my_patch_ver}" )
|
||||||
|
MY_PATCHES+=( "${DISTDIR}/${my_patch_ver}" )
|
||||||
|
done
|
||||||
|
|
||||||
|
SRC_URI="${my_urls[*]} verify-sig? ( ${my_urls[*]/%/.sig} )"
|
||||||
|
|
||||||
|
unset -v my_urls my_p my_patch_idx my_patch_ver
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${GENTOO_PATCH_VER} ]]; then
|
||||||
|
SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV:?}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER:?}-patches.tar.xz"
|
||||||
|
fi
|
||||||
|
|
||||||
|
S=${WORKDIR}/${MY_P}
|
||||||
|
|
||||||
|
LICENSE="GPL-3+"
|
||||||
|
SLOT="0"
|
||||||
|
if (( PLEVEL >= 0 )); then
|
||||||
|
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"
|
||||||
|
fi
|
||||||
|
IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline"
|
||||||
|
|
||||||
|
DEPEND="
|
||||||
|
>=sys-libs/ncurses-5.2-r2:=
|
||||||
|
nls? ( virtual/libintl )
|
||||||
|
"
|
||||||
|
if (( PLEVEL >= 0 )); then
|
||||||
|
DEPEND+=" readline? ( >=sys-libs/readline-${READLINE_VER}:= )"
|
||||||
|
fi
|
||||||
|
RDEPEND="
|
||||||
|
${DEPEND}
|
||||||
|
"
|
||||||
|
# We only need bison (yacc) when the .y files get patched (bash42-005, bash51-011).
|
||||||
|
BDEPEND="
|
||||||
|
sys-devel/bison
|
||||||
|
verify-sig? ( sec-keys/openpgp-keys-chetramey )
|
||||||
|
"
|
||||||
|
|
||||||
|
# EAPI 8 tries to append it but it doesn't exist here.
|
||||||
|
QA_CONFIGURE_OPTIONS="--disable-static"
|
||||||
|
|
||||||
|
QA_CONFIG_IMPL_DECL_SKIP+=(
|
||||||
|
# this is fixed in autoconf 2.71, used in bash 5.2. The check fails
|
||||||
|
# regardless of GCC version. bug #916480
|
||||||
|
makedev
|
||||||
|
)
|
||||||
|
|
||||||
|
PATCHES=(
|
||||||
|
#"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}/
|
||||||
|
|
||||||
|
# Patches to or from Chet, posted to the bug-bash mailing list.
|
||||||
|
"${FILESDIR}/${PN}-5.0-syslog-history-extern.patch"
|
||||||
|
"${FILESDIR}/${PN}-5.1_p16-configure-clang16.patch"
|
||||||
|
)
|
||||||
|
|
||||||
|
pkg_setup() {
|
||||||
|
# bug #7332
|
||||||
|
if is-flag -malign-double; then
|
||||||
|
eerror "Detected bad CFLAGS '-malign-double'. Do not use this"
|
||||||
|
eerror "as it breaks LFS (struct stat64) on x86."
|
||||||
|
die "remove -malign-double from your CFLAGS mr ricer"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if use bashlogger; then
|
||||||
|
ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
|
||||||
|
ewarn "This will log ALL output you enter into the shell, you have been warned."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
src_unpack() {
|
||||||
|
local patch
|
||||||
|
|
||||||
|
if [[ ${PV} == 9999 ]]; then
|
||||||
|
git-r3_src_unpack
|
||||||
|
else
|
||||||
|
if use verify-sig; then
|
||||||
|
verify-sig_verify_detached "${DISTDIR}/${MY_P}.tar.gz"{,.sig}
|
||||||
|
|
||||||
|
for patch in "${MY_PATCHES[@]}"; do
|
||||||
|
verify-sig_verify_detached "${patch}"{,.sig}
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
unpack "${MY_P}.tar.gz"
|
||||||
|
|
||||||
|
if [[ ${GENTOO_PATCH_VER} ]]; then
|
||||||
|
unpack "${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
src_prepare() {
|
||||||
|
# Include official patches.
|
||||||
|
(( PLEVEL > 0 )) && eapply -p0 "${MY_PATCHES[@]}"
|
||||||
|
|
||||||
|
# Clean out local libs so we know we use system ones w/releases. The
|
||||||
|
# touch utility is invoked for the benefit of config.status.
|
||||||
|
if (( PLEVEL >= 0 )); then
|
||||||
|
rm -rf lib/{readline,termcap}/* \
|
||||||
|
&& touch lib/{readline,termcap}/Makefile.in \
|
||||||
|
&& sed -i -E 's:\$[{(](RL|HIST)_LIBSRC[)}]/[[:alpha:]_-]*\.h::g' Makefile.in \
|
||||||
|
|| die
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prefixify hardcoded path names. No-op for non-prefix.
|
||||||
|
hprefixify pathnames.h.in
|
||||||
|
|
||||||
|
# Avoid regenerating docs after patches, bug #407985.
|
||||||
|
sed -i -E '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in \
|
||||||
|
&& touch -r . doc/* \
|
||||||
|
|| die
|
||||||
|
|
||||||
|
eapply -p0 "${PATCHES[@]}"
|
||||||
|
eapply_user
|
||||||
|
}
|
||||||
|
|
||||||
|
src_configure() {
|
||||||
|
local -a myconf
|
||||||
|
|
||||||
|
# Upstream only test with Bison and require GNUisms like YYEOF and
|
||||||
|
# YYERRCODE. The former at least may be in POSIX soon:
|
||||||
|
# https://www.austingroupbugs.net/view.php?id=1269.
|
||||||
|
# configure warns on use of non-Bison but doesn't abort. The result
|
||||||
|
# may misbehave at runtime.
|
||||||
|
unset -v YACC
|
||||||
|
|
||||||
|
myconf=(
|
||||||
|
--disable-profiling
|
||||||
|
|
||||||
|
# Force linking with system curses ... the bundled termcap lib
|
||||||
|
# sucks bad compared to ncurses. For the most part, ncurses
|
||||||
|
# is here because readline needs it. But bash itself calls
|
||||||
|
# ncurses in one or two small places :(.
|
||||||
|
--with-curses
|
||||||
|
|
||||||
|
$(use_enable mem-scramble)
|
||||||
|
$(use_enable net net-redirections)
|
||||||
|
$(use_enable readline)
|
||||||
|
$(use_enable readline bang-history)
|
||||||
|
$(use_enable readline history)
|
||||||
|
$(use_with afs)
|
||||||
|
$(use_with mem-scramble bash-malloc)
|
||||||
|
)
|
||||||
|
|
||||||
|
# For descriptions of these, see config-top.h.
|
||||||
|
# bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
|
||||||
|
append-cppflags \
|
||||||
|
-DDEFAULT_PATH_VALUE=\'\""${EPREFIX}"/usr/local/sbin:"${EPREFIX}"/usr/local/bin:"${EPREFIX}"/usr/sbin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/bin\"\' \
|
||||||
|
-DSTANDARD_UTILS_PATH=\'\""${EPREFIX}"/bin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/usr/sbin\"\' \
|
||||||
|
-DSYS_BASHRC=\'\""${EPREFIX}"/etc/bash/bashrc\"\' \
|
||||||
|
-DSYS_BASH_LOGOUT=\'\""${EPREFIX}"/etc/bash/bash_logout\"\' \
|
||||||
|
-DNON_INTERACTIVE_LOGIN_SHELLS \
|
||||||
|
-DSSH_SOURCE_BASHRC \
|
||||||
|
$(use bashlogger && echo -DSYSLOG_HISTORY)
|
||||||
|
|
||||||
|
use nls || myconf+=( --disable-nls )
|
||||||
|
|
||||||
|
if (( PLEVEL >= 0 )); then
|
||||||
|
# Historically, we always used the builtin readline, but since
|
||||||
|
# our handling of SONAME upgrades has gotten much more stable
|
||||||
|
# in the PM (and the readline ebuild itself preserves the old
|
||||||
|
# libs during upgrades), linking against the system copy should
|
||||||
|
# be safe.
|
||||||
|
# Exact cached version here doesn't really matter as long as it
|
||||||
|
# is at least what's in the DEPEND up above.
|
||||||
|
export ac_cv_rl_version=${READLINE_VER%%_*}
|
||||||
|
|
||||||
|
# Use system readline only with released versions.
|
||||||
|
myconf+=( --with-installed-readline=. )
|
||||||
|
fi
|
||||||
|
|
||||||
|
if use plugins; then
|
||||||
|
append-ldflags "-Wl,-rpath,${EPREFIX}/usr/$(get_libdir)/bash"
|
||||||
|
else
|
||||||
|
# Disable the plugins logic by hand since bash doesn't provide
|
||||||
|
# a way of doing it.
|
||||||
|
export ac_cv_func_dl{close,open,sym}=no \
|
||||||
|
ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
|
||||||
|
|
||||||
|
sed -i -e '/LOCAL_LDFLAGS=/s:-rdynamic::' configure || die
|
||||||
|
fi
|
||||||
|
|
||||||
|
# bug #444070
|
||||||
|
tc-export AR
|
||||||
|
|
||||||
|
econf "${myconf[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
src_compile() {
|
||||||
|
emake
|
||||||
|
|
||||||
|
if use plugins; then
|
||||||
|
emake -C examples/loadables all others
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
src_install() {
|
||||||
|
local d f
|
||||||
|
|
||||||
|
default
|
||||||
|
|
||||||
|
my_prefixify() {
|
||||||
|
while read -r; do
|
||||||
|
if [[ $REPLY == *$1* ]]; then
|
||||||
|
REPLY=${REPLY/"/etc/"/"${EPREFIX}/etc/"}
|
||||||
|
fi
|
||||||
|
printf '%s\n' "${REPLY}" || ! break
|
||||||
|
done < "$2" || die
|
||||||
|
}
|
||||||
|
|
||||||
|
dodir /bin
|
||||||
|
mv -- "${ED}"/usr/bin/bash "${ED}"/bin/ || die
|
||||||
|
dosym bash /bin/rbash
|
||||||
|
|
||||||
|
insinto /etc/bash
|
||||||
|
doins "${FILESDIR}"/bash_logout
|
||||||
|
my_prefixify bashrc.d "${FILESDIR}"/bashrc-r1 | newins - bashrc
|
||||||
|
|
||||||
|
insinto /etc/bash/bashrc.d
|
||||||
|
my_prefixify DIR_COLORS "${FILESDIR}"/bashrc.d/10-gentoo-color.bash | newins - 10-gentoo-color.bash
|
||||||
|
doins "${FILESDIR}"/bashrc.d/10-gentoo-title.bash
|
||||||
|
if [[ ! ${EPREFIX} ]]; then
|
||||||
|
doins "${FILESDIR}"/bashrc.d/15-gentoo-bashrc-check.bash
|
||||||
|
fi
|
||||||
|
|
||||||
|
insinto /etc/skel
|
||||||
|
for f in bash{_logout,_profile,rc}; do
|
||||||
|
newins "${FILESDIR}/dot-${f}" ".${f}"
|
||||||
|
done
|
||||||
|
|
||||||
|
if use plugins; then
|
||||||
|
exeinto "/usr/$(get_libdir)/bash"
|
||||||
|
set -- examples/loadables/*.o
|
||||||
|
doexe "${@%.o}"
|
||||||
|
|
||||||
|
insinto /usr/include/bash-plugins
|
||||||
|
doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if use examples; then
|
||||||
|
for d in examples/{functions,misc,scripts,startup-files}; do
|
||||||
|
exeinto "/usr/share/doc/${PF}/${d}"
|
||||||
|
docinto "${d}"
|
||||||
|
for f in "${d}"/*; do
|
||||||
|
if [[ ${f##*/} != @(PERMISSION|*README) ]]; then
|
||||||
|
doexe "${f}"
|
||||||
|
else
|
||||||
|
dodoc "${f}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install bash_builtins.1 and rbash.1.
|
||||||
|
emake -C doc DESTDIR="${D}" install_builtins
|
||||||
|
sed 's:bash\.1:man1/&:' doc/rbash.1 > "${T}"/rbash.1 || die
|
||||||
|
doman "${T}"/rbash.1
|
||||||
|
|
||||||
|
newdoc CWRU/changelog ChangeLog
|
||||||
|
dosym bash.info /usr/share/info/bashref.info
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_preinst() {
|
||||||
|
if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]]; then
|
||||||
|
mkdir -p -- "${EROOT}"/etc/bash \
|
||||||
|
&& mv -f -- "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/ \
|
||||||
|
|| die
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_postinst() {
|
||||||
|
local old_ver
|
||||||
|
|
||||||
|
# If /bin/sh does not exist, provide it.
|
||||||
|
if [[ ! -e ${EROOT}/bin/sh ]]; then
|
||||||
|
ln -sf -- bash "${EROOT}"/bin/sh || die
|
||||||
|
fi
|
||||||
|
|
||||||
|
read -r old_ver <<<"${REPLACING_VERSIONS}"
|
||||||
|
if [[ ! $old_ver ]]; then
|
||||||
|
:
|
||||||
|
elif ver_test "$old_ver" -ge "5.2" && ver_test "$old_ver" -ge "5.2_p26-r6"; then
|
||||||
|
return
|
||||||
|
elif ver_test "$old_ver" -lt "5.2" && ver_test "$old_ver" -ge "5.1_p16-r13"; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -r; do ewarn "${REPLY}"; done <<'EOF'
|
||||||
|
Files situated under /etc/bash/bashrc.d must now have a suffix of .sh or .bash.
|
||||||
|
|
||||||
|
Gentoo now defaults to defining PROMPT_COMMAND as an array. Depending on the
|
||||||
|
characteristics of the operating environment, this array may contain a command
|
||||||
|
to set the terminal's window title. Those already choosing to customise the
|
||||||
|
PROMPT_COMMAND variable are now advised to append their commands like so:
|
||||||
|
|
||||||
|
PROMPT_COMMAND+=('custom command goes here')
|
||||||
|
|
||||||
|
Gentoo no longer defaults to having bash manipulate the window title in the case
|
||||||
|
that the terminal is controlled by sshd(8), unless screen or tmux are in use.
|
||||||
|
Those wanting to set the title unconditionally may adjust ~/.bashrc - or create
|
||||||
|
a custom /etc/bash/bashrc.d drop-in - to set PROMPT_COMMMAND like so:
|
||||||
|
|
||||||
|
PROMPT_COMMAND=(genfun_set_win_title)
|
||||||
|
|
||||||
|
Those who would prefer for bash never to interfere with the window title may
|
||||||
|
now opt out of the default title setting behaviour, either with the "unset -v
|
||||||
|
PROMPT_COMMAND" command or by re-defining PROMPT_COMMAND as desired.
|
||||||
|
EOF
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright 1999-2023 Gentoo Authors
|
# Copyright 1999-2024 Gentoo Authors
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
EAPI=7
|
EAPI=7
|
||||||
@ -60,7 +60,7 @@ if is_release ; then
|
|||||||
|
|
||||||
# Add in the mirror URL too.
|
# Add in the mirror URL too.
|
||||||
SRC_URI+=" ${patch_url/${upstream_url_base}/${mirror_url_base}}"
|
SRC_URI+=" ${patch_url/${upstream_url_base}/${mirror_url_base}}"
|
||||||
SRC_URI+=" verify-sig? ( ${patch_url/${upstream_url_base}/${mirror_url_base}} )"
|
SRC_URI+=" verify-sig? ( ${patch_url/${upstream_url_base}/${mirror_url_base}}.sig )"
|
||||||
|
|
||||||
MY_PATCHES+=( "${DISTDIR}"/${mangled_patch_ver} )
|
MY_PATCHES+=( "${DISTDIR}"/${mangled_patch_ver} )
|
||||||
done
|
done
|
||||||
@ -96,6 +96,12 @@ BDEPEND="sys-devel/bison
|
|||||||
|
|
||||||
S="${WORKDIR}/${MY_P}"
|
S="${WORKDIR}/${MY_P}"
|
||||||
|
|
||||||
|
QA_CONFIG_IMPL_DECL_SKIP+=(
|
||||||
|
# this is fixed in autoconf 2.71, used in bash 5.2. The check fails
|
||||||
|
# regardless of GCC version. bug #916480
|
||||||
|
makedev
|
||||||
|
)
|
||||||
|
|
||||||
PATCHES=(
|
PATCHES=(
|
||||||
# Patches from Chet sent to bashbug ml
|
# Patches from Chet sent to bashbug ml
|
||||||
"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-5.0-syslog-history-extern.patch
|
"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-5.0-syslog-history-extern.patch
|
||||||
|
@ -1,328 +0,0 @@
|
|||||||
# Copyright 1999-2023 Gentoo Authors
|
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
|
||||||
|
|
||||||
EAPI=7
|
|
||||||
|
|
||||||
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/chetramey.asc
|
|
||||||
inherit flag-o-matic toolchain-funcs prefix verify-sig
|
|
||||||
|
|
||||||
# Uncomment if we have a patchset
|
|
||||||
GENTOO_PATCH_DEV="sam"
|
|
||||||
GENTOO_PATCH_VER="${PV}"
|
|
||||||
|
|
||||||
# Official patchlevel
|
|
||||||
# See ftp://ftp.cwru.edu/pub/bash/bash-5.1-patches/
|
|
||||||
PLEVEL="${PV##*_p}"
|
|
||||||
MY_PV="${PV/_p*}"
|
|
||||||
MY_PV="${MY_PV/_/-}"
|
|
||||||
MY_P="${PN}-${MY_PV}"
|
|
||||||
MY_PATCHES=()
|
|
||||||
|
|
||||||
is_release() {
|
|
||||||
case ${PV} in
|
|
||||||
*_alpha*|*_beta*|*_rc*)
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
[[ ${PV} != *_p* ]] && PLEVEL=0
|
|
||||||
|
|
||||||
# The version of readline this bash normally ships with.
|
|
||||||
READLINE_VER="8.1"
|
|
||||||
|
|
||||||
DESCRIPTION="The standard GNU Bourne again shell"
|
|
||||||
HOMEPAGE="https://tiswww.case.edu/php/chet/bash/bashtop.html"
|
|
||||||
|
|
||||||
if is_release ; then
|
|
||||||
SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz"
|
|
||||||
SRC_URI+=" verify-sig? ( mirror://gnu/bash/${MY_P}.tar.gz.sig )"
|
|
||||||
|
|
||||||
if [[ ${PLEVEL} -gt 0 ]] ; then
|
|
||||||
# bash-5.1 -> bash51
|
|
||||||
my_p=${PN}$(ver_rs 1-2 '' $(ver_cut 1-2))
|
|
||||||
|
|
||||||
patch_url=
|
|
||||||
my_patch_index=
|
|
||||||
|
|
||||||
upstream_url_base="mirror://gnu/bash"
|
|
||||||
mirror_url_base="ftp://ftp.cwru.edu/pub/bash"
|
|
||||||
|
|
||||||
for ((my_patch_index=1; my_patch_index <= ${PLEVEL} ; my_patch_index++)) ; do
|
|
||||||
printf -v mangled_patch_ver ${my_p}-%03d ${my_patch_index}
|
|
||||||
patch_url="${upstream_url_base}/${MY_P}-patches/${mangled_patch_ver}"
|
|
||||||
|
|
||||||
SRC_URI+=" ${patch_url}"
|
|
||||||
SRC_URI+=" verify-sig? ( ${patch_url}.sig )"
|
|
||||||
|
|
||||||
# Add in the mirror URL too.
|
|
||||||
SRC_URI+=" ${patch_url/${upstream_url_base}/${mirror_url_base}}"
|
|
||||||
SRC_URI+=" verify-sig? ( ${patch_url/${upstream_url_base}/${mirror_url_base}} )"
|
|
||||||
|
|
||||||
MY_PATCHES+=( "${DISTDIR}"/${mangled_patch_ver} )
|
|
||||||
done
|
|
||||||
|
|
||||||
unset my_p patch_url my_patch_index upstream_url_base mirror_url_base
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
SRC_URI="ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
|
|
||||||
SRC_URI+=" verify-sig? ( ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz.sig )"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n ${GENTOO_PATCH_VER} ]] ; then
|
|
||||||
SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
|
|
||||||
fi
|
|
||||||
|
|
||||||
LICENSE="GPL-3"
|
|
||||||
SLOT="0"
|
|
||||||
[[ "${PV}" == *_rc* ]] || \
|
|
||||||
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"
|
|
||||||
IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline"
|
|
||||||
|
|
||||||
DEPEND="
|
|
||||||
>=sys-libs/ncurses-5.2-r2:0=
|
|
||||||
nls? ( virtual/libintl )
|
|
||||||
readline? ( >=sys-libs/readline-${READLINE_VER}:0= )
|
|
||||||
"
|
|
||||||
RDEPEND="
|
|
||||||
${DEPEND}
|
|
||||||
"
|
|
||||||
# We only need bison (yacc) when the .y files get patched (bash42-005, bash51-011)
|
|
||||||
BDEPEND="sys-devel/bison
|
|
||||||
verify-sig? ( sec-keys/openpgp-keys-chetramey )"
|
|
||||||
|
|
||||||
S="${WORKDIR}/${MY_P}"
|
|
||||||
|
|
||||||
PATCHES=(
|
|
||||||
# Patches from Chet sent to bashbug ml
|
|
||||||
"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-5.0-syslog-history-extern.patch
|
|
||||||
|
|
||||||
"${FILESDIR}"/${PN}-5.1_p16-configure-clang16.patch
|
|
||||||
)
|
|
||||||
|
|
||||||
pkg_setup() {
|
|
||||||
# bug #7332
|
|
||||||
if is-flag -malign-double ; then
|
|
||||||
eerror "Detected bad CFLAGS '-malign-double'. Do not use this"
|
|
||||||
eerror "as it breaks LFS (struct stat64) on x86."
|
|
||||||
die "remove -malign-double from your CFLAGS mr ricer"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if use bashlogger ; then
|
|
||||||
ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
|
|
||||||
ewarn "This will log ALL output you enter into the shell, you have been warned."
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
src_unpack() {
|
|
||||||
if [[ ${PV} == 9999 ]] ; then
|
|
||||||
git-r3_src_unpack
|
|
||||||
else
|
|
||||||
if use verify-sig ; then
|
|
||||||
verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.gz{,.sig}
|
|
||||||
|
|
||||||
local patch
|
|
||||||
for patch in "${MY_PATCHES[@]}" ; do
|
|
||||||
verify-sig_verify_detached ${patch}{,.sig}
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
unpack ${MY_P}.tar.gz
|
|
||||||
|
|
||||||
if [[ -n ${GENTOO_PATCH_VER} ]] ; then
|
|
||||||
unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
src_prepare() {
|
|
||||||
# Include official patches
|
|
||||||
[[ ${PLEVEL} -gt 0 ]] && eapply -p0 "${MY_PATCHES[@]}"
|
|
||||||
|
|
||||||
# Clean out local libs so we know we use system ones w/releases.
|
|
||||||
if is_release ; then
|
|
||||||
rm -rf lib/{readline,termcap}/* || die
|
|
||||||
touch lib/{readline,termcap}/Makefile.in || die # for config.status
|
|
||||||
sed -ri -e 's:\$[{(](RL|HIST)_LIBSRC[)}]/[[:alpha:]_-]*\.h::g' Makefile.in || die
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Prefixify hardcoded path names. No-op for non-prefix.
|
|
||||||
hprefixify pathnames.h.in
|
|
||||||
|
|
||||||
# Avoid regenerating docs after patches, bug #407985
|
|
||||||
sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
|
|
||||||
touch -r . doc/* || die
|
|
||||||
|
|
||||||
eapply -p0 "${PATCHES[@]}"
|
|
||||||
eapply_user
|
|
||||||
}
|
|
||||||
|
|
||||||
src_configure() {
|
|
||||||
# Upstream only test with Bison and require GNUisms like YYEOF and
|
|
||||||
# YYERRCODE. The former at least may be in POSIX soon:
|
|
||||||
# https://www.austingroupbugs.net/view.php?id=1269.
|
|
||||||
# configure warns on use of non-Bison but doesn't abort. The result
|
|
||||||
# may misbehave at runtime.
|
|
||||||
unset YACC
|
|
||||||
|
|
||||||
local myconf=(
|
|
||||||
--disable-profiling
|
|
||||||
|
|
||||||
# Force linking with system curses ... the bundled termcap lib
|
|
||||||
# sucks bad compared to ncurses. For the most part, ncurses
|
|
||||||
# is here because readline needs it. But bash itself calls
|
|
||||||
# ncurses in one or two small places :(.
|
|
||||||
--with-curses
|
|
||||||
|
|
||||||
$(use_enable mem-scramble)
|
|
||||||
$(use_enable net net-redirections)
|
|
||||||
$(use_enable readline)
|
|
||||||
$(use_enable readline bang-history)
|
|
||||||
$(use_enable readline history)
|
|
||||||
$(use_with afs)
|
|
||||||
$(use_with mem-scramble bash-malloc)
|
|
||||||
)
|
|
||||||
|
|
||||||
# For descriptions of these, see config-top.h
|
|
||||||
# bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
|
|
||||||
append-cppflags \
|
|
||||||
-DDEFAULT_PATH_VALUE=\'\""${EPREFIX}"/usr/local/sbin:"${EPREFIX}"/usr/local/bin:"${EPREFIX}"/usr/sbin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/bin\"\' \
|
|
||||||
-DSTANDARD_UTILS_PATH=\'\""${EPREFIX}"/bin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/usr/sbin\"\' \
|
|
||||||
-DSYS_BASHRC=\'\""${EPREFIX}"/etc/bash/bashrc\"\' \
|
|
||||||
-DSYS_BASH_LOGOUT=\'\""${EPREFIX}"/etc/bash/bash_logout\"\' \
|
|
||||||
-DNON_INTERACTIVE_LOGIN_SHELLS \
|
|
||||||
-DSSH_SOURCE_BASHRC \
|
|
||||||
$(use bashlogger && echo -DSYSLOG_HISTORY)
|
|
||||||
|
|
||||||
# Don't even think about building this statically without
|
|
||||||
# reading bug #7714 first. If you still build it statically,
|
|
||||||
# don't come crying to us with bugs ;).
|
|
||||||
#use static && export LDFLAGS="${LDFLAGS} -static"
|
|
||||||
use nls || myconf+=( --disable-nls )
|
|
||||||
|
|
||||||
# Historically, we always used the builtin readline, but since
|
|
||||||
# our handling of SONAME upgrades has gotten much more stable
|
|
||||||
# in the PM (and the readline ebuild itself preserves the old
|
|
||||||
# libs during upgrades), linking against the system copy should
|
|
||||||
# be safe.
|
|
||||||
# Exact cached version here doesn't really matter as long as it
|
|
||||||
# is at least what's in the DEPEND up above.
|
|
||||||
export ac_cv_rl_version=${READLINE_VER%%_*}
|
|
||||||
|
|
||||||
if is_release ; then
|
|
||||||
# Use system readline only with released versions.
|
|
||||||
myconf+=( --with-installed-readline=. )
|
|
||||||
fi
|
|
||||||
|
|
||||||
if use plugins ; then
|
|
||||||
append-ldflags -Wl,-rpath,"${EPREFIX}"/usr/$(get_libdir)/bash
|
|
||||||
else
|
|
||||||
# Disable the plugins logic by hand since bash doesn't
|
|
||||||
# provide a way of doing it.
|
|
||||||
export ac_cv_func_dl{close,open,sym}=no \
|
|
||||||
ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
|
|
||||||
|
|
||||||
sed -i \
|
|
||||||
-e '/LOCAL_LDFLAGS=/s:-rdynamic::' \
|
|
||||||
configure || die
|
|
||||||
fi
|
|
||||||
|
|
||||||
# bug #444070
|
|
||||||
tc-export AR
|
|
||||||
|
|
||||||
econf "${myconf[@]}"
|
|
||||||
}
|
|
||||||
|
|
||||||
src_compile() {
|
|
||||||
emake
|
|
||||||
|
|
||||||
if use plugins ; then
|
|
||||||
emake -C examples/loadables all others
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
src_install() {
|
|
||||||
local d f
|
|
||||||
|
|
||||||
default
|
|
||||||
|
|
||||||
dodir /bin
|
|
||||||
mv "${ED}"/usr/bin/bash "${ED}"/bin/ || die
|
|
||||||
dosym bash /bin/rbash
|
|
||||||
|
|
||||||
insinto /etc/bash
|
|
||||||
doins "${FILESDIR}"/bash_logout
|
|
||||||
doins "$(prefixify_ro "${FILESDIR}"/bashrc)"
|
|
||||||
|
|
||||||
keepdir /etc/bash/bashrc.d
|
|
||||||
|
|
||||||
insinto /etc/skel
|
|
||||||
for f in bash{_logout,_profile,rc} ; do
|
|
||||||
newins "${FILESDIR}"/dot-${f} .${f}
|
|
||||||
done
|
|
||||||
|
|
||||||
local sed_args=(
|
|
||||||
-e 's:#GNU#@::'
|
|
||||||
-e '/#@/d'
|
|
||||||
)
|
|
||||||
|
|
||||||
if ! use readline ; then
|
|
||||||
# bug #432338
|
|
||||||
sed_args+=(
|
|
||||||
-e '/^shopt -s histappend/s:^:#:'
|
|
||||||
-e 's:use_color=true:use_color=false:'
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
|
|
||||||
sed -i \
|
|
||||||
"${sed_args[@]}" \
|
|
||||||
"${ED}"/etc/skel/.bashrc \
|
|
||||||
"${ED}"/etc/bash/bashrc || die
|
|
||||||
|
|
||||||
if use plugins ; then
|
|
||||||
exeinto /usr/$(get_libdir)/bash
|
|
||||||
doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
|
|
||||||
|
|
||||||
insinto /usr/include/bash-plugins
|
|
||||||
doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if use examples ; then
|
|
||||||
for d in examples/{functions,misc,scripts,startup-files} ; do
|
|
||||||
exeinto /usr/share/doc/${PF}/${d}
|
|
||||||
docinto ${d}
|
|
||||||
for f in ${d}/* ; do
|
|
||||||
if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
|
|
||||||
doexe ${f}
|
|
||||||
else
|
|
||||||
dodoc ${f}
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install bash_builtins.1 and rbash.1
|
|
||||||
emake -C doc DESTDIR="${D}" install_builtins
|
|
||||||
sed 's:bash\.1:man1/&:' doc/rbash.1 > "${T}"/rbash.1 || die
|
|
||||||
doman "${T}"/rbash.1
|
|
||||||
|
|
||||||
newdoc CWRU/changelog ChangeLog
|
|
||||||
dosym bash.info /usr/share/info/bashref.info
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_preinst() {
|
|
||||||
if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then
|
|
||||||
mkdir -p "${EROOT}"/etc/bash
|
|
||||||
mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_postinst() {
|
|
||||||
# If /bin/sh does not exist, provide it
|
|
||||||
if [[ ! -e ${EROOT}/bin/sh ]] ; then
|
|
||||||
ln -sf bash "${EROOT}"/bin/sh
|
|
||||||
fi
|
|
||||||
}
|
|
@ -1,353 +0,0 @@
|
|||||||
# Copyright 1999-2023 Gentoo Authors
|
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
|
||||||
|
|
||||||
EAPI=7
|
|
||||||
|
|
||||||
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/chetramey.asc
|
|
||||||
inherit flag-o-matic toolchain-funcs prefix verify-sig
|
|
||||||
|
|
||||||
# Uncomment if we have a patchset
|
|
||||||
GENTOO_PATCH_DEV="sam"
|
|
||||||
GENTOO_PATCH_VER="${PV}"
|
|
||||||
|
|
||||||
# Official patchlevel
|
|
||||||
# See ftp://ftp.cwru.edu/pub/bash/bash-5.1-patches/
|
|
||||||
PLEVEL="${PV##*_p}"
|
|
||||||
MY_PV="${PV/_p*}"
|
|
||||||
MY_PV="${MY_PV/_/-}"
|
|
||||||
MY_P="${PN}-${MY_PV}"
|
|
||||||
MY_PATCHES=()
|
|
||||||
|
|
||||||
is_release() {
|
|
||||||
case ${PV} in
|
|
||||||
*_alpha*|*_beta*|*_rc*)
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
[[ ${PV} != *_p* ]] && PLEVEL=0
|
|
||||||
|
|
||||||
# The version of readline this bash normally ships with.
|
|
||||||
READLINE_VER="8.1"
|
|
||||||
|
|
||||||
DESCRIPTION="The standard GNU Bourne again shell"
|
|
||||||
HOMEPAGE="https://tiswww.case.edu/php/chet/bash/bashtop.html"
|
|
||||||
|
|
||||||
if is_release ; then
|
|
||||||
SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz"
|
|
||||||
SRC_URI+=" verify-sig? ( mirror://gnu/bash/${MY_P}.tar.gz.sig )"
|
|
||||||
|
|
||||||
if [[ ${PLEVEL} -gt 0 ]] ; then
|
|
||||||
# bash-5.1 -> bash51
|
|
||||||
my_p=${PN}$(ver_rs 1-2 '' $(ver_cut 1-2))
|
|
||||||
|
|
||||||
patch_url=
|
|
||||||
my_patch_index=
|
|
||||||
|
|
||||||
upstream_url_base="mirror://gnu/bash"
|
|
||||||
mirror_url_base="ftp://ftp.cwru.edu/pub/bash"
|
|
||||||
|
|
||||||
for ((my_patch_index=1; my_patch_index <= ${PLEVEL} ; my_patch_index++)) ; do
|
|
||||||
printf -v mangled_patch_ver ${my_p}-%03d ${my_patch_index}
|
|
||||||
patch_url="${upstream_url_base}/${MY_P}-patches/${mangled_patch_ver}"
|
|
||||||
|
|
||||||
SRC_URI+=" ${patch_url}"
|
|
||||||
SRC_URI+=" verify-sig? ( ${patch_url}.sig )"
|
|
||||||
|
|
||||||
# Add in the mirror URL too.
|
|
||||||
SRC_URI+=" ${patch_url/${upstream_url_base}/${mirror_url_base}}"
|
|
||||||
SRC_URI+=" verify-sig? ( ${patch_url/${upstream_url_base}/${mirror_url_base}} )"
|
|
||||||
|
|
||||||
MY_PATCHES+=( "${DISTDIR}"/${mangled_patch_ver} )
|
|
||||||
done
|
|
||||||
|
|
||||||
unset my_p patch_url my_patch_index upstream_url_base mirror_url_base
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
SRC_URI="ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
|
|
||||||
SRC_URI+=" verify-sig? ( ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz.sig )"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n ${GENTOO_PATCH_VER} ]] ; then
|
|
||||||
SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
|
|
||||||
fi
|
|
||||||
|
|
||||||
LICENSE="GPL-3"
|
|
||||||
SLOT="0"
|
|
||||||
[[ "${PV}" == *_rc* ]] || \
|
|
||||||
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"
|
|
||||||
IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline"
|
|
||||||
|
|
||||||
DEPEND="
|
|
||||||
>=sys-libs/ncurses-5.2-r2:0=
|
|
||||||
nls? ( virtual/libintl )
|
|
||||||
readline? ( >=sys-libs/readline-${READLINE_VER}:0= )
|
|
||||||
"
|
|
||||||
RDEPEND="
|
|
||||||
${DEPEND}
|
|
||||||
"
|
|
||||||
# We only need bison (yacc) when the .y files get patched (bash42-005, bash51-011)
|
|
||||||
BDEPEND="sys-devel/bison
|
|
||||||
verify-sig? ( sec-keys/openpgp-keys-chetramey )"
|
|
||||||
|
|
||||||
S="${WORKDIR}/${MY_P}"
|
|
||||||
|
|
||||||
PATCHES=(
|
|
||||||
# Patches from Chet sent to bashbug ml
|
|
||||||
"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-5.0-syslog-history-extern.patch
|
|
||||||
|
|
||||||
"${FILESDIR}"/${PN}-5.1_p16-configure-clang16.patch
|
|
||||||
)
|
|
||||||
|
|
||||||
pkg_setup() {
|
|
||||||
# bug #7332
|
|
||||||
if is-flag -malign-double ; then
|
|
||||||
eerror "Detected bad CFLAGS '-malign-double'. Do not use this"
|
|
||||||
eerror "as it breaks LFS (struct stat64) on x86."
|
|
||||||
die "remove -malign-double from your CFLAGS mr ricer"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if use bashlogger ; then
|
|
||||||
ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
|
|
||||||
ewarn "This will log ALL output you enter into the shell, you have been warned."
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
src_unpack() {
|
|
||||||
if [[ ${PV} == 9999 ]] ; then
|
|
||||||
git-r3_src_unpack
|
|
||||||
else
|
|
||||||
if use verify-sig ; then
|
|
||||||
verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.gz{,.sig}
|
|
||||||
|
|
||||||
local patch
|
|
||||||
for patch in "${MY_PATCHES[@]}" ; do
|
|
||||||
verify-sig_verify_detached ${patch}{,.sig}
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
unpack ${MY_P}.tar.gz
|
|
||||||
|
|
||||||
if [[ -n ${GENTOO_PATCH_VER} ]] ; then
|
|
||||||
unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
src_prepare() {
|
|
||||||
# Include official patches
|
|
||||||
[[ ${PLEVEL} -gt 0 ]] && eapply -p0 "${MY_PATCHES[@]}"
|
|
||||||
|
|
||||||
# Clean out local libs so we know we use system ones w/releases.
|
|
||||||
if is_release ; then
|
|
||||||
rm -rf lib/{readline,termcap}/* || die
|
|
||||||
touch lib/{readline,termcap}/Makefile.in || die # for config.status
|
|
||||||
sed -ri -e 's:\$[{(](RL|HIST)_LIBSRC[)}]/[[:alpha:]_-]*\.h::g' Makefile.in || die
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Prefixify hardcoded path names. No-op for non-prefix.
|
|
||||||
hprefixify pathnames.h.in
|
|
||||||
|
|
||||||
# Avoid regenerating docs after patches, bug #407985
|
|
||||||
sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
|
|
||||||
touch -r . doc/* || die
|
|
||||||
|
|
||||||
eapply -p0 "${PATCHES[@]}"
|
|
||||||
eapply_user
|
|
||||||
}
|
|
||||||
|
|
||||||
src_configure() {
|
|
||||||
# Upstream only test with Bison and require GNUisms like YYEOF and
|
|
||||||
# YYERRCODE. The former at least may be in POSIX soon:
|
|
||||||
# https://www.austingroupbugs.net/view.php?id=1269.
|
|
||||||
# configure warns on use of non-Bison but doesn't abort. The result
|
|
||||||
# may misbehave at runtime.
|
|
||||||
unset YACC
|
|
||||||
|
|
||||||
local myconf=(
|
|
||||||
--disable-profiling
|
|
||||||
|
|
||||||
# Force linking with system curses ... the bundled termcap lib
|
|
||||||
# sucks bad compared to ncurses. For the most part, ncurses
|
|
||||||
# is here because readline needs it. But bash itself calls
|
|
||||||
# ncurses in one or two small places :(.
|
|
||||||
--with-curses
|
|
||||||
|
|
||||||
$(use_enable mem-scramble)
|
|
||||||
$(use_enable net net-redirections)
|
|
||||||
$(use_enable readline)
|
|
||||||
$(use_enable readline bang-history)
|
|
||||||
$(use_enable readline history)
|
|
||||||
$(use_with afs)
|
|
||||||
$(use_with mem-scramble bash-malloc)
|
|
||||||
)
|
|
||||||
|
|
||||||
# For descriptions of these, see config-top.h
|
|
||||||
# bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
|
|
||||||
append-cppflags \
|
|
||||||
-DDEFAULT_PATH_VALUE=\'\""${EPREFIX}"/usr/local/sbin:"${EPREFIX}"/usr/local/bin:"${EPREFIX}"/usr/sbin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/bin\"\' \
|
|
||||||
-DSTANDARD_UTILS_PATH=\'\""${EPREFIX}"/bin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/usr/sbin\"\' \
|
|
||||||
-DSYS_BASHRC=\'\""${EPREFIX}"/etc/bash/bashrc\"\' \
|
|
||||||
-DSYS_BASH_LOGOUT=\'\""${EPREFIX}"/etc/bash/bash_logout\"\' \
|
|
||||||
-DNON_INTERACTIVE_LOGIN_SHELLS \
|
|
||||||
-DSSH_SOURCE_BASHRC \
|
|
||||||
$(use bashlogger && echo -DSYSLOG_HISTORY)
|
|
||||||
|
|
||||||
# Don't even think about building this statically without
|
|
||||||
# reading bug #7714 first. If you still build it statically,
|
|
||||||
# don't come crying to us with bugs ;).
|
|
||||||
#use static && export LDFLAGS="${LDFLAGS} -static"
|
|
||||||
use nls || myconf+=( --disable-nls )
|
|
||||||
|
|
||||||
# Historically, we always used the builtin readline, but since
|
|
||||||
# our handling of SONAME upgrades has gotten much more stable
|
|
||||||
# in the PM (and the readline ebuild itself preserves the old
|
|
||||||
# libs during upgrades), linking against the system copy should
|
|
||||||
# be safe.
|
|
||||||
# Exact cached version here doesn't really matter as long as it
|
|
||||||
# is at least what's in the DEPEND up above.
|
|
||||||
export ac_cv_rl_version=${READLINE_VER%%_*}
|
|
||||||
|
|
||||||
if is_release ; then
|
|
||||||
# Use system readline only with released versions.
|
|
||||||
myconf+=( --with-installed-readline=. )
|
|
||||||
fi
|
|
||||||
|
|
||||||
if use plugins ; then
|
|
||||||
append-ldflags -Wl,-rpath,"${EPREFIX}"/usr/$(get_libdir)/bash
|
|
||||||
else
|
|
||||||
# Disable the plugins logic by hand since bash doesn't
|
|
||||||
# provide a way of doing it.
|
|
||||||
export ac_cv_func_dl{close,open,sym}=no \
|
|
||||||
ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
|
|
||||||
|
|
||||||
sed -i \
|
|
||||||
-e '/LOCAL_LDFLAGS=/s:-rdynamic::' \
|
|
||||||
configure || die
|
|
||||||
fi
|
|
||||||
|
|
||||||
# bug #444070
|
|
||||||
tc-export AR
|
|
||||||
|
|
||||||
econf "${myconf[@]}"
|
|
||||||
}
|
|
||||||
|
|
||||||
src_compile() {
|
|
||||||
emake
|
|
||||||
|
|
||||||
if use plugins ; then
|
|
||||||
emake -C examples/loadables all others
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
src_install() {
|
|
||||||
local d f
|
|
||||||
|
|
||||||
default
|
|
||||||
|
|
||||||
dodir /bin
|
|
||||||
mv "${ED}"/usr/bin/bash "${ED}"/bin/ || die
|
|
||||||
dosym bash /bin/rbash
|
|
||||||
|
|
||||||
insinto /etc/bash
|
|
||||||
doins "${FILESDIR}"/bash_logout
|
|
||||||
newins "$(prefixify_ro "${FILESDIR}"/bashrc-r1)" bashrc
|
|
||||||
|
|
||||||
insinto /etc/bash/bashrc.d
|
|
||||||
doins "${FILESDIR}"/bashrc.d/*.bash
|
|
||||||
|
|
||||||
insinto /etc/skel
|
|
||||||
for f in bash{_logout,_profile,rc} ; do
|
|
||||||
newins "${FILESDIR}"/dot-${f} .${f}
|
|
||||||
done
|
|
||||||
|
|
||||||
local sed_args=(
|
|
||||||
-e 's:#GNU#@::'
|
|
||||||
-e '/#@/d'
|
|
||||||
)
|
|
||||||
|
|
||||||
if ! use readline ; then
|
|
||||||
# bug #432338
|
|
||||||
sed_args+=(
|
|
||||||
-e '/^shopt -s histappend/s:^:#:'
|
|
||||||
-e 's:use_color=true:use_color=false:'
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
|
|
||||||
sed -i \
|
|
||||||
"${sed_args[@]}" \
|
|
||||||
"${ED}"/etc/skel/.bashrc \
|
|
||||||
"${ED}"/etc/bash/bashrc || die
|
|
||||||
|
|
||||||
if use plugins ; then
|
|
||||||
exeinto /usr/$(get_libdir)/bash
|
|
||||||
doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
|
|
||||||
|
|
||||||
insinto /usr/include/bash-plugins
|
|
||||||
doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if use examples ; then
|
|
||||||
for d in examples/{functions,misc,scripts,startup-files} ; do
|
|
||||||
exeinto /usr/share/doc/${PF}/${d}
|
|
||||||
docinto ${d}
|
|
||||||
for f in ${d}/* ; do
|
|
||||||
if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
|
|
||||||
doexe ${f}
|
|
||||||
else
|
|
||||||
dodoc ${f}
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install bash_builtins.1 and rbash.1
|
|
||||||
emake -C doc DESTDIR="${D}" install_builtins
|
|
||||||
sed 's:bash\.1:man1/&:' doc/rbash.1 > "${T}"/rbash.1 || die
|
|
||||||
doman "${T}"/rbash.1
|
|
||||||
|
|
||||||
newdoc CWRU/changelog ChangeLog
|
|
||||||
dosym bash.info /usr/share/info/bashref.info
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_preinst() {
|
|
||||||
if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then
|
|
||||||
mkdir -p "${EROOT}"/etc/bash
|
|
||||||
mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_postinst() {
|
|
||||||
local old_ver
|
|
||||||
|
|
||||||
# If /bin/sh does not exist, provide it
|
|
||||||
if [[ ! -e ${EROOT}/bin/sh ]] ; then
|
|
||||||
ln -sf bash "${EROOT}"/bin/sh
|
|
||||||
fi
|
|
||||||
|
|
||||||
read -r old_ver <<<"${REPLACING_VERSIONS}"
|
|
||||||
if [[ ! $old_ver ]] ; then
|
|
||||||
:
|
|
||||||
elif ver_test "$old_ver" -ge "5.2" && ver_test "$old_ver" -ge "5.2_p26-r1" ; then
|
|
||||||
return
|
|
||||||
elif ver_test "$old_ver" -lt "5.2" && ver_test "$old_ver" -ge "5.1_p16-r8" ; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
einfo "Files situated under /etc/bash/bashrc.d must now have a suffix of .sh or .bash."
|
|
||||||
einfo ""
|
|
||||||
einfo "Gentoo now defaults to defining PROMPT_COMMAND as an array. Depending on the"
|
|
||||||
einfo "characteristics of the operating environment, this array may contain commands"
|
|
||||||
einfo "to set the window and pane title. Users that choose to customise this variable"
|
|
||||||
einfo "in ~/.bashrc are advised to append their commands, using the following syntax."
|
|
||||||
einfo ""
|
|
||||||
einfo "PROMPT_COMMAND+=('custom command goes here')"
|
|
||||||
einfo ""
|
|
||||||
einfo "Alternatively, users that wish to opt out of Gentoo's window title setting"
|
|
||||||
einfo "behaviour may now do so by either unsetting PROMPT_COMMAND or by re-defining it"
|
|
||||||
einfo "as desired. Previously, there was no formally supported method of opting out."
|
|
||||||
}
|
|
@ -1,400 +0,0 @@
|
|||||||
# Copyright 1999-2024 Gentoo Authors
|
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
|
||||||
|
|
||||||
EAPI=8
|
|
||||||
|
|
||||||
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/chetramey.asc
|
|
||||||
inherit flag-o-matic toolchain-funcs prefix verify-sig
|
|
||||||
|
|
||||||
# Uncomment if we have a patchset
|
|
||||||
#GENTOO_PATCH_DEV="sam"
|
|
||||||
#GENTOO_PATCH_VER="${PV}"
|
|
||||||
|
|
||||||
# Official patchlevel
|
|
||||||
# See ftp://ftp.cwru.edu/pub/bash/bash-5.1-patches/
|
|
||||||
PLEVEL="${PV##*_p}"
|
|
||||||
MY_PV="${PV/_p*}"
|
|
||||||
MY_PV="${MY_PV/_/-}"
|
|
||||||
MY_P="${PN}-${MY_PV}"
|
|
||||||
MY_PATCHES=()
|
|
||||||
|
|
||||||
is_release() {
|
|
||||||
case ${PV} in
|
|
||||||
9999|*_alpha*|*_beta*|*_rc*)
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
[[ ${PV} != *_p* ]] && PLEVEL=0
|
|
||||||
|
|
||||||
# The version of readline this bash normally ships with.
|
|
||||||
# Note: right now, we don't use the system copy of readline for bash for non-releases.
|
|
||||||
READLINE_VER="8.2_p1"
|
|
||||||
|
|
||||||
DESCRIPTION="The standard GNU Bourne again shell"
|
|
||||||
HOMEPAGE="https://tiswww.case.edu/php/chet/bash/bashtop.html https://git.savannah.gnu.org/cgit/bash.git"
|
|
||||||
|
|
||||||
if [[ ${PV} == 9999 ]] ; then
|
|
||||||
EGIT_REPO_URI="https://git.savannah.gnu.org/git/bash.git"
|
|
||||||
EGIT_BRANCH=devel
|
|
||||||
inherit git-r3
|
|
||||||
elif is_release ; then
|
|
||||||
SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz"
|
|
||||||
SRC_URI+=" verify-sig? ( mirror://gnu/bash/${MY_P}.tar.gz.sig )"
|
|
||||||
|
|
||||||
if [[ ${PLEVEL} -gt 0 ]] ; then
|
|
||||||
# bash-5.1 -> bash51
|
|
||||||
my_p=${PN}$(ver_rs 1-2 '' $(ver_cut 1-2))
|
|
||||||
|
|
||||||
patch_url=
|
|
||||||
my_patch_index=
|
|
||||||
|
|
||||||
upstream_url_base="mirror://gnu/bash"
|
|
||||||
mirror_url_base="ftp://ftp.cwru.edu/pub/bash"
|
|
||||||
|
|
||||||
for ((my_patch_index=1; my_patch_index <= ${PLEVEL} ; my_patch_index++)) ; do
|
|
||||||
printf -v mangled_patch_ver ${my_p}-%03d ${my_patch_index}
|
|
||||||
patch_url="${upstream_url_base}/${MY_P}-patches/${mangled_patch_ver}"
|
|
||||||
|
|
||||||
SRC_URI+=" ${patch_url}"
|
|
||||||
SRC_URI+=" verify-sig? ( ${patch_url}.sig )"
|
|
||||||
|
|
||||||
# Add in the mirror URL too.
|
|
||||||
SRC_URI+=" ${patch_url/${upstream_url_base}/${mirror_url_base}}"
|
|
||||||
SRC_URI+=" verify-sig? ( ${patch_url/${upstream_url_base}/${mirror_url_base}} )"
|
|
||||||
|
|
||||||
MY_PATCHES+=( "${DISTDIR}"/${mangled_patch_ver} )
|
|
||||||
done
|
|
||||||
|
|
||||||
unset my_p patch_url my_patch_index upstream_url_base mirror_url_base
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
|
|
||||||
SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${MY_P}.tar.gz.sig ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz.sig )"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n ${GENTOO_PATCH_VER} ]] ; then
|
|
||||||
SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
|
|
||||||
fi
|
|
||||||
|
|
||||||
LICENSE="GPL-3+"
|
|
||||||
SLOT="0"
|
|
||||||
if is_release ; then
|
|
||||||
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"
|
|
||||||
fi
|
|
||||||
IUSE="afs bashlogger examples mem-scramble +net nls plugins pgo +readline"
|
|
||||||
|
|
||||||
DEPEND="
|
|
||||||
>=sys-libs/ncurses-5.2-r2:=
|
|
||||||
nls? ( virtual/libintl )
|
|
||||||
"
|
|
||||||
if is_release ; then
|
|
||||||
DEPEND+=" readline? ( >=sys-libs/readline-${READLINE_VER}:= )"
|
|
||||||
fi
|
|
||||||
RDEPEND="
|
|
||||||
${DEPEND}
|
|
||||||
"
|
|
||||||
# We only need bison (yacc) when the .y files get patched (bash42-005, bash51-011)
|
|
||||||
BDEPEND="
|
|
||||||
pgo? ( dev-util/gperf )
|
|
||||||
verify-sig? ( sec-keys/openpgp-keys-chetramey )
|
|
||||||
"
|
|
||||||
|
|
||||||
S="${WORKDIR}/${MY_P}"
|
|
||||||
|
|
||||||
# EAPI 8 tries to append it but it doesn't exist here
|
|
||||||
QA_CONFIGURE_OPTIONS="--disable-static"
|
|
||||||
|
|
||||||
PATCHES=(
|
|
||||||
#"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}/
|
|
||||||
|
|
||||||
# Patches from Chet sent to bash-bug ml
|
|
||||||
"${FILESDIR}"/${PN}-5.0-syslog-history-extern.patch
|
|
||||||
"${FILESDIR}"/${PN}-5.2_p15-random-ub.patch
|
|
||||||
"${FILESDIR}"/${PN}-5.2_p15-configure-clang16.patch
|
|
||||||
"${FILESDIR}"/${PN}-5.2_p21-wpointer-to-int.patch
|
|
||||||
"${FILESDIR}"/${PN}-5.2_p21-configure-strtold.patch
|
|
||||||
"${FILESDIR}"/${PN}-5.2_p26-memory-leaks.patch
|
|
||||||
)
|
|
||||||
|
|
||||||
pkg_setup() {
|
|
||||||
# bug #7332
|
|
||||||
if is-flag -malign-double ; then
|
|
||||||
eerror "Detected bad CFLAGS '-malign-double'. Do not use this"
|
|
||||||
eerror "as it breaks LFS (struct stat64) on x86."
|
|
||||||
die "remove -malign-double from your CFLAGS mr ricer"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if use bashlogger ; then
|
|
||||||
ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
|
|
||||||
ewarn "This will log ALL output you enter into the shell, you have been warned."
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
src_unpack() {
|
|
||||||
if [[ ${PV} == 9999 ]] ; then
|
|
||||||
git-r3_src_unpack
|
|
||||||
else
|
|
||||||
if use verify-sig ; then
|
|
||||||
verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.gz{,.sig}
|
|
||||||
|
|
||||||
local patch
|
|
||||||
for patch in "${MY_PATCHES[@]}" ; do
|
|
||||||
verify-sig_verify_detached ${patch}{,.sig}
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
unpack ${MY_P}.tar.gz
|
|
||||||
|
|
||||||
if [[ -n ${GENTOO_PATCH_VER} ]] ; then
|
|
||||||
unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
src_prepare() {
|
|
||||||
# Include official patches
|
|
||||||
[[ ${PLEVEL} -gt 0 ]] && eapply -p0 "${MY_PATCHES[@]}"
|
|
||||||
|
|
||||||
# Clean out local libs so we know we use system ones w/releases.
|
|
||||||
if is_release ; then
|
|
||||||
rm -rf lib/{readline,termcap}/* || die
|
|
||||||
touch lib/{readline,termcap}/Makefile.in || die # for config.status
|
|
||||||
sed -ri -e 's:\$[{(](RL|HIST)_LIBSRC[)}]/[[:alpha:]_-]*\.h::g' Makefile.in || die
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Prefixify hardcoded path names. No-op for non-prefix.
|
|
||||||
hprefixify pathnames.h.in
|
|
||||||
|
|
||||||
# Avoid regenerating docs after patches, bug #407985
|
|
||||||
sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
|
|
||||||
touch -r . doc/* || die
|
|
||||||
|
|
||||||
# Sometimes hangs (more noticeable w/ pgo), bug #907403.
|
|
||||||
rm tests/run-jobs || die
|
|
||||||
|
|
||||||
eapply -p0 "${PATCHES[@]}"
|
|
||||||
eapply_user
|
|
||||||
}
|
|
||||||
|
|
||||||
src_configure() {
|
|
||||||
# Upstream only test with Bison and require GNUisms like YYEOF and
|
|
||||||
# YYERRCODE. The former at least may be in POSIX soon:
|
|
||||||
# https://www.austingroupbugs.net/view.php?id=1269.
|
|
||||||
# configure warns on use of non-Bison but doesn't abort. The result
|
|
||||||
# may misbehave at runtime.
|
|
||||||
unset YACC
|
|
||||||
|
|
||||||
local myconf=(
|
|
||||||
--disable-profiling
|
|
||||||
|
|
||||||
# Force linking with system curses ... the bundled termcap lib
|
|
||||||
# sucks bad compared to ncurses. For the most part, ncurses
|
|
||||||
# is here because readline needs it. But bash itself calls
|
|
||||||
# ncurses in one or two small places :(.
|
|
||||||
--with-curses
|
|
||||||
|
|
||||||
$(use_enable mem-scramble)
|
|
||||||
$(use_enable net net-redirections)
|
|
||||||
$(use_enable readline)
|
|
||||||
$(use_enable readline bang-history)
|
|
||||||
$(use_enable readline history)
|
|
||||||
$(use_with afs)
|
|
||||||
$(use_with mem-scramble bash-malloc)
|
|
||||||
)
|
|
||||||
|
|
||||||
# For descriptions of these, see config-top.h
|
|
||||||
# bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
|
|
||||||
append-cppflags \
|
|
||||||
-DDEFAULT_PATH_VALUE=\'\""${EPREFIX}"/usr/local/sbin:"${EPREFIX}"/usr/local/bin:"${EPREFIX}"/usr/sbin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/bin\"\' \
|
|
||||||
-DSTANDARD_UTILS_PATH=\'\""${EPREFIX}"/bin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/usr/sbin\"\' \
|
|
||||||
-DSYS_BASHRC=\'\""${EPREFIX}"/etc/bash/bashrc\"\' \
|
|
||||||
-DSYS_BASH_LOGOUT=\'\""${EPREFIX}"/etc/bash/bash_logout\"\' \
|
|
||||||
-DNON_INTERACTIVE_LOGIN_SHELLS \
|
|
||||||
-DSSH_SOURCE_BASHRC \
|
|
||||||
$(use bashlogger && echo -DSYSLOG_HISTORY)
|
|
||||||
|
|
||||||
# Don't even think about building this statically without
|
|
||||||
# reading bug #7714 first. If you still build it statically,
|
|
||||||
# don't come crying to us with bugs ;).
|
|
||||||
#use static && export LDFLAGS="${LDFLAGS} -static"
|
|
||||||
use nls || myconf+=( --disable-nls )
|
|
||||||
|
|
||||||
if is_release ; then
|
|
||||||
# Historically, we always used the builtin readline, but since
|
|
||||||
# our handling of SONAME upgrades has gotten much more stable
|
|
||||||
# in the PM (and the readline ebuild itself preserves the old
|
|
||||||
# libs during upgrades), linking against the system copy should
|
|
||||||
# be safe.
|
|
||||||
# Exact cached version here doesn't really matter as long as it
|
|
||||||
# is at least what's in the DEPEND up above.
|
|
||||||
export ac_cv_rl_version=${READLINE_VER%%_*}
|
|
||||||
|
|
||||||
# Use system readline only with released versions.
|
|
||||||
myconf+=( --with-installed-readline=. )
|
|
||||||
fi
|
|
||||||
|
|
||||||
if use plugins ; then
|
|
||||||
append-ldflags -Wl,-rpath,"${EPREFIX}"/usr/$(get_libdir)/bash
|
|
||||||
else
|
|
||||||
# Disable the plugins logic by hand since bash doesn't
|
|
||||||
# provide a way of doing it.
|
|
||||||
export ac_cv_func_dl{close,open,sym}=no \
|
|
||||||
ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
|
|
||||||
|
|
||||||
sed -i \
|
|
||||||
-e '/LOCAL_LDFLAGS=/s:-rdynamic::' \
|
|
||||||
configure || die
|
|
||||||
fi
|
|
||||||
|
|
||||||
# bug #444070
|
|
||||||
tc-export AR
|
|
||||||
|
|
||||||
econf "${myconf[@]}"
|
|
||||||
}
|
|
||||||
|
|
||||||
src_compile() {
|
|
||||||
# -fprofile-partial-training because upstream note the test suite isn't super comprehensive
|
|
||||||
# See https://documentation.suse.com/sbp/all/html/SBP-GCC-10/index.html#sec-gcc10-pgo
|
|
||||||
local pgo_generate_flags=$(usev pgo "-fprofile-update=atomic -fprofile-dir=${T}/pgo -fprofile-generate=${T}/pgo $(test-flags-CC -fprofile-partial-training)")
|
|
||||||
local pgo_use_flags=$(usev pgo "-fprofile-use=${T}/pgo -fprofile-dir=${T}/pgo $(test-flags-CC -fprofile-partial-training)")
|
|
||||||
|
|
||||||
emake CFLAGS="${CFLAGS} ${pgo_generate_flags}"
|
|
||||||
use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} ${pgo_generate_flags}" all others
|
|
||||||
|
|
||||||
# Build Bash and run its tests to generate profiles.
|
|
||||||
if use pgo ; then
|
|
||||||
# Used in test suite.
|
|
||||||
unset A
|
|
||||||
|
|
||||||
emake CFLAGS="${CFLAGS} ${pgo_generate_flags}" -k check
|
|
||||||
|
|
||||||
if tc-is-clang; then
|
|
||||||
llvm-profdata merge "${T}"/pgo --output="${T}"/pgo/default.profdata || die
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Rebuild Bash using the profiling data we just generated.
|
|
||||||
emake clean
|
|
||||||
emake CFLAGS="${CFLAGS} ${pgo_use_flags}"
|
|
||||||
use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} ${pgo_use_flags}" all others
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
src_test() {
|
|
||||||
# Used in test suite.
|
|
||||||
unset A
|
|
||||||
|
|
||||||
default
|
|
||||||
}
|
|
||||||
|
|
||||||
src_install() {
|
|
||||||
local d f
|
|
||||||
|
|
||||||
default
|
|
||||||
|
|
||||||
dodir /bin
|
|
||||||
mv "${ED}"/usr/bin/bash "${ED}"/bin/ || die
|
|
||||||
dosym bash /bin/rbash
|
|
||||||
|
|
||||||
insinto /etc/bash
|
|
||||||
doins "${FILESDIR}"/bash_logout
|
|
||||||
newins "$(prefixify_ro "${FILESDIR}"/bashrc-r1)" bashrc
|
|
||||||
|
|
||||||
insinto /etc/bash/bashrc.d
|
|
||||||
doins "${FILESDIR}"/bashrc.d/*.bash
|
|
||||||
|
|
||||||
insinto /etc/skel
|
|
||||||
for f in bash{_logout,_profile,rc} ; do
|
|
||||||
newins "${FILESDIR}"/dot-${f} .${f}
|
|
||||||
done
|
|
||||||
|
|
||||||
local sed_args=(
|
|
||||||
-e 's:#GNU#@::'
|
|
||||||
-e '/#@/d'
|
|
||||||
)
|
|
||||||
|
|
||||||
if ! use readline ; then
|
|
||||||
# bug #432338
|
|
||||||
sed_args+=(
|
|
||||||
-e '/^shopt -s histappend/s:^:#:'
|
|
||||||
-e 's:use_color=true:use_color=false:'
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
|
|
||||||
sed -i \
|
|
||||||
"${sed_args[@]}" \
|
|
||||||
"${ED}"/etc/skel/.bashrc \
|
|
||||||
"${ED}"/etc/bash/bashrc || die
|
|
||||||
|
|
||||||
if use plugins ; then
|
|
||||||
exeinto /usr/$(get_libdir)/bash
|
|
||||||
doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
|
|
||||||
|
|
||||||
insinto /usr/include/bash-plugins
|
|
||||||
doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if use examples ; then
|
|
||||||
for d in examples/{functions,misc,scripts,startup-files} ; do
|
|
||||||
exeinto /usr/share/doc/${PF}/${d}
|
|
||||||
docinto ${d}
|
|
||||||
for f in ${d}/* ; do
|
|
||||||
if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
|
|
||||||
doexe ${f}
|
|
||||||
else
|
|
||||||
dodoc ${f}
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install bash_builtins.1 and rbash.1
|
|
||||||
emake -C doc DESTDIR="${D}" install_builtins
|
|
||||||
sed 's:bash\.1:man1/&:' doc/rbash.1 > "${T}"/rbash.1 || die
|
|
||||||
doman "${T}"/rbash.1
|
|
||||||
|
|
||||||
newdoc CWRU/changelog ChangeLog
|
|
||||||
dosym bash.info /usr/share/info/bashref.info
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_preinst() {
|
|
||||||
if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then
|
|
||||||
mkdir -p "${EROOT}"/etc/bash
|
|
||||||
mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_postinst() {
|
|
||||||
local old_ver
|
|
||||||
|
|
||||||
# If /bin/sh does not exist, provide it
|
|
||||||
if [[ ! -e ${EROOT}/bin/sh ]] ; then
|
|
||||||
ln -sf bash "${EROOT}"/bin/sh
|
|
||||||
fi
|
|
||||||
|
|
||||||
read -r old_ver <<<"${REPLACING_VERSIONS}"
|
|
||||||
if [[ ! $old_ver ]] ; then
|
|
||||||
:
|
|
||||||
elif ver_test "$old_ver" -ge "5.2" && ver_test "$old_ver" -ge "5.2_p26-r1" ; then
|
|
||||||
return
|
|
||||||
elif ver_test "$old_ver" -lt "5.2" && ver_test "$old_ver" -ge "5.1_p16-r8" ; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
einfo "Files situated under /etc/bash/bashrc.d must now have a suffix of .sh or .bash."
|
|
||||||
einfo ""
|
|
||||||
einfo "Gentoo now defaults to defining PROMPT_COMMAND as an array. Depending on the"
|
|
||||||
einfo "characteristics of the operating environment, this array may contain commands"
|
|
||||||
einfo "to set the window and pane title. Users that choose to customise this variable"
|
|
||||||
einfo "in ~/.bashrc are advised to append their commands, using the following syntax."
|
|
||||||
einfo ""
|
|
||||||
einfo "PROMPT_COMMAND+=('custom command goes here')"
|
|
||||||
einfo ""
|
|
||||||
einfo "Alternatively, users that wish to opt out of Gentoo's window title setting"
|
|
||||||
einfo "behaviour may now do so by either unsetting PROMPT_COMMAND or by re-defining it"
|
|
||||||
einfo "as desired. Previously, there was no formally supported method of opting out."
|
|
||||||
}
|
|
402
sdk_container/src/third_party/portage-stable/app-shells/bash/bash-5.2_p26-r6.ebuild
vendored
Normal file
402
sdk_container/src/third_party/portage-stable/app-shells/bash/bash-5.2_p26-r6.ebuild
vendored
Normal file
@ -0,0 +1,402 @@
|
|||||||
|
# Copyright 1999-2024 Gentoo Authors
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
EAPI=8
|
||||||
|
|
||||||
|
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/chetramey.asc
|
||||||
|
inherit flag-o-matic toolchain-funcs prefix verify-sig
|
||||||
|
|
||||||
|
# Uncomment if we have a patchset.
|
||||||
|
#GENTOO_PATCH_DEV="sam"
|
||||||
|
#GENTOO_PATCH_VER="${PV}"
|
||||||
|
|
||||||
|
MY_PV=${PV/_p*}
|
||||||
|
MY_PV=${MY_PV/_/-}
|
||||||
|
MY_P=${PN}-${MY_PV}
|
||||||
|
MY_PATCHES=()
|
||||||
|
|
||||||
|
# Determine the patchlevel. See ftp://ftp.gnu.org/gnu/bash/bash-5.2-patches/.
|
||||||
|
case ${PV} in
|
||||||
|
*_p*)
|
||||||
|
PLEVEL=${PV##*_p}
|
||||||
|
;;
|
||||||
|
9999|*_alpha*|*_beta*|*_rc*)
|
||||||
|
# Set a negative patchlevel to indicate that it's a pre-release.
|
||||||
|
PLEVEL=-1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
PLEVEL=0
|
||||||
|
esac
|
||||||
|
|
||||||
|
# The version of readline this bash normally ships with. Note that we only use
|
||||||
|
# the bundled copy of readline for pre-releases.
|
||||||
|
READLINE_VER="8.2_p1"
|
||||||
|
|
||||||
|
DESCRIPTION="The standard GNU Bourne again shell"
|
||||||
|
HOMEPAGE="https://tiswww.case.edu/php/chet/bash/bashtop.html https://git.savannah.gnu.org/cgit/bash.git"
|
||||||
|
|
||||||
|
if [[ ${PV} == 9999 ]]; then
|
||||||
|
EGIT_REPO_URI="https://git.savannah.gnu.org/git/bash.git"
|
||||||
|
EGIT_BRANCH=devel
|
||||||
|
inherit git-r3
|
||||||
|
else
|
||||||
|
my_urls=( {'mirror://gnu/bash','ftp://ftp.cwru.edu/pub/bash'}/"${MY_P}.tar.gz" )
|
||||||
|
|
||||||
|
# bash-5.1 -> bash51
|
||||||
|
my_p=${PN}$(ver_cut 1-2) my_p=${my_p/.}
|
||||||
|
|
||||||
|
for (( my_patch_idx = 1; my_patch_idx <= PLEVEL; my_patch_idx++ )); do
|
||||||
|
printf -v my_patch_ver %s-%03d "${my_p}" "${my_patch_idx}"
|
||||||
|
my_urls+=( {'mirror://gnu/bash','ftp://ftp.cwru.edu/pub/bash'}/"${MY_P}-patches/${my_patch_ver}" )
|
||||||
|
MY_PATCHES+=( "${DISTDIR}/${my_patch_ver}" )
|
||||||
|
done
|
||||||
|
|
||||||
|
SRC_URI="${my_urls[*]} verify-sig? ( ${my_urls[*]/%/.sig} )"
|
||||||
|
|
||||||
|
unset -v my_urls my_p my_patch_idx my_patch_ver
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${GENTOO_PATCH_VER} ]]; then
|
||||||
|
SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV:?}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER:?}-patches.tar.xz"
|
||||||
|
fi
|
||||||
|
|
||||||
|
S=${WORKDIR}/${MY_P}
|
||||||
|
|
||||||
|
LICENSE="GPL-3+"
|
||||||
|
SLOT="0"
|
||||||
|
if (( PLEVEL >= 0 )); then
|
||||||
|
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"
|
||||||
|
fi
|
||||||
|
IUSE="afs bashlogger examples mem-scramble +net nls plugins pgo +readline"
|
||||||
|
|
||||||
|
DEPEND="
|
||||||
|
>=sys-libs/ncurses-5.2-r2:=
|
||||||
|
nls? ( virtual/libintl )
|
||||||
|
"
|
||||||
|
if (( PLEVEL >= 0 )); then
|
||||||
|
DEPEND+=" readline? ( >=sys-libs/readline-${READLINE_VER}:= )"
|
||||||
|
fi
|
||||||
|
RDEPEND="
|
||||||
|
${DEPEND}
|
||||||
|
"
|
||||||
|
# We only need bison (yacc) when the .y files get patched (bash42-005, bash51-011).
|
||||||
|
BDEPEND="
|
||||||
|
pgo? ( dev-util/gperf )
|
||||||
|
verify-sig? ( sec-keys/openpgp-keys-chetramey )
|
||||||
|
"
|
||||||
|
|
||||||
|
# EAPI 8 tries to append it but it doesn't exist here.
|
||||||
|
QA_CONFIGURE_OPTIONS="--disable-static"
|
||||||
|
|
||||||
|
PATCHES=(
|
||||||
|
#"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}/
|
||||||
|
|
||||||
|
# Patches to or from Chet, posted to the bug-bash mailing list.
|
||||||
|
"${FILESDIR}/${PN}-5.0-syslog-history-extern.patch"
|
||||||
|
"${FILESDIR}/${PN}-5.2_p15-random-ub.patch"
|
||||||
|
"${FILESDIR}/${PN}-5.2_p15-configure-clang16.patch"
|
||||||
|
"${FILESDIR}/${PN}-5.2_p21-wpointer-to-int.patch"
|
||||||
|
"${FILESDIR}/${PN}-5.2_p21-configure-strtold.patch"
|
||||||
|
"${FILESDIR}/${PN}-5.2_p26-memory-leaks.patch"
|
||||||
|
)
|
||||||
|
|
||||||
|
pkg_setup() {
|
||||||
|
# bug #7332
|
||||||
|
if is-flag -malign-double; then
|
||||||
|
eerror "Detected bad CFLAGS '-malign-double'. Do not use this"
|
||||||
|
eerror "as it breaks LFS (struct stat64) on x86."
|
||||||
|
die "remove -malign-double from your CFLAGS mr ricer"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if use bashlogger; then
|
||||||
|
ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
|
||||||
|
ewarn "This will log ALL output you enter into the shell, you have been warned."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
src_unpack() {
|
||||||
|
local patch
|
||||||
|
|
||||||
|
if [[ ${PV} == 9999 ]]; then
|
||||||
|
git-r3_src_unpack
|
||||||
|
else
|
||||||
|
if use verify-sig; then
|
||||||
|
verify-sig_verify_detached "${DISTDIR}/${MY_P}.tar.gz"{,.sig}
|
||||||
|
|
||||||
|
for patch in "${MY_PATCHES[@]}"; do
|
||||||
|
verify-sig_verify_detached "${patch}"{,.sig}
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
unpack "${MY_P}.tar.gz"
|
||||||
|
|
||||||
|
if [[ ${GENTOO_PATCH_VER} ]]; then
|
||||||
|
unpack "${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
src_prepare() {
|
||||||
|
# Include official patches.
|
||||||
|
(( PLEVEL > 0 )) && eapply -p0 "${MY_PATCHES[@]}"
|
||||||
|
|
||||||
|
# Clean out local libs so we know we use system ones w/releases. The
|
||||||
|
# touch utility is invoked for the benefit of config.status.
|
||||||
|
if (( PLEVEL >= 0 )); then
|
||||||
|
rm -rf lib/{readline,termcap}/* \
|
||||||
|
&& touch lib/{readline,termcap}/Makefile.in \
|
||||||
|
&& sed -i -E 's:\$[{(](RL|HIST)_LIBSRC[)}]/[[:alpha:]_-]*\.h::g' Makefile.in \
|
||||||
|
|| die
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prefixify hardcoded path names. No-op for non-prefix.
|
||||||
|
hprefixify pathnames.h.in
|
||||||
|
|
||||||
|
# Avoid regenerating docs after patches, bug #407985.
|
||||||
|
sed -i -E '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in \
|
||||||
|
&& touch -r . doc/* \
|
||||||
|
|| die
|
||||||
|
|
||||||
|
# Sometimes hangs (more noticeable w/ pgo), bug #907403.
|
||||||
|
rm tests/run-jobs || die
|
||||||
|
|
||||||
|
eapply -p0 "${PATCHES[@]}"
|
||||||
|
eapply_user
|
||||||
|
}
|
||||||
|
|
||||||
|
src_configure() {
|
||||||
|
local -a myconf
|
||||||
|
|
||||||
|
# Upstream only test with Bison and require GNUisms like YYEOF and
|
||||||
|
# YYERRCODE. The former at least may be in POSIX soon:
|
||||||
|
# https://www.austingroupbugs.net/view.php?id=1269.
|
||||||
|
# configure warns on use of non-Bison but doesn't abort. The result
|
||||||
|
# may misbehave at runtime.
|
||||||
|
unset -v YACC
|
||||||
|
|
||||||
|
myconf=(
|
||||||
|
--disable-profiling
|
||||||
|
|
||||||
|
# Force linking with system curses ... the bundled termcap lib
|
||||||
|
# sucks bad compared to ncurses. For the most part, ncurses
|
||||||
|
# is here because readline needs it. But bash itself calls
|
||||||
|
# ncurses in one or two small places :(.
|
||||||
|
--with-curses
|
||||||
|
|
||||||
|
$(use_enable mem-scramble)
|
||||||
|
$(use_enable net net-redirections)
|
||||||
|
$(use_enable readline)
|
||||||
|
$(use_enable readline bang-history)
|
||||||
|
$(use_enable readline history)
|
||||||
|
$(use_with afs)
|
||||||
|
$(use_with mem-scramble bash-malloc)
|
||||||
|
)
|
||||||
|
|
||||||
|
# For descriptions of these, see config-top.h.
|
||||||
|
# bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
|
||||||
|
append-cppflags \
|
||||||
|
-DDEFAULT_PATH_VALUE=\'\""${EPREFIX}"/usr/local/sbin:"${EPREFIX}"/usr/local/bin:"${EPREFIX}"/usr/sbin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/bin\"\' \
|
||||||
|
-DSTANDARD_UTILS_PATH=\'\""${EPREFIX}"/bin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/usr/sbin\"\' \
|
||||||
|
-DSYS_BASHRC=\'\""${EPREFIX}"/etc/bash/bashrc\"\' \
|
||||||
|
-DSYS_BASH_LOGOUT=\'\""${EPREFIX}"/etc/bash/bash_logout\"\' \
|
||||||
|
-DNON_INTERACTIVE_LOGIN_SHELLS \
|
||||||
|
-DSSH_SOURCE_BASHRC \
|
||||||
|
$(use bashlogger && echo -DSYSLOG_HISTORY)
|
||||||
|
|
||||||
|
use nls || myconf+=( --disable-nls )
|
||||||
|
|
||||||
|
if (( PLEVEL >= 0 )); then
|
||||||
|
# Historically, we always used the builtin readline, but since
|
||||||
|
# our handling of SONAME upgrades has gotten much more stable
|
||||||
|
# in the PM (and the readline ebuild itself preserves the old
|
||||||
|
# libs during upgrades), linking against the system copy should
|
||||||
|
# be safe.
|
||||||
|
# Exact cached version here doesn't really matter as long as it
|
||||||
|
# is at least what's in the DEPEND up above.
|
||||||
|
export ac_cv_rl_version=${READLINE_VER%%_*}
|
||||||
|
|
||||||
|
# Use system readline only with released versions.
|
||||||
|
myconf+=( --with-installed-readline=. )
|
||||||
|
fi
|
||||||
|
|
||||||
|
if use plugins; then
|
||||||
|
append-ldflags "-Wl,-rpath,${EPREFIX}/usr/$(get_libdir)/bash"
|
||||||
|
else
|
||||||
|
# Disable the plugins logic by hand since bash doesn't provide
|
||||||
|
# a way of doing it.
|
||||||
|
export ac_cv_func_dl{close,open,sym}=no \
|
||||||
|
ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
|
||||||
|
|
||||||
|
sed -i -e '/LOCAL_LDFLAGS=/s:-rdynamic::' configure || die
|
||||||
|
fi
|
||||||
|
|
||||||
|
# bug #444070
|
||||||
|
tc-export AR
|
||||||
|
|
||||||
|
econf "${myconf[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
src_compile() {
|
||||||
|
local -a pgo_generate_flags pgo_use_flags
|
||||||
|
local flag
|
||||||
|
|
||||||
|
# -fprofile-partial-training because upstream notes the test suite isn't
|
||||||
|
# super comprehensive.
|
||||||
|
# https://documentation.suse.com/sbp/all/html/SBP-GCC-10/index.html#sec-gcc10-pgo
|
||||||
|
if use pgo; then
|
||||||
|
pgo_generate_flags=(
|
||||||
|
-fprofile-update=atomic
|
||||||
|
-fprofile-dir="${T}"/pgo
|
||||||
|
-fprofile-generate="${T}"/pgo
|
||||||
|
)
|
||||||
|
pgo_use_flags=(
|
||||||
|
-fprofile-use="${T}"/pgo
|
||||||
|
-fprofile-dir="${T}"/pgo
|
||||||
|
)
|
||||||
|
if flag=$(test-flags-CC -fprofile-partial-training); then
|
||||||
|
pgo_generate_flags+=( "${flag}" )
|
||||||
|
pgo_use_flags+=( "${flag}" )
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
emake CFLAGS="${CFLAGS} ${pgo_generate_flags[*]}"
|
||||||
|
use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} ${pgo_generate_flags[*]}" all others
|
||||||
|
|
||||||
|
# Build Bash and run its tests to generate profiles.
|
||||||
|
if (( ${#pgo_generate_flags[@]} )); then
|
||||||
|
# Used in test suite.
|
||||||
|
unset -v A
|
||||||
|
|
||||||
|
emake CFLAGS="${CFLAGS} ${pgo_generate_flags[*]}" -k check
|
||||||
|
|
||||||
|
if tc-is-clang; then
|
||||||
|
llvm-profdata merge "${T}"/pgo --output="${T}"/pgo/default.profdata || die
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Rebuild Bash using the profiling data we just generated.
|
||||||
|
emake clean
|
||||||
|
emake CFLAGS="${CFLAGS} ${pgo_use_flags[*]}"
|
||||||
|
use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} ${pgo_use_flags[*]}" all others
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
src_test() {
|
||||||
|
# Used in test suite.
|
||||||
|
unset -v A
|
||||||
|
|
||||||
|
default
|
||||||
|
}
|
||||||
|
|
||||||
|
src_install() {
|
||||||
|
local d f
|
||||||
|
|
||||||
|
default
|
||||||
|
|
||||||
|
my_prefixify() {
|
||||||
|
while read -r; do
|
||||||
|
if [[ $REPLY == *$1* ]]; then
|
||||||
|
REPLY=${REPLY/"/etc/"/"${EPREFIX}/etc/"}
|
||||||
|
fi
|
||||||
|
printf '%s\n' "${REPLY}" || ! break
|
||||||
|
done < "$2" || die
|
||||||
|
}
|
||||||
|
|
||||||
|
dodir /bin
|
||||||
|
mv -- "${ED}"/usr/bin/bash "${ED}"/bin/ || die
|
||||||
|
dosym bash /bin/rbash
|
||||||
|
|
||||||
|
insinto /etc/bash
|
||||||
|
doins "${FILESDIR}"/bash_logout
|
||||||
|
my_prefixify bashrc.d "${FILESDIR}"/bashrc-r1 | newins - bashrc
|
||||||
|
|
||||||
|
insinto /etc/bash/bashrc.d
|
||||||
|
my_prefixify DIR_COLORS "${FILESDIR}"/bashrc.d/10-gentoo-color.bash | newins - 10-gentoo-color.bash
|
||||||
|
doins "${FILESDIR}"/bashrc.d/10-gentoo-title.bash
|
||||||
|
if [[ ! ${EPREFIX} ]]; then
|
||||||
|
doins "${FILESDIR}"/bashrc.d/15-gentoo-bashrc-check.bash
|
||||||
|
fi
|
||||||
|
|
||||||
|
insinto /etc/skel
|
||||||
|
for f in bash{_logout,_profile,rc}; do
|
||||||
|
newins "${FILESDIR}/dot-${f}" ".${f}"
|
||||||
|
done
|
||||||
|
|
||||||
|
if use plugins; then
|
||||||
|
exeinto "/usr/$(get_libdir)/bash"
|
||||||
|
set -- examples/loadables/*.o
|
||||||
|
doexe "${@%.o}"
|
||||||
|
|
||||||
|
insinto /usr/include/bash-plugins
|
||||||
|
doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if use examples; then
|
||||||
|
for d in examples/{functions,misc,scripts,startup-files}; do
|
||||||
|
exeinto "/usr/share/doc/${PF}/${d}"
|
||||||
|
docinto "${d}"
|
||||||
|
for f in "${d}"/*; do
|
||||||
|
if [[ ${f##*/} != @(PERMISSION|*README) ]]; then
|
||||||
|
doexe "${f}"
|
||||||
|
else
|
||||||
|
dodoc "${f}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install bash_builtins.1 and rbash.1.
|
||||||
|
emake -C doc DESTDIR="${D}" install_builtins
|
||||||
|
sed 's:bash\.1:man1/&:' doc/rbash.1 > "${T}"/rbash.1 || die
|
||||||
|
doman "${T}"/rbash.1
|
||||||
|
|
||||||
|
newdoc CWRU/changelog ChangeLog
|
||||||
|
dosym bash.info /usr/share/info/bashref.info
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_preinst() {
|
||||||
|
if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]]; then
|
||||||
|
mkdir -p -- "${EROOT}"/etc/bash \
|
||||||
|
&& mv -f -- "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/ \
|
||||||
|
|| die
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_postinst() {
|
||||||
|
local old_ver
|
||||||
|
|
||||||
|
# If /bin/sh does not exist, provide it.
|
||||||
|
if [[ ! -e ${EROOT}/bin/sh ]]; then
|
||||||
|
ln -sf -- bash "${EROOT}"/bin/sh || die
|
||||||
|
fi
|
||||||
|
|
||||||
|
read -r old_ver <<<"${REPLACING_VERSIONS}"
|
||||||
|
if [[ ! $old_ver ]]; then
|
||||||
|
:
|
||||||
|
elif ver_test "$old_ver" -ge "5.2" && ver_test "$old_ver" -ge "5.2_p26-r6"; then
|
||||||
|
return
|
||||||
|
elif ver_test "$old_ver" -lt "5.2" && ver_test "$old_ver" -ge "5.1_p16-r13"; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -r; do ewarn "${REPLY}"; done <<'EOF'
|
||||||
|
Files situated under /etc/bash/bashrc.d must now have a suffix of .sh or .bash.
|
||||||
|
|
||||||
|
Gentoo now defaults to defining PROMPT_COMMAND as an array. Depending on the
|
||||||
|
characteristics of the operating environment, this array may contain a command
|
||||||
|
to set the terminal's window title. Those already choosing to customise the
|
||||||
|
PROMPT_COMMAND variable are now advised to append their commands like so:
|
||||||
|
|
||||||
|
PROMPT_COMMAND+=('custom command goes here')
|
||||||
|
|
||||||
|
Gentoo no longer defaults to having bash manipulate the window title in the case
|
||||||
|
that the terminal is controlled by sshd(8), unless screen or tmux are in use.
|
||||||
|
Those wanting to set the title unconditionally may adjust ~/.bashrc - or create
|
||||||
|
a custom /etc/bash/bashrc.d drop-in - to set PROMPT_COMMMAND like so:
|
||||||
|
|
||||||
|
PROMPT_COMMAND=(genfun_set_win_title)
|
||||||
|
|
||||||
|
Those who would prefer for bash never to interfere with the window title may
|
||||||
|
now opt out of the default title setting behaviour, either with the "unset -v
|
||||||
|
PROMPT_COMMAND" command or by re-defining PROMPT_COMMAND as desired.
|
||||||
|
EOF
|
||||||
|
}
|
@ -1,375 +0,0 @@
|
|||||||
# Copyright 1999-2024 Gentoo Authors
|
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
|
||||||
|
|
||||||
EAPI=8
|
|
||||||
|
|
||||||
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/chetramey.asc
|
|
||||||
inherit flag-o-matic toolchain-funcs prefix verify-sig
|
|
||||||
|
|
||||||
# Uncomment if we have a patchset
|
|
||||||
#GENTOO_PATCH_DEV="sam"
|
|
||||||
#GENTOO_PATCH_VER="${PV}"
|
|
||||||
|
|
||||||
# Official patchlevel
|
|
||||||
# See ftp://ftp.cwru.edu/pub/bash/bash-5.1-patches/
|
|
||||||
PLEVEL="${PV##*_p}"
|
|
||||||
MY_PV="${PV/_p*}"
|
|
||||||
MY_PV="${MY_PV/_/-}"
|
|
||||||
MY_P="${PN}-${MY_PV}"
|
|
||||||
MY_PATCHES=()
|
|
||||||
|
|
||||||
is_release() {
|
|
||||||
case ${PV} in
|
|
||||||
9999|*_alpha*|*_beta*|*_rc*)
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
[[ ${PV} != *_p* ]] && PLEVEL=0
|
|
||||||
|
|
||||||
# The version of readline this bash normally ships with.
|
|
||||||
# Note: right now, we don't use the system copy of readline for bash for non-releases.
|
|
||||||
READLINE_VER="8.2_p1"
|
|
||||||
|
|
||||||
DESCRIPTION="The standard GNU Bourne again shell"
|
|
||||||
HOMEPAGE="https://tiswww.case.edu/php/chet/bash/bashtop.html https://git.savannah.gnu.org/cgit/bash.git"
|
|
||||||
|
|
||||||
if [[ ${PV} == 9999 ]] ; then
|
|
||||||
EGIT_REPO_URI="https://git.savannah.gnu.org/git/bash.git"
|
|
||||||
EGIT_BRANCH=devel
|
|
||||||
inherit git-r3
|
|
||||||
elif is_release ; then
|
|
||||||
SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz"
|
|
||||||
SRC_URI+=" verify-sig? ( mirror://gnu/bash/${MY_P}.tar.gz.sig )"
|
|
||||||
|
|
||||||
if [[ ${PLEVEL} -gt 0 ]] ; then
|
|
||||||
# bash-5.1 -> bash51
|
|
||||||
my_p=${PN}$(ver_rs 1-2 '' $(ver_cut 1-2))
|
|
||||||
|
|
||||||
patch_url=
|
|
||||||
my_patch_index=
|
|
||||||
|
|
||||||
upstream_url_base="mirror://gnu/bash"
|
|
||||||
mirror_url_base="ftp://ftp.cwru.edu/pub/bash"
|
|
||||||
|
|
||||||
for ((my_patch_index=1; my_patch_index <= ${PLEVEL} ; my_patch_index++)) ; do
|
|
||||||
printf -v mangled_patch_ver ${my_p}-%03d ${my_patch_index}
|
|
||||||
patch_url="${upstream_url_base}/${MY_P}-patches/${mangled_patch_ver}"
|
|
||||||
|
|
||||||
SRC_URI+=" ${patch_url}"
|
|
||||||
SRC_URI+=" verify-sig? ( ${patch_url}.sig )"
|
|
||||||
|
|
||||||
# Add in the mirror URL too.
|
|
||||||
SRC_URI+=" ${patch_url/${upstream_url_base}/${mirror_url_base}}"
|
|
||||||
SRC_URI+=" verify-sig? ( ${patch_url/${upstream_url_base}/${mirror_url_base}} )"
|
|
||||||
|
|
||||||
MY_PATCHES+=( "${DISTDIR}"/${mangled_patch_ver} )
|
|
||||||
done
|
|
||||||
|
|
||||||
unset my_p patch_url my_patch_index upstream_url_base mirror_url_base
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
|
|
||||||
SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${MY_P}.tar.gz.sig ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz.sig )"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n ${GENTOO_PATCH_VER} ]] ; then
|
|
||||||
SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
|
|
||||||
fi
|
|
||||||
|
|
||||||
LICENSE="GPL-3+"
|
|
||||||
SLOT="0"
|
|
||||||
if is_release ; then
|
|
||||||
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"
|
|
||||||
fi
|
|
||||||
IUSE="afs bashlogger examples mem-scramble +net nls plugins pgo +readline"
|
|
||||||
|
|
||||||
DEPEND="
|
|
||||||
>=sys-libs/ncurses-5.2-r2:=
|
|
||||||
nls? ( virtual/libintl )
|
|
||||||
"
|
|
||||||
if is_release ; then
|
|
||||||
DEPEND+=" readline? ( >=sys-libs/readline-${READLINE_VER}:= )"
|
|
||||||
fi
|
|
||||||
RDEPEND="
|
|
||||||
${DEPEND}
|
|
||||||
"
|
|
||||||
# We only need bison (yacc) when the .y files get patched (bash42-005, bash51-011)
|
|
||||||
BDEPEND="
|
|
||||||
pgo? ( dev-util/gperf )
|
|
||||||
verify-sig? ( sec-keys/openpgp-keys-chetramey )
|
|
||||||
"
|
|
||||||
|
|
||||||
S="${WORKDIR}/${MY_P}"
|
|
||||||
|
|
||||||
# EAPI 8 tries to append it but it doesn't exist here
|
|
||||||
QA_CONFIGURE_OPTIONS="--disable-static"
|
|
||||||
|
|
||||||
PATCHES=(
|
|
||||||
#"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}/
|
|
||||||
|
|
||||||
# Patches from Chet sent to bash-bug ml
|
|
||||||
"${FILESDIR}"/${PN}-5.0-syslog-history-extern.patch
|
|
||||||
"${FILESDIR}"/${PN}-5.2_p15-random-ub.patch
|
|
||||||
"${FILESDIR}"/${PN}-5.2_p15-configure-clang16.patch
|
|
||||||
"${FILESDIR}"/${PN}-5.2_p21-wpointer-to-int.patch
|
|
||||||
"${FILESDIR}"/${PN}-5.2_p21-configure-strtold.patch
|
|
||||||
"${FILESDIR}"/${PN}-5.2_p26-memory-leaks.patch
|
|
||||||
)
|
|
||||||
|
|
||||||
pkg_setup() {
|
|
||||||
# bug #7332
|
|
||||||
if is-flag -malign-double ; then
|
|
||||||
eerror "Detected bad CFLAGS '-malign-double'. Do not use this"
|
|
||||||
eerror "as it breaks LFS (struct stat64) on x86."
|
|
||||||
die "remove -malign-double from your CFLAGS mr ricer"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if use bashlogger ; then
|
|
||||||
ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
|
|
||||||
ewarn "This will log ALL output you enter into the shell, you have been warned."
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
src_unpack() {
|
|
||||||
if [[ ${PV} == 9999 ]] ; then
|
|
||||||
git-r3_src_unpack
|
|
||||||
else
|
|
||||||
if use verify-sig ; then
|
|
||||||
verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.gz{,.sig}
|
|
||||||
|
|
||||||
local patch
|
|
||||||
for patch in "${MY_PATCHES[@]}" ; do
|
|
||||||
verify-sig_verify_detached ${patch}{,.sig}
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
unpack ${MY_P}.tar.gz
|
|
||||||
|
|
||||||
if [[ -n ${GENTOO_PATCH_VER} ]] ; then
|
|
||||||
unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
src_prepare() {
|
|
||||||
# Include official patches
|
|
||||||
[[ ${PLEVEL} -gt 0 ]] && eapply -p0 "${MY_PATCHES[@]}"
|
|
||||||
|
|
||||||
# Clean out local libs so we know we use system ones w/releases.
|
|
||||||
if is_release ; then
|
|
||||||
rm -rf lib/{readline,termcap}/* || die
|
|
||||||
touch lib/{readline,termcap}/Makefile.in || die # for config.status
|
|
||||||
sed -ri -e 's:\$[{(](RL|HIST)_LIBSRC[)}]/[[:alpha:]_-]*\.h::g' Makefile.in || die
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Prefixify hardcoded path names. No-op for non-prefix.
|
|
||||||
hprefixify pathnames.h.in
|
|
||||||
|
|
||||||
# Avoid regenerating docs after patches, bug #407985
|
|
||||||
sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
|
|
||||||
touch -r . doc/* || die
|
|
||||||
|
|
||||||
# Sometimes hangs (more noticeable w/ pgo), bug #907403.
|
|
||||||
rm tests/run-jobs || die
|
|
||||||
|
|
||||||
eapply -p0 "${PATCHES[@]}"
|
|
||||||
eapply_user
|
|
||||||
}
|
|
||||||
|
|
||||||
src_configure() {
|
|
||||||
# Upstream only test with Bison and require GNUisms like YYEOF and
|
|
||||||
# YYERRCODE. The former at least may be in POSIX soon:
|
|
||||||
# https://www.austingroupbugs.net/view.php?id=1269.
|
|
||||||
# configure warns on use of non-Bison but doesn't abort. The result
|
|
||||||
# may misbehave at runtime.
|
|
||||||
unset YACC
|
|
||||||
|
|
||||||
local myconf=(
|
|
||||||
--disable-profiling
|
|
||||||
|
|
||||||
# Force linking with system curses ... the bundled termcap lib
|
|
||||||
# sucks bad compared to ncurses. For the most part, ncurses
|
|
||||||
# is here because readline needs it. But bash itself calls
|
|
||||||
# ncurses in one or two small places :(.
|
|
||||||
--with-curses
|
|
||||||
|
|
||||||
$(use_enable mem-scramble)
|
|
||||||
$(use_enable net net-redirections)
|
|
||||||
$(use_enable readline)
|
|
||||||
$(use_enable readline bang-history)
|
|
||||||
$(use_enable readline history)
|
|
||||||
$(use_with afs)
|
|
||||||
$(use_with mem-scramble bash-malloc)
|
|
||||||
)
|
|
||||||
|
|
||||||
# For descriptions of these, see config-top.h
|
|
||||||
# bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
|
|
||||||
append-cppflags \
|
|
||||||
-DDEFAULT_PATH_VALUE=\'\""${EPREFIX}"/usr/local/sbin:"${EPREFIX}"/usr/local/bin:"${EPREFIX}"/usr/sbin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/bin\"\' \
|
|
||||||
-DSTANDARD_UTILS_PATH=\'\""${EPREFIX}"/bin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/usr/sbin\"\' \
|
|
||||||
-DSYS_BASHRC=\'\""${EPREFIX}"/etc/bash/bashrc\"\' \
|
|
||||||
-DSYS_BASH_LOGOUT=\'\""${EPREFIX}"/etc/bash/bash_logout\"\' \
|
|
||||||
-DNON_INTERACTIVE_LOGIN_SHELLS \
|
|
||||||
-DSSH_SOURCE_BASHRC \
|
|
||||||
$(use bashlogger && echo -DSYSLOG_HISTORY)
|
|
||||||
|
|
||||||
# Don't even think about building this statically without
|
|
||||||
# reading bug #7714 first. If you still build it statically,
|
|
||||||
# don't come crying to us with bugs ;).
|
|
||||||
#use static && export LDFLAGS="${LDFLAGS} -static"
|
|
||||||
use nls || myconf+=( --disable-nls )
|
|
||||||
|
|
||||||
if is_release ; then
|
|
||||||
# Historically, we always used the builtin readline, but since
|
|
||||||
# our handling of SONAME upgrades has gotten much more stable
|
|
||||||
# in the PM (and the readline ebuild itself preserves the old
|
|
||||||
# libs during upgrades), linking against the system copy should
|
|
||||||
# be safe.
|
|
||||||
# Exact cached version here doesn't really matter as long as it
|
|
||||||
# is at least what's in the DEPEND up above.
|
|
||||||
export ac_cv_rl_version=${READLINE_VER%%_*}
|
|
||||||
|
|
||||||
# Use system readline only with released versions.
|
|
||||||
myconf+=( --with-installed-readline=. )
|
|
||||||
fi
|
|
||||||
|
|
||||||
if use plugins ; then
|
|
||||||
append-ldflags -Wl,-rpath,"${EPREFIX}"/usr/$(get_libdir)/bash
|
|
||||||
else
|
|
||||||
# Disable the plugins logic by hand since bash doesn't
|
|
||||||
# provide a way of doing it.
|
|
||||||
export ac_cv_func_dl{close,open,sym}=no \
|
|
||||||
ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
|
|
||||||
|
|
||||||
sed -i \
|
|
||||||
-e '/LOCAL_LDFLAGS=/s:-rdynamic::' \
|
|
||||||
configure || die
|
|
||||||
fi
|
|
||||||
|
|
||||||
# bug #444070
|
|
||||||
tc-export AR
|
|
||||||
|
|
||||||
econf "${myconf[@]}"
|
|
||||||
}
|
|
||||||
|
|
||||||
src_compile() {
|
|
||||||
# -fprofile-partial-training because upstream note the test suite isn't super comprehensive
|
|
||||||
# See https://documentation.suse.com/sbp/all/html/SBP-GCC-10/index.html#sec-gcc10-pgo
|
|
||||||
local pgo_generate_flags=$(usev pgo "-fprofile-update=atomic -fprofile-dir=${T}/pgo -fprofile-generate=${T}/pgo $(test-flags-CC -fprofile-partial-training)")
|
|
||||||
local pgo_use_flags=$(usev pgo "-fprofile-use=${T}/pgo -fprofile-dir=${T}/pgo $(test-flags-CC -fprofile-partial-training)")
|
|
||||||
|
|
||||||
emake CFLAGS="${CFLAGS} ${pgo_generate_flags}"
|
|
||||||
use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} ${pgo_generate_flags}" all others
|
|
||||||
|
|
||||||
# Build Bash and run its tests to generate profiles.
|
|
||||||
if use pgo ; then
|
|
||||||
# Used in test suite.
|
|
||||||
unset A
|
|
||||||
|
|
||||||
emake CFLAGS="${CFLAGS} ${pgo_generate_flags}" -k check
|
|
||||||
|
|
||||||
if tc-is-clang; then
|
|
||||||
llvm-profdata merge "${T}"/pgo --output="${T}"/pgo/default.profdata || die
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Rebuild Bash using the profiling data we just generated.
|
|
||||||
emake clean
|
|
||||||
emake CFLAGS="${CFLAGS} ${pgo_use_flags}"
|
|
||||||
use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} ${pgo_use_flags}" all others
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
src_test() {
|
|
||||||
# Used in test suite.
|
|
||||||
unset A
|
|
||||||
|
|
||||||
default
|
|
||||||
}
|
|
||||||
|
|
||||||
src_install() {
|
|
||||||
local d f
|
|
||||||
|
|
||||||
default
|
|
||||||
|
|
||||||
dodir /bin
|
|
||||||
mv "${ED}"/usr/bin/bash "${ED}"/bin/ || die
|
|
||||||
dosym bash /bin/rbash
|
|
||||||
|
|
||||||
insinto /etc/bash
|
|
||||||
doins "${FILESDIR}"/bash_logout
|
|
||||||
doins "$(prefixify_ro "${FILESDIR}"/bashrc)"
|
|
||||||
|
|
||||||
keepdir /etc/bash/bashrc.d
|
|
||||||
|
|
||||||
insinto /etc/skel
|
|
||||||
for f in bash{_logout,_profile,rc} ; do
|
|
||||||
newins "${FILESDIR}"/dot-${f} .${f}
|
|
||||||
done
|
|
||||||
|
|
||||||
local sed_args=(
|
|
||||||
-e 's:#GNU#@::'
|
|
||||||
-e '/#@/d'
|
|
||||||
)
|
|
||||||
|
|
||||||
if ! use readline ; then
|
|
||||||
# bug #432338
|
|
||||||
sed_args+=(
|
|
||||||
-e '/^shopt -s histappend/s:^:#:'
|
|
||||||
-e 's:use_color=true:use_color=false:'
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
|
|
||||||
sed -i \
|
|
||||||
"${sed_args[@]}" \
|
|
||||||
"${ED}"/etc/skel/.bashrc \
|
|
||||||
"${ED}"/etc/bash/bashrc || die
|
|
||||||
|
|
||||||
if use plugins ; then
|
|
||||||
exeinto /usr/$(get_libdir)/bash
|
|
||||||
doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
|
|
||||||
|
|
||||||
insinto /usr/include/bash-plugins
|
|
||||||
doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if use examples ; then
|
|
||||||
for d in examples/{functions,misc,scripts,startup-files} ; do
|
|
||||||
exeinto /usr/share/doc/${PF}/${d}
|
|
||||||
docinto ${d}
|
|
||||||
for f in ${d}/* ; do
|
|
||||||
if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
|
|
||||||
doexe ${f}
|
|
||||||
else
|
|
||||||
dodoc ${f}
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install bash_builtins.1 and rbash.1
|
|
||||||
emake -C doc DESTDIR="${D}" install_builtins
|
|
||||||
sed 's:bash\.1:man1/&:' doc/rbash.1 > "${T}"/rbash.1 || die
|
|
||||||
doman "${T}"/rbash.1
|
|
||||||
|
|
||||||
newdoc CWRU/changelog ChangeLog
|
|
||||||
dosym bash.info /usr/share/info/bashref.info
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_preinst() {
|
|
||||||
if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then
|
|
||||||
mkdir -p "${EROOT}"/etc/bash
|
|
||||||
mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_postinst() {
|
|
||||||
# If /bin/sh does not exist, provide it
|
|
||||||
if [[ ! -e ${EROOT}/bin/sh ]] ; then
|
|
||||||
ln -sf bash "${EROOT}"/bin/sh
|
|
||||||
fi
|
|
||||||
}
|
|
401
sdk_container/src/third_party/portage-stable/app-shells/bash/bash-5.3_alpha-r5.ebuild
vendored
Normal file
401
sdk_container/src/third_party/portage-stable/app-shells/bash/bash-5.3_alpha-r5.ebuild
vendored
Normal file
@ -0,0 +1,401 @@
|
|||||||
|
# Copyright 1999-2024 Gentoo Authors
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
EAPI=8
|
||||||
|
|
||||||
|
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/chetramey.asc
|
||||||
|
inherit flag-o-matic toolchain-funcs prefix verify-sig
|
||||||
|
|
||||||
|
# Uncomment if we have a patchset.
|
||||||
|
#GENTOO_PATCH_DEV="sam"
|
||||||
|
#GENTOO_PATCH_VER="${PV}"
|
||||||
|
|
||||||
|
MY_PV=${PV/_p*}
|
||||||
|
MY_PV=${MY_PV/_/-}
|
||||||
|
MY_P=${PN}-${MY_PV}
|
||||||
|
MY_PATCHES=()
|
||||||
|
|
||||||
|
# Determine the patchlevel. See ftp://ftp.gnu.org/gnu/bash/bash-5.3-patches/.
|
||||||
|
case ${PV} in
|
||||||
|
*_p*)
|
||||||
|
PLEVEL=${PV##*_p}
|
||||||
|
;;
|
||||||
|
9999|*_alpha*|*_beta*|*_rc*)
|
||||||
|
# Set a negative patchlevel to indicate that it's a pre-release.
|
||||||
|
PLEVEL=-1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
PLEVEL=0
|
||||||
|
esac
|
||||||
|
|
||||||
|
# The version of readline this bash normally ships with. Note that we only use
|
||||||
|
# the bundled copy of readline for pre-releases.
|
||||||
|
READLINE_VER="8.3_alpha"
|
||||||
|
|
||||||
|
DESCRIPTION="The standard GNU Bourne again shell"
|
||||||
|
HOMEPAGE="https://tiswww.case.edu/php/chet/bash/bashtop.html https://git.savannah.gnu.org/cgit/bash.git"
|
||||||
|
|
||||||
|
if [[ ${PV} == 9999 ]]; then
|
||||||
|
EGIT_REPO_URI="https://git.savannah.gnu.org/git/bash.git"
|
||||||
|
EGIT_BRANCH=devel
|
||||||
|
inherit git-r3
|
||||||
|
else
|
||||||
|
my_urls=( {'mirror://gnu/bash','ftp://ftp.cwru.edu/pub/bash'}/"${MY_P}.tar.gz" )
|
||||||
|
|
||||||
|
# bash-5.1 -> bash51
|
||||||
|
my_p=${PN}$(ver_cut 1-2) my_p=${my_p/.}
|
||||||
|
|
||||||
|
for (( my_patch_idx = 1; my_patch_idx <= PLEVEL; my_patch_idx++ )); do
|
||||||
|
printf -v my_patch_ver %s-%03d "${my_p}" "${my_patch_idx}"
|
||||||
|
my_urls+=( {'mirror://gnu/bash','ftp://ftp.cwru.edu/pub/bash'}/"${MY_P}-patches/${my_patch_ver}" )
|
||||||
|
MY_PATCHES+=( "${DISTDIR}/${my_patch_ver}" )
|
||||||
|
done
|
||||||
|
|
||||||
|
SRC_URI="${my_urls[*]} verify-sig? ( ${my_urls[*]/%/.sig} )"
|
||||||
|
|
||||||
|
unset -v my_urls my_p my_patch_idx my_patch_ver
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${GENTOO_PATCH_VER} ]]; then
|
||||||
|
SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV:?}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER:?}-patches.tar.xz"
|
||||||
|
fi
|
||||||
|
|
||||||
|
S=${WORKDIR}/${MY_P}
|
||||||
|
|
||||||
|
LICENSE="GPL-3+"
|
||||||
|
SLOT="0"
|
||||||
|
if (( PLEVEL >= 0 )); then
|
||||||
|
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"
|
||||||
|
fi
|
||||||
|
IUSE="afs bashlogger examples mem-scramble +net nls plugins pgo +readline"
|
||||||
|
|
||||||
|
DEPEND="
|
||||||
|
>=sys-libs/ncurses-5.2-r2:=
|
||||||
|
nls? ( virtual/libintl )
|
||||||
|
"
|
||||||
|
if (( PLEVEL >= 0 )); then
|
||||||
|
DEPEND+=" readline? ( >=sys-libs/readline-${READLINE_VER}:= )"
|
||||||
|
fi
|
||||||
|
RDEPEND="
|
||||||
|
${DEPEND}
|
||||||
|
"
|
||||||
|
# We only need bison (yacc) when the .y files get patched (bash42-005, bash51-011).
|
||||||
|
BDEPEND="
|
||||||
|
pgo? ( dev-util/gperf )
|
||||||
|
verify-sig? ( sec-keys/openpgp-keys-chetramey )
|
||||||
|
"
|
||||||
|
|
||||||
|
# EAPI 8 tries to append it but it doesn't exist here.
|
||||||
|
QA_CONFIGURE_OPTIONS="--disable-static"
|
||||||
|
|
||||||
|
PATCHES=(
|
||||||
|
#"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}/
|
||||||
|
|
||||||
|
# Patches to or from Chet, posted to the bug-bash mailing list.
|
||||||
|
"${FILESDIR}/${PN}-5.0-syslog-history-extern.patch"
|
||||||
|
)
|
||||||
|
|
||||||
|
pkg_setup() {
|
||||||
|
# bug #7332
|
||||||
|
if is-flag -malign-double; then
|
||||||
|
eerror "Detected bad CFLAGS '-malign-double'. Do not use this"
|
||||||
|
eerror "as it breaks LFS (struct stat64) on x86."
|
||||||
|
die "remove -malign-double from your CFLAGS mr ricer"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if use bashlogger; then
|
||||||
|
ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
|
||||||
|
ewarn "This will log ALL output you enter into the shell, you have been warned."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
src_unpack() {
|
||||||
|
local patch
|
||||||
|
|
||||||
|
if [[ ${PV} == 9999 ]]; then
|
||||||
|
git-r3_src_unpack
|
||||||
|
else
|
||||||
|
if use verify-sig; then
|
||||||
|
verify-sig_verify_detached "${DISTDIR}/${MY_P}.tar.gz"{,.sig}
|
||||||
|
|
||||||
|
for patch in "${MY_PATCHES[@]}"; do
|
||||||
|
verify-sig_verify_detached "${patch}"{,.sig}
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
unpack "${MY_P}.tar.gz"
|
||||||
|
|
||||||
|
if [[ ${GENTOO_PATCH_VER} ]]; then
|
||||||
|
unpack "${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
src_prepare() {
|
||||||
|
# Include official patches.
|
||||||
|
(( PLEVEL > 0 )) && eapply -p0 "${MY_PATCHES[@]}"
|
||||||
|
|
||||||
|
# Clean out local libs so we know we use system ones w/releases. The
|
||||||
|
# touch utility is invoked for the benefit of config.status.
|
||||||
|
if (( PLEVEL >= 0 )); then
|
||||||
|
rm -rf lib/{readline,termcap}/* \
|
||||||
|
&& touch lib/{readline,termcap}/Makefile.in \
|
||||||
|
&& sed -i -E 's:\$[{(](RL|HIST)_LIBSRC[)}]/[[:alpha:]_-]*\.h::g' Makefile.in \
|
||||||
|
|| die
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prefixify hardcoded path names. No-op for non-prefix.
|
||||||
|
hprefixify pathnames.h.in
|
||||||
|
|
||||||
|
# Avoid regenerating docs after patches, bug #407985.
|
||||||
|
sed -i -E '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in \
|
||||||
|
&& touch -r . doc/* \
|
||||||
|
|| die
|
||||||
|
|
||||||
|
# Sometimes hangs (more noticeable w/ pgo), bug #907403.
|
||||||
|
rm tests/run-jobs || die
|
||||||
|
|
||||||
|
eapply -p0 "${PATCHES[@]}"
|
||||||
|
eapply_user
|
||||||
|
}
|
||||||
|
|
||||||
|
src_configure() {
|
||||||
|
local -a myconf
|
||||||
|
|
||||||
|
# Upstream only test with Bison and require GNUisms like YYEOF and
|
||||||
|
# YYERRCODE. The former at least may be in POSIX soon:
|
||||||
|
# https://www.austingroupbugs.net/view.php?id=1269.
|
||||||
|
# configure warns on use of non-Bison but doesn't abort. The result
|
||||||
|
# may misbehave at runtime.
|
||||||
|
unset -v YACC
|
||||||
|
|
||||||
|
# wcsnwidth(), substring() issues with -Wlto-type-mismatch, reported
|
||||||
|
# upstream to Chet by email.
|
||||||
|
filter-lto
|
||||||
|
|
||||||
|
myconf=(
|
||||||
|
--disable-profiling
|
||||||
|
|
||||||
|
# Force linking with system curses ... the bundled termcap lib
|
||||||
|
# sucks bad compared to ncurses. For the most part, ncurses
|
||||||
|
# is here because readline needs it. But bash itself calls
|
||||||
|
# ncurses in one or two small places :(.
|
||||||
|
--with-curses
|
||||||
|
|
||||||
|
$(use_enable mem-scramble)
|
||||||
|
$(use_enable net net-redirections)
|
||||||
|
$(use_enable readline)
|
||||||
|
$(use_enable readline bang-history)
|
||||||
|
$(use_enable readline history)
|
||||||
|
$(use_with afs)
|
||||||
|
$(use_with mem-scramble bash-malloc)
|
||||||
|
)
|
||||||
|
|
||||||
|
# For descriptions of these, see config-top.h.
|
||||||
|
# bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
|
||||||
|
append-cppflags \
|
||||||
|
-DDEFAULT_PATH_VALUE=\'\""${EPREFIX}"/usr/local/sbin:"${EPREFIX}"/usr/local/bin:"${EPREFIX}"/usr/sbin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/bin\"\' \
|
||||||
|
-DSTANDARD_UTILS_PATH=\'\""${EPREFIX}"/bin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/usr/sbin\"\' \
|
||||||
|
-DSYS_BASHRC=\'\""${EPREFIX}"/etc/bash/bashrc\"\' \
|
||||||
|
-DSYS_BASH_LOGOUT=\'\""${EPREFIX}"/etc/bash/bash_logout\"\' \
|
||||||
|
-DNON_INTERACTIVE_LOGIN_SHELLS \
|
||||||
|
-DSSH_SOURCE_BASHRC \
|
||||||
|
$(use bashlogger && echo -DSYSLOG_HISTORY)
|
||||||
|
|
||||||
|
use nls || myconf+=( --disable-nls )
|
||||||
|
|
||||||
|
if (( PLEVEL >= 0 )); then
|
||||||
|
# Historically, we always used the builtin readline, but since
|
||||||
|
# our handling of SONAME upgrades has gotten much more stable
|
||||||
|
# in the PM (and the readline ebuild itself preserves the old
|
||||||
|
# libs during upgrades), linking against the system copy should
|
||||||
|
# be safe.
|
||||||
|
# Exact cached version here doesn't really matter as long as it
|
||||||
|
# is at least what's in the DEPEND up above.
|
||||||
|
export ac_cv_rl_version=${READLINE_VER%%_*}
|
||||||
|
|
||||||
|
# Use system readline only with released versions.
|
||||||
|
myconf+=( --with-installed-readline=. )
|
||||||
|
fi
|
||||||
|
|
||||||
|
if use plugins; then
|
||||||
|
append-ldflags "-Wl,-rpath,${EPREFIX}/usr/$(get_libdir)/bash"
|
||||||
|
else
|
||||||
|
# Disable the plugins logic by hand since bash doesn't provide
|
||||||
|
# a way of doing it.
|
||||||
|
export ac_cv_func_dl{close,open,sym}=no \
|
||||||
|
ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
|
||||||
|
|
||||||
|
sed -i -e '/LOCAL_LDFLAGS=/s:-rdynamic::' configure || die
|
||||||
|
fi
|
||||||
|
|
||||||
|
# bug #444070
|
||||||
|
tc-export AR
|
||||||
|
|
||||||
|
econf "${myconf[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
src_compile() {
|
||||||
|
local -a pgo_generate_flags pgo_use_flags
|
||||||
|
local flag
|
||||||
|
|
||||||
|
# -fprofile-partial-training because upstream notes the test suite isn't
|
||||||
|
# super comprehensive.
|
||||||
|
# https://documentation.suse.com/sbp/all/html/SBP-GCC-10/index.html#sec-gcc10-pgo
|
||||||
|
if use pgo; then
|
||||||
|
pgo_generate_flags=(
|
||||||
|
-fprofile-update=atomic
|
||||||
|
-fprofile-dir="${T}"/pgo
|
||||||
|
-fprofile-generate="${T}"/pgo
|
||||||
|
)
|
||||||
|
pgo_use_flags=(
|
||||||
|
-fprofile-use="${T}"/pgo
|
||||||
|
-fprofile-dir="${T}"/pgo
|
||||||
|
)
|
||||||
|
if flag=$(test-flags-CC -fprofile-partial-training); then
|
||||||
|
pgo_generate_flags+=( "${flag}" )
|
||||||
|
pgo_use_flags+=( "${flag}" )
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
emake CFLAGS="${CFLAGS} ${pgo_generate_flags[*]}"
|
||||||
|
use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} ${pgo_generate_flags[*]}" all others
|
||||||
|
|
||||||
|
# Build Bash and run its tests to generate profiles.
|
||||||
|
if (( ${#pgo_generate_flags[@]} )); then
|
||||||
|
# Used in test suite.
|
||||||
|
unset -v A
|
||||||
|
|
||||||
|
emake CFLAGS="${CFLAGS} ${pgo_generate_flags[*]}" -k check
|
||||||
|
|
||||||
|
if tc-is-clang; then
|
||||||
|
llvm-profdata merge "${T}"/pgo --output="${T}"/pgo/default.profdata || die
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Rebuild Bash using the profiling data we just generated.
|
||||||
|
emake clean
|
||||||
|
emake CFLAGS="${CFLAGS} ${pgo_use_flags[*]}"
|
||||||
|
use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} ${pgo_use_flags[*]}" all others
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
src_test() {
|
||||||
|
# Used in test suite.
|
||||||
|
unset -v A
|
||||||
|
|
||||||
|
default
|
||||||
|
}
|
||||||
|
|
||||||
|
src_install() {
|
||||||
|
local d f
|
||||||
|
|
||||||
|
default
|
||||||
|
|
||||||
|
my_prefixify() {
|
||||||
|
while read -r; do
|
||||||
|
if [[ $REPLY == *$1* ]]; then
|
||||||
|
REPLY=${REPLY/"/etc/"/"${EPREFIX}/etc/"}
|
||||||
|
fi
|
||||||
|
printf '%s\n' "${REPLY}" || ! break
|
||||||
|
done < "$2" || die
|
||||||
|
}
|
||||||
|
|
||||||
|
dodir /bin
|
||||||
|
mv -- "${ED}"/usr/bin/bash "${ED}"/bin/ || die
|
||||||
|
dosym bash /bin/rbash
|
||||||
|
|
||||||
|
insinto /etc/bash
|
||||||
|
doins "${FILESDIR}"/bash_logout
|
||||||
|
my_prefixify bashrc.d "${FILESDIR}"/bashrc-r1 | newins - bashrc
|
||||||
|
|
||||||
|
insinto /etc/bash/bashrc.d
|
||||||
|
my_prefixify DIR_COLORS "${FILESDIR}"/bashrc.d/10-gentoo-color.bash | newins - 10-gentoo-color.bash
|
||||||
|
doins "${FILESDIR}"/bashrc.d/10-gentoo-title.bash
|
||||||
|
if [[ ! ${EPREFIX} ]]; then
|
||||||
|
doins "${FILESDIR}"/bashrc.d/15-gentoo-bashrc-check.bash
|
||||||
|
fi
|
||||||
|
|
||||||
|
insinto /etc/skel
|
||||||
|
for f in bash{_logout,_profile,rc}; do
|
||||||
|
newins "${FILESDIR}/dot-${f}" ".${f}"
|
||||||
|
done
|
||||||
|
|
||||||
|
if use plugins; then
|
||||||
|
exeinto "/usr/$(get_libdir)/bash"
|
||||||
|
set -- examples/loadables/*.o
|
||||||
|
doexe "${@%.o}"
|
||||||
|
|
||||||
|
insinto /usr/include/bash-plugins
|
||||||
|
doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if use examples; then
|
||||||
|
for d in examples/{functions,misc,scripts,startup-files}; do
|
||||||
|
exeinto "/usr/share/doc/${PF}/${d}"
|
||||||
|
docinto "${d}"
|
||||||
|
for f in "${d}"/*; do
|
||||||
|
if [[ ${f##*/} != @(PERMISSION|*README) ]]; then
|
||||||
|
doexe "${f}"
|
||||||
|
else
|
||||||
|
dodoc "${f}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install bash_builtins.1 and rbash.1.
|
||||||
|
emake -C doc DESTDIR="${D}" install_builtins
|
||||||
|
sed 's:bash\.1:man1/&:' doc/rbash.1 > "${T}"/rbash.1 || die
|
||||||
|
doman "${T}"/rbash.1
|
||||||
|
|
||||||
|
newdoc CWRU/changelog ChangeLog
|
||||||
|
dosym bash.info /usr/share/info/bashref.info
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_preinst() {
|
||||||
|
if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]]; then
|
||||||
|
mkdir -p -- "${EROOT}"/etc/bash \
|
||||||
|
&& mv -f -- "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/ \
|
||||||
|
|| die
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_postinst() {
|
||||||
|
local old_ver
|
||||||
|
|
||||||
|
# If /bin/sh does not exist, provide it.
|
||||||
|
if [[ ! -e ${EROOT}/bin/sh ]]; then
|
||||||
|
ln -sf -- bash "${EROOT}"/bin/sh || die
|
||||||
|
fi
|
||||||
|
|
||||||
|
read -r old_ver <<<"${REPLACING_VERSIONS}"
|
||||||
|
if [[ ! $old_ver ]]; then
|
||||||
|
:
|
||||||
|
elif ver_test "$old_ver" -ge "5.2" && ver_test "$old_ver" -ge "5.2_p26-r6"; then
|
||||||
|
return
|
||||||
|
elif ver_test "$old_ver" -lt "5.2" && ver_test "$old_ver" -ge "5.1_p16-r13"; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -r; do ewarn "${REPLY}"; done <<'EOF'
|
||||||
|
Files situated under /etc/bash/bashrc.d must now have a suffix of .sh or .bash.
|
||||||
|
|
||||||
|
Gentoo now defaults to defining PROMPT_COMMAND as an array. Depending on the
|
||||||
|
characteristics of the operating environment, this array may contain a command
|
||||||
|
to set the terminal's window title. Those already choosing to customise the
|
||||||
|
PROMPT_COMMAND variable are now advised to append their commands like so:
|
||||||
|
|
||||||
|
PROMPT_COMMAND+=('custom command goes here')
|
||||||
|
|
||||||
|
Gentoo no longer defaults to having bash manipulate the window title in the case
|
||||||
|
that the terminal is controlled by sshd(8), unless screen or tmux are in use.
|
||||||
|
Those wanting to set the title unconditionally may adjust ~/.bashrc - or create
|
||||||
|
a custom /etc/bash/bashrc.d drop-in - to set PROMPT_COMMMAND like so:
|
||||||
|
|
||||||
|
PROMPT_COMMAND=(genfun_set_win_title)
|
||||||
|
|
||||||
|
Those who would prefer for bash never to interfere with the window title may
|
||||||
|
now opt out of the default title setting behaviour, either with the "unset -v
|
||||||
|
PROMPT_COMMAND" command or by re-defining PROMPT_COMMAND as desired.
|
||||||
|
EOF
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright 1999-2023 Gentoo Authors
|
# Copyright 1999-2024 Gentoo Authors
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
EAPI=8
|
EAPI=8
|
||||||
@ -6,34 +6,31 @@ EAPI=8
|
|||||||
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/chetramey.asc
|
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/chetramey.asc
|
||||||
inherit flag-o-matic toolchain-funcs prefix verify-sig
|
inherit flag-o-matic toolchain-funcs prefix verify-sig
|
||||||
|
|
||||||
# Uncomment if we have a patchset
|
# Uncomment if we have a patchset.
|
||||||
#GENTOO_PATCH_DEV="sam"
|
#GENTOO_PATCH_DEV="sam"
|
||||||
#GENTOO_PATCH_VER="${PV}"
|
#GENTOO_PATCH_VER="${PV}"
|
||||||
|
|
||||||
# Official patchlevel
|
MY_PV=${PV/_p*}
|
||||||
# See ftp://ftp.cwru.edu/pub/bash/bash-5.1-patches/
|
MY_PV=${MY_PV/_/-}
|
||||||
PLEVEL="${PV##*_p}"
|
MY_P=${PN}-${MY_PV}
|
||||||
MY_PV="${PV/_p*}"
|
|
||||||
MY_PV="${MY_PV/_/-}"
|
|
||||||
MY_P="${PN}-${MY_PV}"
|
|
||||||
MY_PATCHES=()
|
MY_PATCHES=()
|
||||||
|
|
||||||
is_release() {
|
# Determine the patchlevel.
|
||||||
case ${PV} in
|
case ${PV} in
|
||||||
|
*_p*)
|
||||||
|
PLEVEL=${PV##*_p}
|
||||||
|
;;
|
||||||
9999|*_alpha*|*_beta*|*_rc*)
|
9999|*_alpha*|*_beta*|*_rc*)
|
||||||
return 1
|
# Set a negative patchlevel to indicate that it's a pre-release.
|
||||||
|
PLEVEL=-1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
return 0
|
PLEVEL=0
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
}
|
|
||||||
|
|
||||||
[[ ${PV} != *_p* ]] && PLEVEL=0
|
# The version of readline this bash normally ships with. Note that we only use
|
||||||
|
# the bundled copy of readline for pre-releases.
|
||||||
# The version of readline this bash normally ships with.
|
READLINE_VER="8.3_alpha"
|
||||||
# Note: right now, we don't use the system copy of readline for bash for non-releases.
|
|
||||||
READLINE_VER="8.2_p1"
|
|
||||||
|
|
||||||
DESCRIPTION="The standard GNU Bourne again shell"
|
DESCRIPTION="The standard GNU Bourne again shell"
|
||||||
HOMEPAGE="https://tiswww.case.edu/php/chet/bash/bashtop.html https://git.savannah.gnu.org/cgit/bash.git"
|
HOMEPAGE="https://tiswww.case.edu/php/chet/bash/bashtop.html https://git.savannah.gnu.org/cgit/bash.git"
|
||||||
@ -42,48 +39,32 @@ if [[ ${PV} == 9999 ]] ; then
|
|||||||
EGIT_REPO_URI="https://git.savannah.gnu.org/git/bash.git"
|
EGIT_REPO_URI="https://git.savannah.gnu.org/git/bash.git"
|
||||||
EGIT_BRANCH=devel
|
EGIT_BRANCH=devel
|
||||||
inherit git-r3
|
inherit git-r3
|
||||||
elif is_release ; then
|
else
|
||||||
SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz"
|
my_urls=( {'mirror://gnu/bash','ftp://ftp.cwru.edu/pub/bash'}/"${MY_P}.tar.gz" )
|
||||||
SRC_URI+=" verify-sig? ( mirror://gnu/bash/${MY_P}.tar.gz.sig )"
|
|
||||||
|
|
||||||
if [[ ${PLEVEL} -gt 0 ]] ; then
|
|
||||||
# bash-5.1 -> bash51
|
# bash-5.1 -> bash51
|
||||||
my_p=${PN}$(ver_rs 1-2 '' $(ver_cut 1-2))
|
my_p=${PN}$(ver_cut 1-2) my_p=${my_p/.}
|
||||||
|
|
||||||
patch_url=
|
for (( my_patch_idx = 1; my_patch_idx <= PLEVEL; my_patch_idx++ )); do
|
||||||
my_patch_index=
|
printf -v my_patch_ver %s-%03d "${my_p}" "${my_patch_idx}"
|
||||||
|
my_urls+=( {'mirror://gnu/bash','ftp://ftp.cwru.edu/pub/bash'}/"${MY_P}-patches/${my_patch_ver}" )
|
||||||
upstream_url_base="mirror://gnu/bash"
|
MY_PATCHES+=( "${DISTDIR}/${my_patch_ver}" )
|
||||||
mirror_url_base="ftp://ftp.cwru.edu/pub/bash"
|
|
||||||
|
|
||||||
for ((my_patch_index=1; my_patch_index <= ${PLEVEL} ; my_patch_index++)) ; do
|
|
||||||
printf -v mangled_patch_ver ${my_p}-%03d ${my_patch_index}
|
|
||||||
patch_url="${upstream_url_base}/${MY_P}-patches/${mangled_patch_ver}"
|
|
||||||
|
|
||||||
SRC_URI+=" ${patch_url}"
|
|
||||||
SRC_URI+=" verify-sig? ( ${patch_url}.sig )"
|
|
||||||
|
|
||||||
# Add in the mirror URL too.
|
|
||||||
SRC_URI+=" ${patch_url/${upstream_url_base}/${mirror_url_base}}"
|
|
||||||
SRC_URI+=" verify-sig? ( ${patch_url/${upstream_url_base}/${mirror_url_base}} )"
|
|
||||||
|
|
||||||
MY_PATCHES+=( "${DISTDIR}"/${mangled_patch_ver} )
|
|
||||||
done
|
done
|
||||||
|
|
||||||
unset my_p patch_url my_patch_index upstream_url_base mirror_url_base
|
SRC_URI="${my_urls[*]} verify-sig? ( ${my_urls[*]/%/.sig} )"
|
||||||
fi
|
|
||||||
else
|
unset -v my_urls my_p my_patch_idx my_patch_ver
|
||||||
SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
|
|
||||||
SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${MY_P}.tar.gz.sig ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz.sig )"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n ${GENTOO_PATCH_VER} ]] ; then
|
if [[ ${GENTOO_PATCH_VER} ]]; then
|
||||||
SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
|
SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV:?}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER:?}-patches.tar.xz"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
S=${WORKDIR}/${MY_P}
|
||||||
|
|
||||||
LICENSE="GPL-3+"
|
LICENSE="GPL-3+"
|
||||||
SLOT="0"
|
SLOT="0"
|
||||||
if is_release ; then
|
if (( PLEVEL >= 0 )); then
|
||||||
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"
|
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"
|
||||||
fi
|
fi
|
||||||
IUSE="afs bashlogger examples mem-scramble +net nls plugins pgo +readline"
|
IUSE="afs bashlogger examples mem-scramble +net nls plugins pgo +readline"
|
||||||
@ -92,29 +73,26 @@ DEPEND="
|
|||||||
>=sys-libs/ncurses-5.2-r2:=
|
>=sys-libs/ncurses-5.2-r2:=
|
||||||
nls? ( virtual/libintl )
|
nls? ( virtual/libintl )
|
||||||
"
|
"
|
||||||
if is_release ; then
|
if (( PLEVEL >= 0 )); then
|
||||||
DEPEND+=" readline? ( >=sys-libs/readline-${READLINE_VER}:= )"
|
DEPEND+=" readline? ( >=sys-libs/readline-${READLINE_VER}:= )"
|
||||||
fi
|
fi
|
||||||
RDEPEND="
|
RDEPEND="
|
||||||
${DEPEND}
|
${DEPEND}
|
||||||
"
|
"
|
||||||
# We only need bison (yacc) when the .y files get patched (bash42-005, bash51-011)
|
# We only need bison (yacc) when the .y files get patched (bash42-005, bash51-011).
|
||||||
BDEPEND="
|
BDEPEND="
|
||||||
sys-devel/bison
|
|
||||||
pgo? ( dev-util/gperf )
|
pgo? ( dev-util/gperf )
|
||||||
verify-sig? ( sec-keys/openpgp-keys-chetramey )
|
verify-sig? ( sec-keys/openpgp-keys-chetramey )
|
||||||
"
|
"
|
||||||
|
|
||||||
S="${WORKDIR}/${MY_P}"
|
# EAPI 8 tries to append it but it doesn't exist here.
|
||||||
|
|
||||||
# EAPI 8 tries to append it but it doesn't exist here
|
|
||||||
QA_CONFIGURE_OPTIONS="--disable-static"
|
QA_CONFIGURE_OPTIONS="--disable-static"
|
||||||
|
|
||||||
PATCHES=(
|
PATCHES=(
|
||||||
#"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}/
|
#"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}/
|
||||||
|
|
||||||
# Patches from Chet sent to bash-bug ml
|
# Patches to or from Chet, posted to the bug-bash mailing list.
|
||||||
"${FILESDIR}"/${PN}-5.0-syslog-history-extern.patch
|
"${FILESDIR}/${PN}-5.0-syslog-history-extern.patch"
|
||||||
)
|
)
|
||||||
|
|
||||||
pkg_setup() {
|
pkg_setup() {
|
||||||
@ -132,43 +110,47 @@ pkg_setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
src_unpack() {
|
src_unpack() {
|
||||||
|
local patch
|
||||||
|
|
||||||
if [[ ${PV} == 9999 ]]; then
|
if [[ ${PV} == 9999 ]]; then
|
||||||
git-r3_src_unpack
|
git-r3_src_unpack
|
||||||
else
|
else
|
||||||
if use verify-sig; then
|
if use verify-sig; then
|
||||||
verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.gz{,.sig}
|
verify-sig_verify_detached "${DISTDIR}/${MY_P}.tar.gz"{,.sig}
|
||||||
|
|
||||||
local patch
|
|
||||||
for patch in "${MY_PATCHES[@]}"; do
|
for patch in "${MY_PATCHES[@]}"; do
|
||||||
verify-sig_verify_detached ${patch}{,.sig}
|
verify-sig_verify_detached "${patch}"{,.sig}
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unpack ${MY_P}.tar.gz
|
unpack "${MY_P}.tar.gz"
|
||||||
|
|
||||||
if [[ -n ${GENTOO_PATCH_VER} ]] ; then
|
if [[ ${GENTOO_PATCH_VER} ]]; then
|
||||||
unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
|
unpack "${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
src_prepare() {
|
src_prepare() {
|
||||||
# Include official patches
|
# Include official patches.
|
||||||
[[ ${PLEVEL} -gt 0 ]] && eapply -p0 "${MY_PATCHES[@]}"
|
(( PLEVEL > 0 )) && eapply -p0 "${MY_PATCHES[@]}"
|
||||||
|
|
||||||
# Clean out local libs so we know we use system ones w/releases.
|
# Clean out local libs so we know we use system ones w/releases. The
|
||||||
if is_release ; then
|
# touch utility is invoked for the benefit of config.status.
|
||||||
rm -rf lib/{readline,termcap}/* || die
|
if (( PLEVEL >= 0 )); then
|
||||||
touch lib/{readline,termcap}/Makefile.in || die # for config.status
|
rm -rf lib/{readline,termcap}/* \
|
||||||
sed -ri -e 's:\$[{(](RL|HIST)_LIBSRC[)}]/[[:alpha:]_-]*\.h::g' Makefile.in || die
|
&& touch lib/{readline,termcap}/Makefile.in \
|
||||||
|
&& sed -i -E 's:\$[{(](RL|HIST)_LIBSRC[)}]/[[:alpha:]_-]*\.h::g' Makefile.in \
|
||||||
|
|| die
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Prefixify hardcoded path names. No-op for non-prefix.
|
# Prefixify hardcoded path names. No-op for non-prefix.
|
||||||
hprefixify pathnames.h.in
|
hprefixify pathnames.h.in
|
||||||
|
|
||||||
# Avoid regenerating docs after patches, bug #407985
|
# Avoid regenerating docs after patches, bug #407985.
|
||||||
sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
|
sed -i -E '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in \
|
||||||
touch -r . doc/* || die
|
&& touch -r . doc/* \
|
||||||
|
|| die
|
||||||
|
|
||||||
# Sometimes hangs (more noticeable w/ pgo), bug #907403.
|
# Sometimes hangs (more noticeable w/ pgo), bug #907403.
|
||||||
rm tests/run-jobs || die
|
rm tests/run-jobs || die
|
||||||
@ -178,14 +160,20 @@ src_prepare() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
src_configure() {
|
src_configure() {
|
||||||
|
local -a myconf
|
||||||
|
|
||||||
# Upstream only test with Bison and require GNUisms like YYEOF and
|
# Upstream only test with Bison and require GNUisms like YYEOF and
|
||||||
# YYERRCODE. The former at least may be in POSIX soon:
|
# YYERRCODE. The former at least may be in POSIX soon:
|
||||||
# https://www.austingroupbugs.net/view.php?id=1269.
|
# https://www.austingroupbugs.net/view.php?id=1269.
|
||||||
# configure warns on use of non-Bison but doesn't abort. The result
|
# configure warns on use of non-Bison but doesn't abort. The result
|
||||||
# may misbehave at runtime.
|
# may misbehave at runtime.
|
||||||
unset YACC
|
unset -v YACC
|
||||||
|
|
||||||
local myconf=(
|
# wcsnwidth(), substring() issues with -Wlto-type-mismatch, reported
|
||||||
|
# upstream to Chet by email.
|
||||||
|
filter-lto
|
||||||
|
|
||||||
|
myconf=(
|
||||||
--disable-profiling
|
--disable-profiling
|
||||||
|
|
||||||
# Force linking with system curses ... the bundled termcap lib
|
# Force linking with system curses ... the bundled termcap lib
|
||||||
@ -203,7 +191,7 @@ src_configure() {
|
|||||||
$(use_with mem-scramble bash-malloc)
|
$(use_with mem-scramble bash-malloc)
|
||||||
)
|
)
|
||||||
|
|
||||||
# For descriptions of these, see config-top.h
|
# For descriptions of these, see config-top.h.
|
||||||
# bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
|
# bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
|
||||||
append-cppflags \
|
append-cppflags \
|
||||||
-DDEFAULT_PATH_VALUE=\'\""${EPREFIX}"/usr/local/sbin:"${EPREFIX}"/usr/local/bin:"${EPREFIX}"/usr/sbin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/bin\"\' \
|
-DDEFAULT_PATH_VALUE=\'\""${EPREFIX}"/usr/local/sbin:"${EPREFIX}"/usr/local/bin:"${EPREFIX}"/usr/sbin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/bin\"\' \
|
||||||
@ -214,13 +202,9 @@ src_configure() {
|
|||||||
-DSSH_SOURCE_BASHRC \
|
-DSSH_SOURCE_BASHRC \
|
||||||
$(use bashlogger && echo -DSYSLOG_HISTORY)
|
$(use bashlogger && echo -DSYSLOG_HISTORY)
|
||||||
|
|
||||||
# Don't even think about building this statically without
|
|
||||||
# reading bug #7714 first. If you still build it statically,
|
|
||||||
# don't come crying to us with bugs ;).
|
|
||||||
#use static && export LDFLAGS="${LDFLAGS} -static"
|
|
||||||
use nls || myconf+=( --disable-nls )
|
use nls || myconf+=( --disable-nls )
|
||||||
|
|
||||||
if is_release ; then
|
if (( PLEVEL >= 0 )); then
|
||||||
# Historically, we always used the builtin readline, but since
|
# Historically, we always used the builtin readline, but since
|
||||||
# our handling of SONAME upgrades has gotten much more stable
|
# our handling of SONAME upgrades has gotten much more stable
|
||||||
# in the PM (and the readline ebuild itself preserves the old
|
# in the PM (and the readline ebuild itself preserves the old
|
||||||
@ -235,16 +219,14 @@ src_configure() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if use plugins; then
|
if use plugins; then
|
||||||
append-ldflags -Wl,-rpath,"${EPREFIX}"/usr/$(get_libdir)/bash
|
append-ldflags "-Wl,-rpath,${EPREFIX}/usr/$(get_libdir)/bash"
|
||||||
else
|
else
|
||||||
# Disable the plugins logic by hand since bash doesn't
|
# Disable the plugins logic by hand since bash doesn't provide
|
||||||
# provide a way of doing it.
|
# a way of doing it.
|
||||||
export ac_cv_func_dl{close,open,sym}=no \
|
export ac_cv_func_dl{close,open,sym}=no \
|
||||||
ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
|
ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
|
||||||
|
|
||||||
sed -i \
|
sed -i -e '/LOCAL_LDFLAGS=/s:-rdynamic::' configure || die
|
||||||
-e '/LOCAL_LDFLAGS=/s:-rdynamic::' \
|
|
||||||
configure || die
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# bug #444070
|
# bug #444070
|
||||||
@ -254,20 +236,37 @@ src_configure() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
src_compile() {
|
src_compile() {
|
||||||
# -fprofile-partial-training because upstream note the test suite isn't super comprehensive
|
local -a pgo_generate_flags pgo_use_flags
|
||||||
# See https://documentation.suse.com/sbp/all/html/SBP-GCC-10/index.html#sec-gcc10-pgo
|
local flag
|
||||||
local pgo_generate_flags=$(usev pgo "-fprofile-update=atomic -fprofile-dir=${T}/pgo -fprofile-generate=${T}/pgo $(test-flags-CC -fprofile-partial-training)")
|
|
||||||
local pgo_use_flags=$(usev pgo "-fprofile-use=${T}/pgo -fprofile-dir=${T}/pgo $(test-flags-CC -fprofile-partial-training)")
|
|
||||||
|
|
||||||
emake CFLAGS="${CFLAGS} ${pgo_generate_flags}"
|
# -fprofile-partial-training because upstream notes the test suite isn't
|
||||||
use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} ${pgo_generate_flags}" all others
|
# super comprehensive.
|
||||||
|
# https://documentation.suse.com/sbp/all/html/SBP-GCC-10/index.html#sec-gcc10-pgo
|
||||||
|
if use pgo; then
|
||||||
|
pgo_generate_flags=(
|
||||||
|
-fprofile-update=atomic
|
||||||
|
-fprofile-dir="${T}"/pgo
|
||||||
|
-fprofile-generate="${T}"/pgo
|
||||||
|
)
|
||||||
|
pgo_use_flags=(
|
||||||
|
-fprofile-use="${T}"/pgo
|
||||||
|
-fprofile-dir="${T}"/pgo
|
||||||
|
)
|
||||||
|
if flag=$(test-flags-CC -fprofile-partial-training); then
|
||||||
|
pgo_generate_flags+=( "${flag}" )
|
||||||
|
pgo_use_flags+=( "${flag}" )
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
emake CFLAGS="${CFLAGS} ${pgo_generate_flags[*]}"
|
||||||
|
use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} ${pgo_generate_flags[*]}" all others
|
||||||
|
|
||||||
# Build Bash and run its tests to generate profiles.
|
# Build Bash and run its tests to generate profiles.
|
||||||
if use pgo ; then
|
if (( ${#pgo_generate_flags[@]} )); then
|
||||||
# Used in test suite.
|
# Used in test suite.
|
||||||
unset A
|
unset -v A
|
||||||
|
|
||||||
emake CFLAGS="${CFLAGS} ${pgo_generate_flags}" -k check
|
emake CFLAGS="${CFLAGS} ${pgo_generate_flags[*]}" -k check
|
||||||
|
|
||||||
if tc-is-clang; then
|
if tc-is-clang; then
|
||||||
llvm-profdata merge "${T}"/pgo --output="${T}"/pgo/default.profdata || die
|
llvm-profdata merge "${T}"/pgo --output="${T}"/pgo/default.profdata || die
|
||||||
@ -275,14 +274,14 @@ src_compile() {
|
|||||||
|
|
||||||
# Rebuild Bash using the profiling data we just generated.
|
# Rebuild Bash using the profiling data we just generated.
|
||||||
emake clean
|
emake clean
|
||||||
emake CFLAGS="${CFLAGS} ${pgo_use_flags}"
|
emake CFLAGS="${CFLAGS} ${pgo_use_flags[*]}"
|
||||||
use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} ${pgo_use_flags}" all others
|
use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} ${pgo_use_flags[*]}" all others
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
src_test() {
|
src_test() {
|
||||||
# Used in test suite.
|
# Used in test suite.
|
||||||
unset A
|
unset -v A
|
||||||
|
|
||||||
default
|
default
|
||||||
}
|
}
|
||||||
@ -292,42 +291,39 @@ src_install() {
|
|||||||
|
|
||||||
default
|
default
|
||||||
|
|
||||||
|
my_prefixify() {
|
||||||
|
while read -r; do
|
||||||
|
if [[ $REPLY == *$1* ]]; then
|
||||||
|
REPLY=${REPLY/"/etc/"/"${EPREFIX}/etc/"}
|
||||||
|
fi
|
||||||
|
printf '%s\n' "${REPLY}" || ! break
|
||||||
|
done < "$2" || die
|
||||||
|
}
|
||||||
|
|
||||||
dodir /bin
|
dodir /bin
|
||||||
mv "${ED}"/usr/bin/bash "${ED}"/bin/ || die
|
mv -- "${ED}"/usr/bin/bash "${ED}"/bin/ || die
|
||||||
dosym bash /bin/rbash
|
dosym bash /bin/rbash
|
||||||
|
|
||||||
insinto /etc/bash
|
insinto /etc/bash
|
||||||
doins "${FILESDIR}"/bash_logout
|
doins "${FILESDIR}"/bash_logout
|
||||||
doins "$(prefixify_ro "${FILESDIR}"/bashrc)"
|
my_prefixify bashrc.d "${FILESDIR}"/bashrc-r1 | newins - bashrc
|
||||||
|
|
||||||
keepdir /etc/bash/bashrc.d
|
insinto /etc/bash/bashrc.d
|
||||||
|
my_prefixify DIR_COLORS "${FILESDIR}"/bashrc.d/10-gentoo-color.bash | newins - 10-gentoo-color.bash
|
||||||
|
doins "${FILESDIR}"/bashrc.d/10-gentoo-title.bash
|
||||||
|
if [[ ! ${EPREFIX} ]]; then
|
||||||
|
doins "${FILESDIR}"/bashrc.d/15-gentoo-bashrc-check.bash
|
||||||
|
fi
|
||||||
|
|
||||||
insinto /etc/skel
|
insinto /etc/skel
|
||||||
for f in bash{_logout,_profile,rc}; do
|
for f in bash{_logout,_profile,rc}; do
|
||||||
newins "${FILESDIR}"/dot-${f} .${f}
|
newins "${FILESDIR}/dot-${f}" ".${f}"
|
||||||
done
|
done
|
||||||
|
|
||||||
local sed_args=(
|
|
||||||
-e 's:#GNU#@::'
|
|
||||||
-e '/#@/d'
|
|
||||||
)
|
|
||||||
|
|
||||||
if ! use readline ; then
|
|
||||||
# bug #432338
|
|
||||||
sed_args+=(
|
|
||||||
-e '/^shopt -s histappend/s:^:#:'
|
|
||||||
-e 's:use_color=true:use_color=false:'
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
|
|
||||||
sed -i \
|
|
||||||
"${sed_args[@]}" \
|
|
||||||
"${ED}"/etc/skel/.bashrc \
|
|
||||||
"${ED}"/etc/bash/bashrc || die
|
|
||||||
|
|
||||||
if use plugins; then
|
if use plugins; then
|
||||||
exeinto /usr/$(get_libdir)/bash
|
exeinto "/usr/$(get_libdir)/bash"
|
||||||
doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
|
set -- examples/loadables/*.o
|
||||||
|
doexe "${@%.o}"
|
||||||
|
|
||||||
insinto /usr/include/bash-plugins
|
insinto /usr/include/bash-plugins
|
||||||
doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
|
doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
|
||||||
@ -335,19 +331,19 @@ src_install() {
|
|||||||
|
|
||||||
if use examples; then
|
if use examples; then
|
||||||
for d in examples/{functions,misc,scripts,startup-files}; do
|
for d in examples/{functions,misc,scripts,startup-files}; do
|
||||||
exeinto /usr/share/doc/${PF}/${d}
|
exeinto "/usr/share/doc/${PF}/${d}"
|
||||||
docinto ${d}
|
docinto "${d}"
|
||||||
for f in ${d}/* ; do
|
for f in "${d}"/*; do
|
||||||
if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
|
if [[ ${f##*/} != @(PERMISSION|*README) ]]; then
|
||||||
doexe ${f}
|
doexe "${f}"
|
||||||
else
|
else
|
||||||
dodoc ${f}
|
dodoc "${f}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install bash_builtins.1 and rbash.1
|
# Install bash_builtins.1 and rbash.1.
|
||||||
emake -C doc DESTDIR="${D}" install_builtins
|
emake -C doc DESTDIR="${D}" install_builtins
|
||||||
sed 's:bash\.1:man1/&:' doc/rbash.1 > "${T}"/rbash.1 || die
|
sed 's:bash\.1:man1/&:' doc/rbash.1 > "${T}"/rbash.1 || die
|
||||||
doman "${T}"/rbash.1
|
doman "${T}"/rbash.1
|
||||||
@ -358,14 +354,48 @@ src_install() {
|
|||||||
|
|
||||||
pkg_preinst() {
|
pkg_preinst() {
|
||||||
if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]]; then
|
if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]]; then
|
||||||
mkdir -p "${EROOT}"/etc/bash
|
mkdir -p -- "${EROOT}"/etc/bash \
|
||||||
mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
|
&& mv -f -- "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/ \
|
||||||
|
|| die
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_postinst() {
|
pkg_postinst() {
|
||||||
# If /bin/sh does not exist, provide it
|
local old_ver
|
||||||
|
|
||||||
|
# If /bin/sh does not exist, provide it.
|
||||||
if [[ ! -e ${EROOT}/bin/sh ]]; then
|
if [[ ! -e ${EROOT}/bin/sh ]]; then
|
||||||
ln -sf bash "${EROOT}"/bin/sh
|
ln -sf -- bash "${EROOT}"/bin/sh || die
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
read -r old_ver <<<"${REPLACING_VERSIONS}"
|
||||||
|
if [[ ! $old_ver ]]; then
|
||||||
|
:
|
||||||
|
elif ver_test "$old_ver" -ge "5.2" && ver_test "$old_ver" -ge "5.2_p26-r6"; then
|
||||||
|
return
|
||||||
|
elif ver_test "$old_ver" -lt "5.2" && ver_test "$old_ver" -ge "5.1_p16-r13"; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -r; do ewarn "${REPLY}"; done <<'EOF'
|
||||||
|
Files situated under /etc/bash/bashrc.d must now have a suffix of .sh or .bash.
|
||||||
|
|
||||||
|
Gentoo now defaults to defining PROMPT_COMMAND as an array. Depending on the
|
||||||
|
characteristics of the operating environment, this array may contain a command
|
||||||
|
to set the terminal's window title. Those already choosing to customise the
|
||||||
|
PROMPT_COMMAND variable are now advised to append their commands like so:
|
||||||
|
|
||||||
|
PROMPT_COMMAND+=('custom command goes here')
|
||||||
|
|
||||||
|
Gentoo no longer defaults to having bash manipulate the window title in the case
|
||||||
|
that the terminal is controlled by sshd(8), unless screen or tmux are in use.
|
||||||
|
Those wanting to set the title unconditionally may adjust ~/.bashrc - or create
|
||||||
|
a custom /etc/bash/bashrc.d drop-in - to set PROMPT_COMMMAND like so:
|
||||||
|
|
||||||
|
PROMPT_COMMAND=(genfun_set_win_title)
|
||||||
|
|
||||||
|
Those who would prefer for bash never to interfere with the window title may
|
||||||
|
now opt out of the default title setting behaviour, either with the "unset -v
|
||||||
|
PROMPT_COMMAND" command or by re-defining PROMPT_COMMAND as desired.
|
||||||
|
EOF
|
||||||
}
|
}
|
||||||
|
@ -5,15 +5,23 @@ if [[ $- != *i* ]]; then
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Disable completion when the input buffer is empty. Requires readline support.
|
# Disable errexit in case the user enabled it then chose to re-source this file.
|
||||||
shopt -s no_empty_cmd_completion 2>/dev/null
|
shopt -u -o errexit
|
||||||
|
|
||||||
# Append to HISTFILE rather than overwrite upon exiting, per bug #139609.
|
# Disable completion when the input buffer is empty. Mute STDERR because this
|
||||||
|
# option is only present in the case that bash was built with readline support.
|
||||||
|
shopt -s no_empty_cmd_completion 2>/dev/null &&
|
||||||
|
|
||||||
|
# Append to HISTFILE rather than overwrite upon exiting, per bug #139609. This
|
||||||
|
# option also requires for bash to have been built with readline support.
|
||||||
shopt -s histappend
|
shopt -s histappend
|
||||||
|
|
||||||
# Initialise PROMPT_COMMAND as an array, which is permitted as of bash 5.1.
|
# Initialise PROMPT_COMMAND as an array, which is permitted as of bash 5.1.
|
||||||
PROMPT_COMMAND=()
|
PROMPT_COMMAND=()
|
||||||
|
|
||||||
|
# Don't let the user influence the order of sourcing for bash 5.3 or greater.
|
||||||
|
unset -v GLOBSORT
|
||||||
|
|
||||||
for _ in /etc/bash/bashrc.d/*; do
|
for _ in /etc/bash/bashrc.d/*; do
|
||||||
if [[ $_ == *.@(bash|sh) && -r $_ ]]; then
|
if [[ $_ == *.@(bash|sh) && -r $_ ]]; then
|
||||||
source "$_"
|
source "$_"
|
||||||
|
@ -34,7 +34,8 @@ elif (( gentoo_color == 16777216 )); then
|
|||||||
export COLORTERM=truecolor
|
export COLORTERM=truecolor
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( gentoo_color <= 0 )); then
|
# For direxpand to be missing indicates that bash is lacking readline support.
|
||||||
|
if (( gentoo_color <= 0 )) || [[ ! $(shopt -p direxpand 2>/dev/null) ]]; then
|
||||||
# Define a prompt without color.
|
# Define a prompt without color.
|
||||||
PS1='\u@\h \w \$ '
|
PS1='\u@\h \w \$ '
|
||||||
elif (( EUID == 0 )); then
|
elif (( EUID == 0 )); then
|
||||||
@ -46,8 +47,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if (( gentoo_color > 0 )); then
|
if (( gentoo_color > 0 )); then
|
||||||
# Colorize the output of grep and several coreutils utilities.
|
# Colorize the output of diff(1), grep(1) and a few coreutils utilities.
|
||||||
for _ in diff dir egrep fgrep grep ls vdir; do
|
for _ in diff dir grep ls vdir; do
|
||||||
alias "$_=$_ --color=auto"
|
alias "$_=$_ --color=auto"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -1,29 +1,10 @@
|
|||||||
# /etc/bash/bashrc.d/10-gentoo-title.bash
|
# /etc/bash/bashrc.d/10-gentoo-title.bash
|
||||||
|
|
||||||
# Set window title with the Title Definition String sequence. For screen, the
|
genfun_set_win_title() {
|
||||||
# sequence defines the window title (%t) and for tmux, the pane_title (#T).
|
# Assigns the basename of the current working directory, having
|
||||||
# For tmux to be affected requires that its allow-rename option be enabled.
|
# sanitised it with @Q parameter expansion. Useful for paths containing
|
||||||
# https://www.gnu.org/software/screen/manual/html_node/Control-Sequences.html
|
# newlines and such. As a special case, names consisting entirely of
|
||||||
case ${TERM} in
|
# graphemes shall not undergo the expansion, for reasons of cleanliness.
|
||||||
screen*|tmux*)
|
|
||||||
genfun_set_pane_title() {
|
|
||||||
printf '\033k%s\033\\' "${HOSTNAME%%.*}"
|
|
||||||
}
|
|
||||||
PROMPT_COMMAND+=('genfun_set_pane_title')
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# If the TTY is that of sshd(8) then proceed no further. Alas,
|
|
||||||
# there exist many operating environments in which the window
|
|
||||||
# title would otherwise not be restored upon ssh(1) exiting.
|
|
||||||
if [[ ${SSH_TTY} && ${SSH_TTY} == "$(tty)" ]]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Assigns the basename of the current working directory, having sanitised it
|
|
||||||
# with @Q parameter expansion. Useful for paths containing newlines and such.
|
|
||||||
# As a special case, names consisting entirely of graphemes shall not undergo
|
|
||||||
# the parameter expansion, for reasons of cleanliness.
|
|
||||||
genfun_sanitise_cwd() {
|
genfun_sanitise_cwd() {
|
||||||
_cwd=${PWD##*/}
|
_cwd=${PWD##*/}
|
||||||
if [[ ! ${_cwd} ]]; then
|
if [[ ! ${_cwd} ]]; then
|
||||||
@ -33,9 +14,28 @@ genfun_sanitise_cwd() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set window title with the Set Text Parameters sequence. For screen, the
|
# Sets the window title with the Set Text Parameters sequence. For
|
||||||
# sequence defines the hardstatus (%h) and for tmux, the window_name (#W).
|
# screen, the sequence defines the hardstatus (%h) and for tmux, the
|
||||||
# For graphical terminal emulators, it is normal for the title bar be affected.
|
# pane_title (#T). For graphical terminal emulators, it is normal for
|
||||||
|
# the title bar to be affected.
|
||||||
|
genfun_set_win_title() {
|
||||||
|
genfun_sanitise_cwd
|
||||||
|
printf '\033]0;%s@%s - %s\007' "${USER}" "${HOSTNAME%%.*}" "${_cwd}"
|
||||||
|
}
|
||||||
|
|
||||||
|
genfun_set_win_title
|
||||||
|
}
|
||||||
|
|
||||||
|
# Proceed no further if the TTY is that of sshd(8) and if not running a terminal
|
||||||
|
# multiplexer. Alas, there exist many operating environments in which the window
|
||||||
|
# title would otherwise not be restored upon ssh(1) exiting. Those who wish for
|
||||||
|
# the title to be set unconditionally may adjust ~/.bashrc - or create a custom
|
||||||
|
# bashrc.d drop-in - to define PROMPT_COMMAND=(genfun_set_win_title).
|
||||||
|
if [[ ${SSH_TTY} && ${TERM} != @(screen|tmux)* && ${SSH_TTY} == "$(tty)" ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Determine whether the terminal can handle the Set Text Parameters sequence.
|
||||||
# The only terminals permitted here are those for which there is empirical
|
# The only terminals permitted here are those for which there is empirical
|
||||||
# evidence that the sequence is supported and that the UTF-8 character encoding
|
# evidence that the sequence is supported and that the UTF-8 character encoding
|
||||||
# is handled correctly. Quite rightly, this precludes many vintage terminals.
|
# is handled correctly. Quite rightly, this precludes many vintage terminals.
|
||||||
@ -45,11 +45,8 @@ case ${TERM} in
|
|||||||
foot* |\
|
foot* |\
|
||||||
rxvt-unicode* |\
|
rxvt-unicode* |\
|
||||||
screen* |\
|
screen* |\
|
||||||
|
st-256color |\
|
||||||
tmux* |\
|
tmux* |\
|
||||||
xterm* )
|
xterm* )
|
||||||
genfun_set_win_title() {
|
|
||||||
genfun_sanitise_cwd
|
|
||||||
printf '\033]2;%s@%s - %s\007' "${USER}" "${HOSTNAME%%.*}" "${_cwd}"
|
|
||||||
}
|
|
||||||
PROMPT_COMMAND+=('genfun_set_win_title')
|
PROMPT_COMMAND+=('genfun_set_win_title')
|
||||||
esac
|
esac
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
# /etc/bash/bashrc.d/15-gentoo-bashrc-check.bash
|
||||||
|
|
||||||
|
# Some users have ~/.bashrc as a copy of ${FILESDIR}/bashrc which either matches
|
||||||
|
# exactly or is only trivially modified. Such is an improper state of affairs
|
||||||
|
# and results in the bashrc.d drop-ins being sourced twice. Warn them that they
|
||||||
|
# should use the skeleton file instead. This drop-in should be removed no sooner
|
||||||
|
# than one year from the date of its introduction.
|
||||||
|
|
||||||
|
if [[ -e ${TMPDIR:-/tmp}/.gentoo-bashrc-check-${EUID} || ! -f ~/.bashrc ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
{
|
||||||
|
if grep -qxF 'for sh in /etc/bash/bashrc.d/* ; do' -- ~/.bashrc; then
|
||||||
|
cat >&3 <<'EOF'
|
||||||
|
WARNING! Your ~/.bashrc file is based on an old copy of /etc/bash/bashrc, which
|
||||||
|
is not intended for use within a home directory. Please either delete ~/.bashrc
|
||||||
|
or replace it with a copy of /etc/skel/.bashrc before optionally customizing it
|
||||||
|
further. Neglecting to do so may result in bash behaving unexpectedly.
|
||||||
|
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
touch -- "${TMPDIR:-/tmp}/.gentoo-bashrc-check-${EUID}"
|
||||||
|
} 3>&2 2>/dev/null
|
Loading…
x
Reference in New Issue
Block a user