sys-libs/glibc: bump 2.23 to patchset 8
[gentoo.git] / sys-libs / glibc / glibc-2.23-r4.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="5"
5
6 inherit toolchain-glibc
7
8 DESCRIPTION="GNU libc6 (also called glibc2) C library"
9 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
10
11 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
12 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
13 RESTRICT="strip" # strip ourself #46186
14 EMULTILIB_PKG="true"
15
16 # Configuration variables
17 RELEASE_VER=""
18 case ${PV} in
19 9999*)
20         EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
21         EGIT_SOURCEDIRS="${S}"
22         inherit git-2
23         ;;
24 *)
25         RELEASE_VER=${PV}
26         ;;
27 esac
28 GCC_BOOTSTRAP_VER="4.7.3-r1"
29 PATCH_VER="8"                                  # Gentoo patchset
30 : ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
31
32 IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
33
34 # Here's how the cross-compile logic breaks down ...
35 #  CTARGET - machine that will target the binaries
36 #  CHOST   - machine that will host the binaries
37 #  CBUILD  - machine that will build the binaries
38 # If CTARGET != CHOST, it means you want a libc for cross-compiling.
39 # If CHOST != CBUILD, it means you want to cross-compile the libc.
40 #  CBUILD = CHOST = CTARGET    - native build/install
41 #  CBUILD != (CHOST = CTARGET) - cross-compile a native build
42 #  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
43 #  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
44 # For install paths:
45 #  CHOST = CTARGET  - install into /
46 #  CHOST != CTARGET - install into /usr/CTARGET/
47
48 export CBUILD=${CBUILD:-${CHOST}}
49 export CTARGET=${CTARGET:-${CHOST}}
50 if [[ ${CTARGET} == ${CHOST} ]] ; then
51         if [[ ${CATEGORY} == cross-* ]] ; then
52                 export CTARGET=${CATEGORY#cross-}
53         fi
54 fi
55
56 is_crosscompile() {
57         [[ ${CHOST} != ${CTARGET} ]]
58 }
59
60 # Why SLOT 2.2 you ask yourself while sippin your tea ?
61 # Everyone knows 2.2 > 0, duh.
62 SLOT="2.2"
63
64 # General: We need a new-enough binutils/gcc to match upstream baseline.
65 # arch: we need to make sure our binutils/gcc supports TLS.
66 COMMON_DEPEND="
67         nscd? ( selinux? (
68                 audit? ( sys-process/audit )
69                 caps? ( sys-libs/libcap )
70         ) )
71         suid? ( caps? ( sys-libs/libcap ) )
72         selinux? ( sys-libs/libselinux )
73 "
74 DEPEND="${COMMON_DEPEND}
75         >=app-misc/pax-utils-0.1.10
76         !<sys-apps/sandbox-1.6
77         !<sys-apps/portage-2.1.2"
78 RDEPEND="${COMMON_DEPEND}
79         !sys-kernel/ps3-sources
80         sys-apps/gentoo-functions
81         !sys-libs/nss-db"
82
83 if [[ ${CATEGORY} == cross-* ]] ; then
84         DEPEND+=" !crosscompile_opts_headers-only? (
85                 >=${CATEGORY}/binutils-2.24
86                 >=${CATEGORY}/gcc-4.7
87         )"
88         [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
89 else
90         DEPEND+="
91                 >=sys-devel/binutils-2.24
92                 >=sys-devel/gcc-4.7
93                 virtual/os-headers"
94         RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
95         PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
96 fi
97
98 upstream_uris() {
99         echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
100 }
101 gentoo_uris() {
102         local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI HTTP~tamiko/distfiles/URI"
103         devspace=${devspace//HTTP/https://dev.gentoo.org/}
104         echo mirror://gentoo/$1 ${devspace//URI/$1}
105 }
106 SRC_URI=$(
107         [[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
108         [[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
109 )
110 SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
111
112 src_unpack() {
113         [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
114
115         toolchain-glibc_src_unpack
116 }
117
118 src_prepare() {
119         toolchain-glibc_src_prepare
120
121         cd "${S}"
122
123         epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
124
125         if use hardened ; then
126                 # We don't enable these for non-hardened as the output is very terse --
127                 # it only states that a crash happened.  The default upstream behavior
128                 # includes backtraces and symbols.
129                 einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
130                 cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
131                 cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-chk_fail.c debug/chk_fail.c || die
132
133                 if use debug ; then
134                         # Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
135                         sed -i \
136                                 -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
137                                 -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
138                                 debug/Makefile || die
139                 fi
140
141                 # Build various bits with ssp-all
142                 sed -i \
143                         -e 's:-fstack-protector$:-fstack-protector-all:' \
144                         */Makefile || die
145         fi
146
147         case $(gcc-fullversion) in
148         4.8.[0-3]|4.9.0)
149                 eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
150                 eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
151                 die "need to switch compilers #547420"
152                 ;;
153         esac
154 }