| 1 |
# Copyright 1999-2013 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/sys-libs/libstdc++-v3/libstdc++-v3-3.3.6-r1.ebuild,v 1.3 2012/07/23 16:01:24 vapier Exp $ |
| 4 |
|
| 5 |
inherit eutils flag-o-matic libtool multilib |
| 6 |
|
| 7 |
transform_known_flags() { |
| 8 |
declare setting |
| 9 |
|
| 10 |
# and on x86, we just need to filter the 3.4 specific amd64 -marchs |
| 11 |
replace-cpu-flags k8 athlon64 opteron x86-64 |
| 12 |
|
| 13 |
# gcc 3.3 doesn't support -march=pentium-m |
| 14 |
replace-cpu-flags pentium-m pentium3m pentium3 |
| 15 |
|
| 16 |
#GCC 3.3 does not understand G3, G4, G5 on ppc |
| 17 |
replace-cpu-flags G3 750 |
| 18 |
replace-cpu-flags G4 7400 |
| 19 |
replace-cpu-flags G5 7400 |
| 20 |
} |
| 21 |
|
| 22 |
is_arch_allowed() { |
| 23 |
i386_processor_table="i386 i486 i586 pentium pentium-mmx winchip-c6 \ |
| 24 |
winchip2 c3 i686 pentiumpro pentium2 pentium3 pentium4 prescott \ |
| 25 |
nocona k6 k6-2 k6-3 athlon athlon-tbird x86-64 athlon-4 athlon-xp \ |
| 26 |
athlon-mp" |
| 27 |
|
| 28 |
for proc in ${i386_processor_table} ; do |
| 29 |
[ "${proc}" == "${1}" ] && return 0 |
| 30 |
done |
| 31 |
|
| 32 |
mips_processor_table="mips1 mips2 mips3 mips4 mips32 mips64 r3000 r2000 \ |
| 33 |
r3900 r6000 r4000 vr4100 vr4111 vr4120 vr4300 r4400 r4600 orion \ |
| 34 |
r4650 r8000 vr5000 vr5400 vr5500 4kc 4kp 5kc 20kc sr71000 sb1" |
| 35 |
|
| 36 |
for proc in ${mips_processor_table} ; do |
| 37 |
[ "${proc}" == "${1}" ] && return 0 |
| 38 |
done |
| 39 |
|
| 40 |
rs6000_processor_table="common power power2 power3 power4 powerpc \ |
| 41 |
powerpc64 rios rios1 rsc rsc1 rios2 rs64a 401 403 405 505 601 602 \ |
| 42 |
603 603e ec603e 604 604e 620 630 740 750 7400 7450 8540 801 821 823 \ |
| 43 |
860" |
| 44 |
|
| 45 |
for proc in ${rs6000_processor_table} ; do |
| 46 |
[ "${proc}" == "${1}" ] && return 0 |
| 47 |
done |
| 48 |
|
| 49 |
return 1 |
| 50 |
} |
| 51 |
|
| 52 |
do_filter_flags() { |
| 53 |
declare setting |
| 54 |
|
| 55 |
# In general gcc does not like optimization, and add -O2 where |
| 56 |
# it is safe. This is especially true for gcc 3.3 + 3.4 |
| 57 |
replace-flags -O? -O2 |
| 58 |
|
| 59 |
# gcc 3.3 doesn't support -mtune on numerous archs, so xgcc will fail |
| 60 |
setting="`get-flag mtune`" |
| 61 |
[ ! -z "${setting}" ] && filter-flags -mtune="${setting}" |
| 62 |
|
| 63 |
# in gcc 3.3 there is a bug on ppc64 where if -mcpu is used |
| 64 |
# the compiler incorrectly assumes the code you are about to build |
| 65 |
# is 32 bit |
| 66 |
use ppc64 && setting="`get-flag mcpu`" |
| 67 |
[ ! -z "${setting}" ] && filter-flags -mcpu="${setting}" |
| 68 |
|
| 69 |
# only allow the flags that we -know- are supported |
| 70 |
transform_known_flags |
| 71 |
setting="`get-flag march`" |
| 72 |
if [ ! -z "${setting}" ] ; then |
| 73 |
is_arch_allowed "${setting}" || filter-flags -march="${setting}" |
| 74 |
fi |
| 75 |
setting="`get-flag mcpu`" |
| 76 |
if [ ! -z "${setting}" ] ; then |
| 77 |
is_arch_allowed "${setting}" || filter-flags -mcpu="${setting}" |
| 78 |
fi |
| 79 |
|
| 80 |
# xgcc wont understand gcc 3.4 flags... |
| 81 |
filter-flags -fno-unit-at-a-time |
| 82 |
filter-flags -funit-at-a-time |
| 83 |
filter-flags -fweb |
| 84 |
filter-flags -fno-web |
| 85 |
filter-flags -mno-tls-direct-seg-refs |
| 86 |
|
| 87 |
# xgcc isnt patched with propolice |
| 88 |
filter-flags -fstack-protector-all |
| 89 |
filter-flags -fno-stack-protector-all |
| 90 |
filter-flags -fstack-protector |
| 91 |
filter-flags -fno-stack-protector |
| 92 |
|
| 93 |
# xgcc isnt patched with the gcc symbol visibility patch |
| 94 |
filter-flags -fvisibility-inlines-hidden |
| 95 |
filter-flags -fvisibility=hidden |
| 96 |
|
| 97 |
# Bug #269433 & #290202 |
| 98 |
filter-flags -fno-strict-overflow |
| 99 |
filter-flags -fstrict-overflow |
| 100 |
|
| 101 |
# Bug #442784 |
| 102 |
filter-flags '-W*' |
| 103 |
|
| 104 |
# ...sure, why not? |
| 105 |
strip-unsupported-flags |
| 106 |
|
| 107 |
strip-flags |
| 108 |
} |
| 109 |
|
| 110 |
PATCH_VER="1.8" |
| 111 |
|
| 112 |
DESCRIPTION="Compatibility package for running binaries linked against a pre gcc 3.4 libstdc++" |
| 113 |
HOMEPAGE="http://gcc.gnu.org/libstdc++/" |
| 114 |
SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/gcc-${PV}/gcc-${PV}.tar.bz2 |
| 115 |
mirror://gentoo/gcc-${PV}-patches-${PATCH_VER}.tar.bz2" |
| 116 |
|
| 117 |
LICENSE="GPL-2 LGPL-2.1" |
| 118 |
SLOT="5" |
| 119 |
KEYWORDS="~amd64 ~arm ~hppa ~mips ~ppc -ppc64 ~sparc ~x86 ~x86-fbsd" |
| 120 |
IUSE="multilib nls" |
| 121 |
|
| 122 |
S=${WORKDIR}/gcc-${PV} |
| 123 |
|
| 124 |
src_unpack() { |
| 125 |
unpack ${A} |
| 126 |
cd "${S}" |
| 127 |
EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch |
| 128 |
elibtoolize --portage --shallow |
| 129 |
./contrib/gcc_update --touch |
| 130 |
mkdir -p "${WORKDIR}"/build |
| 131 |
|
| 132 |
if use multilib && [[ ${SYMLINK_LIB} == "yes" ]] ; then |
| 133 |
# ugh, this shit has to match the way we've hacked gcc else |
| 134 |
# the build falls apart #259215 |
| 135 |
sed -i \ |
| 136 |
-e 's:\(MULTILIB_OSDIRNAMES = \).*:\1../lib64 ../lib32:' \ |
| 137 |
"${S}"/gcc/config/i386/t-linux64 \ |
| 138 |
|| die "sed failed!" |
| 139 |
fi |
| 140 |
} |
| 141 |
|
| 142 |
src_compile() { |
| 143 |
cd "${WORKDIR}"/build |
| 144 |
do_filter_flags |
| 145 |
ECONF_SOURCE=${S} \ |
| 146 |
econf \ |
| 147 |
--enable-shared \ |
| 148 |
--with-system-zlib \ |
| 149 |
--enable-languages=c++ \ |
| 150 |
--enable-threads=posix \ |
| 151 |
--enable-long-long \ |
| 152 |
--disable-checking \ |
| 153 |
--enable-cstdio=stdio \ |
| 154 |
--enable-__cxa_atexit \ |
| 155 |
$(use_enable multilib) \ |
| 156 |
$(use_enable nls) \ |
| 157 |
$(use_with !nls included-gettext) |
| 158 |
|
| 159 |
touch "${S}"/gcc/c-gperf.h |
| 160 |
|
| 161 |
emake all-target-libstdc++-v3 || die |
| 162 |
} |
| 163 |
|
| 164 |
src_install() { |
| 165 |
emake -j1 \ |
| 166 |
-C "${WORKDIR}"/build \ |
| 167 |
DESTDIR="${D}" \ |
| 168 |
install-target-libstdc++-v3 || die |
| 169 |
|
| 170 |
# scrub everything but the library we care about |
| 171 |
pushd "${D}" >/dev/null |
| 172 |
mv usr/lib* . || die |
| 173 |
rm -rf usr |
| 174 |
rm -f lib*/*.{a,la,so} || die |
| 175 |
dodir /usr |
| 176 |
mv lib* usr/ || die |
| 177 |
} |