| 1 |
vapier |
1.3 |
# Copyright 1999-2003 Gentoo Technologies, Inc. |
| 2 |
azarah |
1.1 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
gmsoft |
1.21 |
# $Header: /home/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2.2.ebuild,v 1.20 2003/09/08 22:39:07 george Exp $ |
| 4 |
azarah |
1.1 |
|
| 5 |
|
|
IUSE="static nls bootstrap java build" |
| 6 |
|
|
|
| 7 |
|
|
inherit eutils flag-o-matic libtool |
| 8 |
|
|
|
| 9 |
|
|
# Compile problems with these (bug #6641 among others)... |
| 10 |
|
|
filter-flags "-fno-exceptions -fomit-frame-pointer" |
| 11 |
|
|
|
| 12 |
|
|
# Recently there has been a lot of stability problem in Gentoo-land. Many |
| 13 |
|
|
# things can be the cause to this, but I believe that it is due to gcc3 |
| 14 |
|
|
# still having issues with optimizations, or with it not filtering bad |
| 15 |
|
|
# combinations (protecting the user maybe from himeself) yet. |
| 16 |
|
|
# |
| 17 |
|
|
# This can clearly be seen in large builds like glibc, where too aggressive |
| 18 |
|
|
# CFLAGS cause the tests to fail miserbly. |
| 19 |
|
|
# |
| 20 |
|
|
# Quote from Nick Jones <carpaski@gentoo.org>, who in my opinion |
| 21 |
|
|
# knows what he is talking about: |
| 22 |
|
|
# |
| 23 |
|
|
# People really shouldn't force code-specific options on... It's a |
| 24 |
|
|
# bad idea. The -march options aren't just to look pretty. They enable |
| 25 |
|
|
# options that are sensible (and include sse,mmx,3dnow when apropriate). |
| 26 |
|
|
# |
| 27 |
|
|
# The next command strips CFLAGS and CXXFLAGS from nearly all flags. If |
| 28 |
|
|
# you do not like it, comment it, but do not bugreport if you run into |
| 29 |
|
|
# problems. |
| 30 |
|
|
# |
| 31 |
|
|
# <azarah@gentoo.org> (13 Oct 2002) |
| 32 |
|
|
strip-flags |
| 33 |
|
|
|
| 34 |
|
|
# Theoretical cross compiler support |
| 35 |
|
|
[ ! -n "${CCHOST}" ] && export CCHOST="${CHOST}" |
| 36 |
|
|
|
| 37 |
|
|
LOC="/usr" |
| 38 |
|
|
MY_PV="`echo ${PV} | awk -F. '{ gsub(/_pre.*|_alpha.*/, ""); print $1 "." $2 }'`" |
| 39 |
|
|
MY_PV_FULL="`echo ${PV} | awk '{ gsub(/_pre.*|_alpha.*/, ""); print $0 }'`" |
| 40 |
|
|
|
| 41 |
|
|
LIBPATH="${LOC}/lib/gcc-lib/${CCHOST}/${MY_PV_FULL}" |
| 42 |
|
|
BINPATH="${LOC}/${CCHOST}/gcc-bin/${MY_PV}" |
| 43 |
|
|
DATAPATH="${LOC}/share/gcc-data/${CCHOST}/${MY_PV}" |
| 44 |
|
|
# Dont install in /usr/include/g++-v3/, but in gcc internal directory. |
| 45 |
|
|
# We will handle /usr/include/g++-v3/ with gcc-config ... |
| 46 |
|
|
STDCXX_INCDIR="${LIBPATH}/include/g++-v${MY_PV/\.*/}" |
| 47 |
|
|
|
| 48 |
|
|
# Patch tarball support ... |
| 49 |
|
|
#PATCH_VER="1.0" |
| 50 |
|
|
PATCH_VER="" |
| 51 |
|
|
|
| 52 |
|
|
# Snapshot support ... |
| 53 |
|
|
#SNAPSHOT="2002-08-12" |
| 54 |
|
|
SNAPSHOT="" |
| 55 |
|
|
|
| 56 |
|
|
# Branch update support ... |
| 57 |
|
|
MAIN_BRANCH="${PV}" # Tarball, etc used ... |
| 58 |
|
|
#BRANCH_UPDATE="20021208" |
| 59 |
|
|
BRANCH_UPDATE="" |
| 60 |
|
|
|
| 61 |
|
|
if [ -z "${SNAPSHOT}" ] |
| 62 |
|
|
then |
| 63 |
|
|
S="${WORKDIR}/${PN}-${MAIN_BRANCH}" |
| 64 |
|
|
SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/${P}/${PN}-${MAIN_BRANCH}.tar.bz2" |
| 65 |
msterret |
1.19 |
|
| 66 |
azarah |
1.1 |
if [ -n "${PATCH_VER}" ] |
| 67 |
|
|
then |
| 68 |
|
|
SRC_URI="${SRC_URI} |
| 69 |
|
|
mirror://gentoo/${P}-patches-${PATCH_VER}.tar.bz2" |
| 70 |
|
|
fi |
| 71 |
|
|
|
| 72 |
|
|
if [ -n "${BRANCH_UPDATE}" ] |
| 73 |
|
|
then |
| 74 |
|
|
SRC_URI="${SRC_URI} |
| 75 |
|
|
mirror://gentoo/${PN}-${MAIN_BRANCH}-branch-update-${BRANCH_UPDATE}.patch.bz2" |
| 76 |
|
|
fi |
| 77 |
|
|
else |
| 78 |
|
|
S="${WORKDIR}/gcc-${SNAPSHOT//-}" |
| 79 |
|
|
SRC_URI="ftp://sources.redhat.com/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT//-}.tar.bz2" |
| 80 |
|
|
fi |
| 81 |
|
|
#SRC_URI="${SRC_URI} mirror://gentoo/${P}-manpages.tar.bz2" |
| 82 |
|
|
|
| 83 |
|
|
DESCRIPTION="The GNU Compiler Collection. Includes C/C++ and java compilers" |
| 84 |
|
|
HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html" |
| 85 |
|
|
|
| 86 |
|
|
LICENSE="GPL-2 LGPL-2.1" |
| 87 |
joker |
1.15 |
KEYWORDS="x86 ~ppc sparc alpha hppa arm mips" |
| 88 |
azarah |
1.1 |
|
| 89 |
|
|
# Ok, this is a hairy one again, but lets assume that we |
| 90 |
|
|
# are not cross compiling, than we want SLOT to only contain |
| 91 |
|
|
# $PV, as people upgrading to new gcc layout will not have |
| 92 |
|
|
# their old gcc unmerged ... |
| 93 |
|
|
if [ "${CHOST}" == "${CCHOST}" ] |
| 94 |
|
|
then |
| 95 |
|
|
SLOT="${MY_PV}" |
| 96 |
|
|
else |
| 97 |
|
|
SLOT="${CCHOST}-${MY_PV}" |
| 98 |
|
|
fi |
| 99 |
|
|
|
| 100 |
|
|
DEPEND="virtual/glibc |
| 101 |
gmsoft |
1.21 |
!hppa? ( mips? ( >=sys-devel/binutils-2.13.90.0.16 : >=sys-devel/binutils-2.13.90.0.18 ) ) |
| 102 |
gmsoft |
1.17 |
hppa? ( >=sys-devel/binutils-2.13.90.0.16 ) |
| 103 |
azarah |
1.1 |
>=sys-devel/gcc-config-1.3.1 |
| 104 |
|
|
!build? ( >=sys-libs/ncurses-5.2-r2 |
| 105 |
|
|
nls? ( sys-devel/gettext ) )" |
| 106 |
msterret |
1.19 |
|
| 107 |
azarah |
1.1 |
RDEPEND="virtual/glibc |
| 108 |
|
|
>=sys-devel/gcc-config-1.3.1 |
| 109 |
|
|
>=sys-libs/zlib-1.1.4 |
| 110 |
|
|
>=sys-apps/texinfo-4.2-r4 |
| 111 |
|
|
!build? ( >=sys-libs/ncurses-5.2-r2 )" |
| 112 |
|
|
|
| 113 |
|
|
PDEPEND="sys-devel/gcc-config" |
| 114 |
|
|
|
| 115 |
|
|
|
| 116 |
|
|
# Hack used to patch Makefiles to install into the build dir |
| 117 |
|
|
FAKE_ROOT="" |
| 118 |
|
|
|
| 119 |
azarah |
1.12 |
chk_gcc_version() { |
| 120 |
|
|
# This next bit is for updating libtool linker scripts ... |
| 121 |
azarah |
1.18 |
local OLD_GCC_VERSION="`gcc -dumpversion`" |
| 122 |
|
|
local OLD_GCC_CHOST="$(gcc -v 2>&1 | egrep '^Reading specs' |\ |
| 123 |
|
|
sed -e 's:^.*/gcc-lib/\([^/]*\)/[0-9]\+.*$:\1:')" |
| 124 |
azarah |
1.12 |
|
| 125 |
|
|
if [ "${OLD_GCC_VERSION}" != "${MY_PV_FULL}" ] |
| 126 |
|
|
then |
| 127 |
azarah |
1.18 |
echo "${OLD_GCC_VERSION}" > "${WORKDIR}/.oldgccversion" |
| 128 |
|
|
fi |
| 129 |
|
|
|
| 130 |
|
|
if [ -n "${OLD_GCC_CHOST}" ] |
| 131 |
|
|
then |
| 132 |
|
|
if [ "${CHOST}" = "${CCHOST}" -a "${OLD_GCC_CHOST}" != "${CHOST}" ] |
| 133 |
|
|
then |
| 134 |
|
|
echo "${OLD_GCC_CHOST}" > "${WORKDIR}/.oldgccchost" |
| 135 |
|
|
fi |
| 136 |
azarah |
1.12 |
fi |
| 137 |
|
|
|
| 138 |
|
|
# Did we check the version ? |
| 139 |
azarah |
1.18 |
touch "${WORKDIR}/.chkgccversion" |
| 140 |
azarah |
1.12 |
} |
| 141 |
|
|
|
| 142 |
azarah |
1.1 |
src_unpack() { |
| 143 |
|
|
if [ -z "${SNAPSHOT}" ] |
| 144 |
|
|
then |
| 145 |
|
|
unpack ${PN}-${MAIN_BRANCH}.tar.bz2 |
| 146 |
msterret |
1.19 |
|
| 147 |
azarah |
1.1 |
if [ -n "${PATCH_VER}" ] |
| 148 |
|
|
then |
| 149 |
|
|
unpack ${P}-patches-${PATCH_VER}.tar.bz2 |
| 150 |
|
|
fi |
| 151 |
|
|
else |
| 152 |
|
|
unpack gcc-${SNAPSHOT//-}.tar.bz2 |
| 153 |
|
|
fi |
| 154 |
|
|
|
| 155 |
|
|
cd ${S} |
| 156 |
|
|
# Fixup libtool to correctly generate .la files with portage |
| 157 |
|
|
elibtoolize --portage --shallow |
| 158 |
|
|
|
| 159 |
|
|
echo |
| 160 |
|
|
|
| 161 |
|
|
# Branch update ... |
| 162 |
|
|
if [ -n "${BRANCH_UPDATE}" ] |
| 163 |
|
|
then |
| 164 |
|
|
epatch ${DISTDIR}/${PN}-${MAIN_BRANCH}-branch-update-${BRANCH_UPDATE}.patch.bz2 |
| 165 |
|
|
fi |
| 166 |
|
|
|
| 167 |
|
|
# Do bulk patches included in ${P}-patches-${PATCH_VER}.tar.bz2 |
| 168 |
|
|
if [ -n "${PATCH_VER}" ] |
| 169 |
|
|
then |
| 170 |
|
|
epatch ${WORKDIR}/patch |
| 171 |
|
|
fi |
| 172 |
|
|
|
| 173 |
|
|
# Patches from Redhat ... |
| 174 |
george |
1.20 |
#epatch ${FILESDIR}/3.2.1/gcc32-ada-make.patch |
| 175 |
azarah |
1.1 |
epatch ${FILESDIR}/3.2.1/gcc32-shared-pthread.patch |
| 176 |
|
|
use sparc && epatch ${FILESDIR}/3.2.1/gcc32-sparc32-hack.patch |
| 177 |
|
|
|
| 178 |
|
|
# Patches from Mandrake/Suse ... |
| 179 |
|
|
epatch ${FILESDIR}/3.2.1/gcc31-loop-load-final-value.patch |
| 180 |
|
|
epatch ${FILESDIR}/3.2.1/gcc32-pr8213.patch |
| 181 |
|
|
epatch ${FILESDIR}/3.2.1/gcc32-strip-dotdot.patch |
| 182 |
|
|
epatch ${FILESDIR}/3.2.1/gcc32-athlon-alignment.patch |
| 183 |
zwelch |
1.6 |
|
| 184 |
|
|
# Patches from debian-arm |
| 185 |
|
|
if [ "${ARCH}" = "arm" ]; then |
| 186 |
zwelch |
1.7 |
epatch ${FILESDIR}/3.2.1/gcc32-arm-disable-mathf.patch |
| 187 |
zwelch |
1.6 |
epatch ${FILESDIR}/3.2.1/gcc32-arm-reload1-fix.patch |
| 188 |
|
|
fi |
| 189 |
azarah |
1.1 |
|
| 190 |
|
|
# Install our pre generated manpages if we do not have perl ... |
| 191 |
|
|
# if [ ! -x /usr/bin/perl ] |
| 192 |
|
|
# then |
| 193 |
|
|
# cd ${S}; unpack ${P}-manpages.tar.bz2 |
| 194 |
|
|
# fi |
| 195 |
|
|
|
| 196 |
|
|
# Currently if any path is changed via the configure script, it breaks |
| 197 |
|
|
# installing into ${D}. We should not patch it in src_install() with |
| 198 |
|
|
# absolute paths, as some modules then gets rebuild with the wrong |
| 199 |
|
|
# paths. Thus we use $FAKE_ROOT. |
| 200 |
|
|
einfo "Fixing Makefiles..." |
| 201 |
|
|
cd ${S} |
| 202 |
|
|
for x in $(find . -name Makefile.in) |
| 203 |
|
|
do |
| 204 |
|
|
# Fix --datadir= |
| 205 |
|
|
cp ${x} ${x}.orig |
| 206 |
|
|
sed -e 's:datadir = @datadir@:datadir = $(FAKE_ROOT)@datadir@:' \ |
| 207 |
|
|
${x}.orig > ${x} |
| 208 |
msterret |
1.19 |
|
| 209 |
azarah |
1.1 |
# Fix --bindir= |
| 210 |
|
|
cp ${x} ${x}.orig |
| 211 |
|
|
sed -e 's:bindir = @bindir@:bindir = $(FAKE_ROOT)@bindir@:' \ |
| 212 |
|
|
${x}.orig > ${x} |
| 213 |
|
|
|
| 214 |
|
|
# Fix --includedir= |
| 215 |
|
|
cp ${x} ${x}.orig |
| 216 |
|
|
sed -e 's:includedir = @includedir@:includedir = $(FAKE_ROOT)@includedir@:' \ |
| 217 |
|
|
${x}.orig > ${x} |
| 218 |
|
|
|
| 219 |
|
|
# Fix --with-gxx-include-dir= |
| 220 |
|
|
cp ${x} ${x}.orig |
| 221 |
|
|
sed -e 's:gxx_include_dir = @gxx_:gxx_include_dir = $(FAKE_ROOT)@gxx_:' \ |
| 222 |
|
|
-e 's:glibcppinstalldir = @gxx_:glibcppinstalldir = $(FAKE_ROOT)@gxx_:' \ |
| 223 |
|
|
${x}.orig > ${x} |
| 224 |
msterret |
1.19 |
|
| 225 |
azarah |
1.1 |
# Where java security stuff should be installed |
| 226 |
|
|
cp ${x} ${x}.orig |
| 227 |
|
|
sed -e 's:secdir = $(libdir)/security:secdir = $(FAKE_ROOT)$(LIBPATH)/security:' \ |
| 228 |
|
|
${x}.orig > ${x} |
| 229 |
msterret |
1.19 |
|
| 230 |
azarah |
1.1 |
rm -f ${x}.orig |
| 231 |
|
|
done |
| 232 |
|
|
} |
| 233 |
|
|
|
| 234 |
|
|
src_compile() { |
| 235 |
|
|
local myconf="" |
| 236 |
|
|
local gcc_lang="" |
| 237 |
msterret |
1.19 |
|
| 238 |
azarah |
1.1 |
if [ -z "`use build`" ] |
| 239 |
|
|
then |
| 240 |
|
|
myconf="${myconf} --enable-shared" |
| 241 |
george |
1.20 |
gcc_lang="c,c++,f77,objc" |
| 242 |
azarah |
1.1 |
else |
| 243 |
|
|
gcc_lang="c" |
| 244 |
|
|
fi |
| 245 |
|
|
if [ -z "`use nls`" ] || [ "`use build`" ] |
| 246 |
|
|
then |
| 247 |
|
|
myconf="${myconf} --disable-nls" |
| 248 |
|
|
else |
| 249 |
|
|
myconf="${myconf} --enable-nls --without-included-gettext" |
| 250 |
|
|
fi |
| 251 |
|
|
if [ -n "`use java`" ] && [ -z "`use build`" ] |
| 252 |
|
|
then |
| 253 |
|
|
gcc_lang="${gcc_lang},java" |
| 254 |
|
|
fi |
| 255 |
|
|
|
| 256 |
|
|
# In general gcc does not like optimization, and add -O2 where |
| 257 |
|
|
# it is safe. |
| 258 |
|
|
export CFLAGS="${CFLAGS//-O?}" |
| 259 |
|
|
export CXXFLAGS="${CXXFLAGS//-O?}" |
| 260 |
|
|
|
| 261 |
|
|
# Build in a separate build tree |
| 262 |
|
|
mkdir -p ${WORKDIR}/build |
| 263 |
|
|
cd ${WORKDIR}/build |
| 264 |
|
|
|
| 265 |
|
|
einfo "Configuring GCC..." |
| 266 |
|
|
addwrite "/dev/zero" |
| 267 |
|
|
${S}/configure --prefix=${LOC} \ |
| 268 |
|
|
--bindir=${BINPATH} \ |
| 269 |
|
|
--includedir=${LIBPATH}/include \ |
| 270 |
|
|
--datadir=${DATAPATH} \ |
| 271 |
|
|
--mandir=${DATAPATH}/man \ |
| 272 |
|
|
--infodir=${DATAPATH}/info \ |
| 273 |
|
|
--enable-shared \ |
| 274 |
|
|
--host=${CHOST} \ |
| 275 |
|
|
--target=${CCHOST} \ |
| 276 |
|
|
--with-system-zlib \ |
| 277 |
|
|
--enable-languages=${gcc_lang} \ |
| 278 |
|
|
--enable-threads=posix \ |
| 279 |
|
|
--enable-long-long \ |
| 280 |
|
|
--disable-checking \ |
| 281 |
|
|
--enable-cstdio=stdio \ |
| 282 |
|
|
--enable-clocale=generic \ |
| 283 |
|
|
--enable-__cxa_atexit \ |
| 284 |
|
|
--enable-version-specific-runtime-libs \ |
| 285 |
|
|
--with-gxx-include-dir=${STDCXX_INCDIR} \ |
| 286 |
|
|
--with-local-prefix=${LOC}/local \ |
| 287 |
|
|
${myconf} || die |
| 288 |
|
|
|
| 289 |
|
|
touch ${S}/gcc/c-gperf.h |
| 290 |
|
|
|
| 291 |
|
|
# Do not make manpages if we do not have perl ... |
| 292 |
|
|
if [ ! -x /usr/bin/perl ] |
| 293 |
msterret |
1.19 |
then |
| 294 |
azarah |
1.1 |
find ${S} -name '*.[17]' -exec touch {} \; || : |
| 295 |
|
|
fi |
| 296 |
|
|
|
| 297 |
|
|
# Setup -j in MAKEOPTS |
| 298 |
|
|
get_number_of_jobs |
| 299 |
|
|
|
| 300 |
|
|
einfo "Building GCC..." |
| 301 |
azarah |
1.13 |
# Only build it static if we are just building the C frontend, else |
| 302 |
|
|
# a lot of things break because there are not libstdc++.so .... |
| 303 |
|
|
if [ -n "`use static`" -a "${gcc_lang}" = "c" ] |
| 304 |
azarah |
1.1 |
then |
| 305 |
|
|
# Fix for our libtool-portage.patch |
| 306 |
|
|
S="${WORKDIR}/build" \ |
| 307 |
azarah |
1.13 |
emake LDFLAGS="-static" bootstrap \ |
| 308 |
azarah |
1.1 |
LIBPATH="${LIBPATH}" \ |
| 309 |
|
|
BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die |
| 310 |
|
|
# Above FLAGS optimize and speedup build, thanks |
| 311 |
|
|
# to Jeff Garzik <jgarzik@mandrakesoft.com> |
| 312 |
|
|
else |
| 313 |
azarah |
1.13 |
# Fix for our libtool-portage.patch |
| 314 |
azarah |
1.1 |
S="${WORKDIR}/build" \ |
| 315 |
azarah |
1.13 |
emake bootstrap-lean \ |
| 316 |
azarah |
1.1 |
LIBPATH="${LIBPATH}" \ |
| 317 |
|
|
BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die |
| 318 |
|
|
fi |
| 319 |
|
|
} |
| 320 |
|
|
|
| 321 |
|
|
src_install() { |
| 322 |
|
|
# Do allow symlinks in ${LOC}/lib/gcc-lib/${CHOST}/${PV}/include as |
| 323 |
|
|
# this can break the build. |
| 324 |
|
|
for x in cd ${WORKDIR}/build/gcc/include/* |
| 325 |
|
|
do |
| 326 |
|
|
if [ -L ${x} ] |
| 327 |
|
|
then |
| 328 |
|
|
rm -f ${x} |
| 329 |
|
|
fi |
| 330 |
|
|
done |
| 331 |
|
|
|
| 332 |
|
|
einfo "Installing GCC..." |
| 333 |
|
|
# Do the 'make install' from the build directory |
| 334 |
|
|
cd ${WORKDIR}/build |
| 335 |
|
|
S="${WORKDIR}/build" \ |
| 336 |
|
|
make prefix=${D}${LOC} \ |
| 337 |
|
|
bindir=${D}${BINPATH} \ |
| 338 |
|
|
includedir=${D}${LIBPATH}/include \ |
| 339 |
|
|
datadir=${D}${DATAPATH} \ |
| 340 |
|
|
mandir=${D}${DATAPATH}/man \ |
| 341 |
|
|
infodir=${D}${DATAPATH}/info \ |
| 342 |
|
|
LIBPATH="${LIBPATH}" \ |
| 343 |
|
|
FAKE_ROOT="${D}" \ |
| 344 |
|
|
install || die |
| 345 |
msterret |
1.19 |
|
| 346 |
azarah |
1.1 |
[ -r ${D}${BINPATH}/gcc ] || die "gcc not found in ${D}" |
| 347 |
msterret |
1.19 |
|
| 348 |
azarah |
1.1 |
dodir /lib /usr/bin |
| 349 |
|
|
dodir /etc/env.d/gcc |
| 350 |
|
|
echo "PATH=\"${BINPATH}\"" > ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL} |
| 351 |
|
|
echo "ROOTPATH=\"${BINPATH}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL} |
| 352 |
|
|
echo "LDPATH=\"${LIBPATH}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL} |
| 353 |
|
|
echo "MANPATH=\"${DATAPATH}/man\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL} |
| 354 |
|
|
echo "INFOPATH=\"${DATAPATH}/info\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL} |
| 355 |
|
|
echo "STDCXX_INCDIR=\"${STDCXX_INCDIR##*/}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL} |
| 356 |
|
|
# Also set CC and CXX |
| 357 |
|
|
echo "CC=\"gcc\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL} |
| 358 |
|
|
echo "CXX=\"g++\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL} |
| 359 |
msterret |
1.19 |
|
| 360 |
azarah |
1.1 |
# Install wrappers |
| 361 |
|
|
# Handled by gcc-config now ... |
| 362 |
|
|
# exeinto /lib |
| 363 |
|
|
# doexe ${FILESDIR}/cpp |
| 364 |
|
|
# exeinto /usr/bin |
| 365 |
|
|
# doexe ${FILESDIR}/cc |
| 366 |
msterret |
1.19 |
|
| 367 |
azarah |
1.1 |
# This should be invalidated by the linker scripts we have as the latest |
| 368 |
|
|
# fix for bug #4411 |
| 369 |
|
|
# |
| 370 |
|
|
# # gcc-3.1 have a problem with the ordering of Search Directories. For |
| 371 |
|
|
# # instance, if you have libreadline.so in /lib, and libreadline.a in |
| 372 |
|
|
# # /usr/lib, then it will link with libreadline.a instead of .so. As far |
| 373 |
|
|
# # as I can see from the source, /lib should be searched before /usr/lib, |
| 374 |
|
|
# # and this also differs from gcc-2.95.3 and possibly 3.0.4, but ill have |
| 375 |
|
|
# # to check on 3.0.4. Thanks to Daniel Robbins for noticing this oddity, |
| 376 |
|
|
# # bugzilla bug #4411 |
| 377 |
|
|
# # |
| 378 |
|
|
# # Azarah - 3 Jul 2002 |
| 379 |
|
|
# # |
| 380 |
|
|
# cd ${D}${LIBPATH} |
| 381 |
|
|
# dosed -e "s:%{L\*} %(link_libgcc):%{L\*} -L/lib %(link_libgcc):" \ |
| 382 |
|
|
# ${LIBPATH}/specs |
| 383 |
|
|
|
| 384 |
|
|
# Make sure we dont have stuff lying around that |
| 385 |
|
|
# can nuke multiple versions of gcc |
| 386 |
|
|
if [ -z "`use build`" ] |
| 387 |
|
|
then |
| 388 |
|
|
cd ${D}${LIBPATH} |
| 389 |
|
|
|
| 390 |
|
|
# Tell libtool files where real libraries are |
| 391 |
|
|
for LA in ${D}${LOC}/lib/*.la ${D}${LIBPATH}/../*.la |
| 392 |
|
|
do |
| 393 |
|
|
if [ -f ${LA} ] |
| 394 |
|
|
then |
| 395 |
|
|
sed -e "s:/usr/lib:${LIBPATH}:" ${LA} > ${LA}.hacked |
| 396 |
|
|
mv ${LA}.hacked ${LA} |
| 397 |
|
|
mv ${LA} ${D}${LIBPATH} |
| 398 |
|
|
fi |
| 399 |
|
|
done |
| 400 |
|
|
|
| 401 |
|
|
# Move all the libraries to version specific libdir. |
| 402 |
|
|
for x in ${D}${LOC}/lib/*.{so,a}* ${D}${LIBPATH}/../*.{so,a}* |
| 403 |
|
|
do |
| 404 |
|
|
[ -f ${x} ] && mv -f ${x} ${D}${LIBPATH} |
| 405 |
|
|
done |
| 406 |
|
|
|
| 407 |
|
|
# Move Java headers to compiler-specific dir |
| 408 |
|
|
for x in ${D}${LOC}/include/gc*.h ${D}${LOC}/include/j*.h |
| 409 |
|
|
do |
| 410 |
|
|
[ -f ${x} ] && mv -f ${x} ${D}${LIBPATH}/include/ |
| 411 |
|
|
done |
| 412 |
|
|
for x in gcj gnu java javax org |
| 413 |
|
|
do |
| 414 |
|
|
if [ -d ${D}${LOC}/include/${x} ] |
| 415 |
|
|
then |
| 416 |
|
|
dodir /${LIBPATH}/include/${x} |
| 417 |
|
|
mv -f ${D}${LOC}/include/${x}/* ${D}${LIBPATH}/include/${x}/ |
| 418 |
|
|
rm -rf ${D}${LOC}/include/${x} |
| 419 |
|
|
fi |
| 420 |
|
|
done |
| 421 |
|
|
|
| 422 |
|
|
# Move libgcj.spec to compiler-specific directories |
| 423 |
|
|
[ -f ${D}${LOC}/lib/libgcj.spec ] && \ |
| 424 |
|
|
mv -f ${D}${LOC}/lib/libgcj.spec ${D}${LIBPATH}/libgcj.spec |
| 425 |
|
|
|
| 426 |
|
|
# Rename jar because it could clash with Kaffe's jar if this gcc is |
| 427 |
|
|
# primary compiler (aka don't have the -<version> extension) |
| 428 |
|
|
cd ${D}${LOC}/${CCHOST}/gcc-bin/${MY_PV} |
| 429 |
|
|
[ -f jar ] && mv -f jar gcj-jar |
| 430 |
|
|
|
| 431 |
|
|
# Move <cxxabi.h> to compiler-specific directories |
| 432 |
|
|
[ -f ${D}${STDCXX_INCDIR}/cxxabi.h ] && \ |
| 433 |
|
|
mv -f ${D}${STDCXX_INCDIR}/cxxabi.h ${D}${LIBPATH}/include/ |
| 434 |
|
|
|
| 435 |
|
|
# These should be symlinks |
| 436 |
|
|
cd ${D}${BINPATH} |
| 437 |
|
|
rm -f ${CCHOST}-{gcc,g++,c++,g77} |
| 438 |
|
|
[ -f gcc ] && ln -sf gcc ${CCHOST}-gcc |
| 439 |
|
|
[ -f g++ ] && ln -sf g++ ${CCHOST}-g++ |
| 440 |
|
|
[ -f g++ ] && ln -sf g++ ${CCHOST}-c++ |
| 441 |
|
|
[ -f g77 ] && ln -sf g77 ${CCHOST}-g77 |
| 442 |
|
|
fi |
| 443 |
|
|
|
| 444 |
|
|
# This one comes with binutils |
| 445 |
|
|
if [ -f ${D}${LOC}/lib/libiberty.a ] |
| 446 |
|
|
then |
| 447 |
|
|
rm -f ${D}${LOC}/lib/libiberty.a |
| 448 |
|
|
fi |
| 449 |
|
|
|
| 450 |
|
|
cd ${S} |
| 451 |
azarah |
1.16 |
if [ -z "`use build`" ] |
| 452 |
|
|
then |
| 453 |
azarah |
1.1 |
cd ${S} |
| 454 |
|
|
docinto /${CCHOST} |
| 455 |
|
|
dodoc COPYING COPYING.LIB ChangeLog FAQ GNATS MAINTAINERS README |
| 456 |
|
|
docinto ${CCHOST}/html |
| 457 |
|
|
dohtml *.html |
| 458 |
|
|
cd ${S}/boehm-gc |
| 459 |
|
|
docinto ${CCHOST}/boehm-gc |
| 460 |
|
|
dodoc ChangeLog doc/{README*,barrett_diagram} |
| 461 |
|
|
docinto ${CCHOST}/boehm-gc/html |
| 462 |
|
|
dohtml doc/*.html |
| 463 |
|
|
cd ${S}/gcc |
| 464 |
|
|
docinto ${CCHOST}/gcc |
| 465 |
|
|
dodoc ChangeLog* FSFChangeLog* LANGUAGES NEWS ONEWS README* SERVICE |
| 466 |
|
|
cd ${S}/libf2c |
| 467 |
azarah |
1.16 |
docinto ${CCHOST}/libf2c |
| 468 |
|
|
dodoc ChangeLog README TODO *.netlib |
| 469 |
azarah |
1.1 |
cd ${S}/libffi |
| 470 |
azarah |
1.16 |
docinto ${CCHOST}/libffi |
| 471 |
|
|
dodoc ChangeLog* LICENSE README |
| 472 |
|
|
cd ${S}/libiberty |
| 473 |
|
|
docinto ${CCHOST}/libiberty |
| 474 |
|
|
dodoc ChangeLog COPYING.LIB README |
| 475 |
|
|
cd ${S}/libobjc |
| 476 |
|
|
docinto ${CCHOST}/libobjc |
| 477 |
|
|
dodoc ChangeLog README* THREADS* |
| 478 |
azarah |
1.1 |
cd ${S}/libstdc++-v3 |
| 479 |
|
|
docinto ${CCHOST}/libstdc++-v3 |
| 480 |
|
|
dodoc ChangeLog* README |
| 481 |
|
|
docinto ${CCHOST}/libstdc++-v3/html |
| 482 |
|
|
dohtml -r -a css,diff,html,txt,xml docs/html/* |
| 483 |
|
|
cp -f docs/html/17_intro/[A-Z]* \ |
| 484 |
|
|
${D}/usr/share/doc/${PF}/${DOCDESTTREE}/17_intro/ |
| 485 |
msterret |
1.19 |
|
| 486 |
azarah |
1.16 |
if [ -n "`use java`" ] |
| 487 |
|
|
then |
| 488 |
azarah |
1.1 |
cd ${S}/fastjar |
| 489 |
|
|
docinto ${CCHOST}/fastjar |
| 490 |
|
|
dodoc AUTHORS CHANGES COPYING ChangeLog NEWS README |
| 491 |
|
|
cd ${S}/libjava |
| 492 |
|
|
docinto ${CCHOST}/libjava |
| 493 |
|
|
dodoc ChangeLog* COPYING HACKING LIBGCJ_LICENSE NEWS README THANKS |
| 494 |
azarah |
1.16 |
fi |
| 495 |
|
|
else |
| 496 |
|
|
rm -rf ${D}/usr/share/{man,info} |
| 497 |
azarah |
1.1 |
fi |
| 498 |
|
|
|
| 499 |
azarah |
1.12 |
# Rather install the script, else portage with changing $FILESDIR |
| 500 |
|
|
# between binary and source package borks things .... |
| 501 |
|
|
insinto /lib/rcscripts/awk |
| 502 |
|
|
doins ${FILESDIR}/awk/fixlafiles.awk |
| 503 |
|
|
exeinto /sbin |
| 504 |
|
|
doexe ${FILESDIR}/fix_libtool_files.sh |
| 505 |
|
|
|
| 506 |
azarah |
1.16 |
# Fix ncurses b0rking |
| 507 |
|
|
find ${D}/ -name '*curses.h' -exec rm -f {} \; |
| 508 |
azarah |
1.1 |
} |
| 509 |
|
|
|
| 510 |
azarah |
1.12 |
pkg_preinst() { |
| 511 |
|
|
|
| 512 |
|
|
if [ ! -f "${WORKDIR}/.chkgccversion" ] |
| 513 |
|
|
then |
| 514 |
|
|
chk_gcc_version |
| 515 |
|
|
fi |
| 516 |
azarah |
1.14 |
|
| 517 |
|
|
# Make again sure that the linker "should" be able to locate |
| 518 |
|
|
# libstdc++.so ... |
| 519 |
|
|
export LD_LIBRARY_PATH="${LIBPATH}:${LD_LIBRARY_PATH}" |
| 520 |
|
|
${ROOT}/sbin/ldconfig |
| 521 |
azarah |
1.12 |
} |
| 522 |
|
|
|
| 523 |
azarah |
1.1 |
pkg_postinst() { |
| 524 |
|
|
|
| 525 |
azarah |
1.12 |
export LD_LIBRARY_PATH="${LIBPATH}:${LD_LIBRARY_PATH}" |
| 526 |
|
|
|
| 527 |
|
|
if [ "${ROOT}" = "/" -a "${COMPILER}" = "gcc3" -a "${CHOST}" = "${CCHOST}" ] |
| 528 |
azarah |
1.1 |
then |
| 529 |
|
|
gcc-config --use-portage-chost ${CCHOST}-${MY_PV_FULL} |
| 530 |
|
|
fi |
| 531 |
|
|
|
| 532 |
|
|
# Update libtool linker scripts to reference new gcc version ... |
| 533 |
azarah |
1.18 |
if [ "${ROOT}" = "/" ] && \ |
| 534 |
|
|
[ -f "${WORKDIR}/.oldgccversion" -o -f "${WORKDIR}/.oldgccchost" ] |
| 535 |
msterret |
1.19 |
then |
| 536 |
azarah |
1.18 |
local OLD_GCC_VERSION= |
| 537 |
|
|
local OLD_GCC_CHOST= |
| 538 |
|
|
|
| 539 |
|
|
if [ -f "${WORKDIR}/.oldgccversion" ] && \ |
| 540 |
|
|
[ -n "$(cat "${WORKDIR}/.oldgccversion")" ] |
| 541 |
|
|
then |
| 542 |
|
|
OLD_GCC_VERSION="$(cat "${WORKDIR}/.oldgccversion")" |
| 543 |
|
|
else |
| 544 |
|
|
OLD_GCC_VERSION="${MY_PV_FULL}" |
| 545 |
|
|
fi |
| 546 |
msterret |
1.19 |
|
| 547 |
azarah |
1.18 |
if [ -f "${WORKDIR}/.oldgccchost" ] && \ |
| 548 |
|
|
[ -n "$(cat "${WORKDIR}/.oldgccchost")" ] |
| 549 |
|
|
then |
| 550 |
|
|
OLD_GCC_CHOST="--oldarch $(cat "${WORKDIR}/.oldgccchost")" |
| 551 |
|
|
fi |
| 552 |
azarah |
1.1 |
|
| 553 |
azarah |
1.18 |
/sbin/fix_libtool_files.sh ${OLD_GCC_VERSION} ${OLD_GCC_CHOST} |
| 554 |
azarah |
1.1 |
fi |
| 555 |
msterret |
1.19 |
|
| 556 |
azarah |
1.1 |
# Fix ncurses b0rking (if r5 isn't unmerged) |
| 557 |
|
|
find ${ROOT}/usr/lib/gcc-lib -name '*curses.h' -exec rm -f {} \; |
| 558 |
|
|
} |