*/*: Discontinue Gentoo SuperH port
[gentoo.git] / app-shells / bash / bash-2.05b_p13.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="4"
5
6 inherit eutils flag-o-matic toolchain-funcs
7
8 # Official patchlevel
9 # See ftp://ftp.cwru.edu/pub/bash/bash-2.05b-patches/
10 PLEVEL=${PV##*_p}
11 MY_PV=${PV/_p*}
12 MY_PV=${MY_PV/_/-}
13 MY_P=${PN}-${MY_PV}
14 [[ ${PV} != *_p* ]] && PLEVEL=0
15 patches() {
16         local opt=$1 plevel=${2:-${PLEVEL}} pn=${3:-${PN}} pv=${4:-${MY_PV}}
17         [[ ${plevel} -eq 0 ]] && return 1
18         eval set -- {1..${plevel}}
19         set -- $(printf "${pn}${pv/\.}-%03d " "$@")
20         if [[ ${opt} == -s ]] ; then
21                 echo "${@/#/${DISTDIR}/}"
22         else
23                 local u
24                 for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${pn} ; do
25                         printf "${u}/${pn}-${pv}-patches/%s " "$@"
26                 done
27         fi
28 }
29
30 DESCRIPTION="The standard GNU Bourne again shell"
31 HOMEPAGE="http://tiswww.case.edu/php/chet/bash/bashtop.html"
32 SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
33
34 LICENSE="GPL-2"
35 SLOT="${MY_PV}"
36 KEYWORDS="~alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sparc x86"
37 IUSE="afs +net nls +readline static"
38
39 LIB_DEPEND=">=sys-libs/ncurses-5.2-r2[static-libs(+)]
40         nls? ( virtual/libintl )
41         readline? ( >=sys-libs/readline-6.2[static-libs(+)] )"
42 RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} )"
43 DEPEND="${RDEPEND}
44         static? ( ${LIB_DEPEND} )"
45
46 S=${WORKDIR}/${MY_P}
47
48 pkg_setup() {
49         if is-flag -malign-double ; then #7332
50                 eerror "Detected bad CFLAGS '-malign-double'.  Do not use this"
51                 eerror "as it breaks LFS (struct stat64) on x86."
52                 die "remove -malign-double from your CFLAGS mr ricer"
53         fi
54 }
55
56 src_unpack() {
57         unpack ${MY_P}.tar.gz
58 }
59
60 src_prepare() {
61         # Include official patches
62         [[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
63
64         # Clean out local libs so we know we use system ones
65         rm -rf lib/{readline,termcap}/*
66         touch lib/{readline,termcap}/Makefile.in # for config.status
67         sed -ri -e 's:\$[(](RL|HIST)_LIBSRC[)]/[[:alpha:]]*.h::g' Makefile.in || die
68
69         epatch "${FILESDIR}"/${PN}-2.05b-destdir.patch
70         epatch "${FILESDIR}"/autoconf-mktime-2.53.patch #220040
71         epatch "${FILESDIR}"/${PN}-2.05b-protos.patch
72         epatch "${FILESDIR}"/${PN}-2.05b-empty-herestring.patch
73         epatch "${FILESDIR}"/${PN}-2.05b-rbash.patch #26854
74         epatch "${FILESDIR}"/${PN}-2.05b-parallel-build.patch #41002
75         epatch "${FILESDIR}"/${PN}-2.05b-jobs.patch
76         epatch "${FILESDIR}"/${PN}-2.05b-fix-job-warning.patch
77         epatch "${FILESDIR}"/${PN}-3.1-dev-fd-buffer-overflow.patch #431850
78
79         epatch_user
80 }
81
82 src_configure() {
83         local myconf=()
84
85         # Force pgrp synchronization
86         # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=81653
87         export bash_cv_pgrp_pipe=yes
88
89         # For descriptions of these, see config-top.h
90         # bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
91         append-cppflags \
92                 -DDEFAULT_PATH_VALUE=\'\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"\' \
93                 -DSTANDARD_UTILS_PATH=\'\"/bin:/usr/bin:/sbin:/usr/sbin\"\' \
94                 -DSYS_BASHRC=\'\"/etc/bash/bashrc\"\' \
95                 -DSYS_BASH_LOGOUT=\'\"/etc/bash/bash_logout\"\' \
96                 -DNON_INTERACTIVE_LOGIN_SHELLS \
97                 -DSSH_SOURCE_BASHRC \
98                 -DUSE_MKTEMP -DUSE_MKSTEMP
99
100         use static && append-ldflags -static
101         use nls || myconf+=( --disable-nls )
102
103         # Historically, we always used the builtin readline, but since
104         # our handling of SONAME upgrades has gotten much more stable
105         # in the PM (and the readline ebuild itself preserves the old
106         # libs during upgrades), linking against the system copy should
107         # be safe.
108         # Exact cached version here doesn't really matter as long as it
109         # is at least what's in the DEPEND up above.
110         export ac_cv_rl_version=6.2
111
112         # Force linking with system curses ... the bundled termcap lib
113         # sucks bad compared to ncurses.  For the most part, ncurses
114         # is here because readline needs it.  But bash itself calls
115         # ncurses in one or two small places :(.
116
117         tc-export AR #444070
118         # This old autoconf script does not re-exec itself properly and fails when
119         # /bin/sh is not bash.  Rather than try to regen everything, just force the
120         # use of bash directly.
121         CONFIG_SHELL="/bin/bash" \
122         econf \
123                 --with-installed-readline=. \
124                 --with-curses \
125                 $(use_with afs) \
126                 $(use_enable net net-redirections) \
127                 --disable-profiling \
128                 --without-gnu-malloc \
129                 $(use_enable readline) \
130                 $(use_enable readline history) \
131                 $(use_enable readline bang-history) \
132                 "${myconf[@]}"
133 }
134
135 src_install() {
136         into /
137         newbin bash bash-${SLOT}
138
139         newman doc/bash.1 bash-${SLOT}.1
140         newman doc/builtins.1 builtins-${SLOT}.1
141
142         insinto /usr/share/info
143         newins doc/bashref.info bash-${SLOT}.info
144         dosym bash-${SLOT}.info /usr/share/info/bashref-${SLOT}.info
145
146         dodoc README NEWS AUTHORS CHANGES COMPAT Y2K doc/FAQ doc/INTRO
147 }