Magellan Linux

Contents of /branches/magellan-next/core/gcc/gcc-4.6.2-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9112 - (show annotations) (download)
Mon Nov 7 12:26:25 2011 UTC (12 years, 6 months ago) by niro
File size: 5537 byte(s)
auto added: ver bump to 4.6.2-r1
1 # $Id$
2
3 PNAME="gcc"
4 PVER="4.6.2"
5 PBUILD="r1"
6
7 PCATEGORIE="sys-dev"
8
9 HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html"
10
11 SDEPEND="== sys-libs/libstdc++-${PVER}
12 >= sys-dev/binutils-2.21
13 >= virtual/glibc
14 >= dev-libs/gmp-5.0.2
15 >= dev-libs/mpfr-3.0.1
16 >= dev-libs/mpc-0.9
17 >= dev-libs/ppl-0.11.2
18 >= dev-libs/cloog-ppl-0.15.11
19 >= dev-libs/elfutils-0.152
20 >= virtual/kernel-headers"
21
22 SPLIT_PACKAGES="libstdc++ gcc"
23
24 SRCFILE="${PNAME}-${PVER}.tar.bz2"
25 SRCDIR="${BUILDDIR}/${PNAME}-${PVER}"
26
27 # languages to build into gcc
28 MyLanguages=c,c++
29
30 sminclude mtools cleanutils libtool
31
32 SRC_URI=(
33 gnu://${PNAME}/${PNAME}-${PVER}/${SRCFILE}
34 mirror://${PNAME}/${SRCFILE}
35 mirror://${PNAME}/${PNAME}-4.5.1-no-fixincludes.patch
36 )
37
38 UP2DATE="updatecmd \"http://ftp.gnu.org/gnu/${PNAME}/?C=M;O=A\" | sed -n 's/.*${PNAME}-\(.*\)\//\1/;$ p'"
39
40 # gcc don't like strong CFLAGS
41 export CFLAGS="${CFLAGS//-O?} -O2"
42 export CXXFLAGS="${CFLAGS}"
43
44 # check for crosscompile or export default CHOST
45 if [[ -z ${CCHOST} ]]
46 then
47 # no crosscompile defined
48 export CCHOST=${CHOST}
49 else
50 # use crosscompile host
51 export CCHOST=${CCHOST}
52 fi
53
54 split_info_gcc()
55 {
56 DESCRIPTION="Modern C/C++ compiler written by the GNU people."
57 DEPEND="== sys-libs/libstdc++-${PVER}
58 >= sys-dev/binutils-2.20
59 >= virtual/glibc
60 >= dev-libs/gmp-5.0.1
61 >= dev-libs/mpfr-3.0.0
62 >= dev-libs/mpc-0.8.2
63 >= dev-libs/ppl-0.10.2
64 >= dev-libs/cloog-ppl-0.15.9
65 >= dev-libs/elfutils-0.151"
66 }
67
68 split_info_libstdc++()
69 {
70 DESCRIPTION="Standard GNU C and C++ libraries."
71 DEPEND=">= sys-apps/base-files-0.1"
72 PCATEGORIE="sys-libs"
73 }
74
75 src_prepare()
76 {
77 munpack ${SRCFILE} || die
78 cd ${SRCDIR}
79
80 # generic fixes
81 mpatch ${PNAME}-4.5.1-no-fixincludes.patch || die
82
83 # suppress installation of libiberty, as we will be
84 # using the one from binutils
85 sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in || die
86
87 install -d ${SRCDIR}/build || die
88 cd ${SRCDIR}/build
89 }
90
91 src_compile()
92 {
93 cd ${SRCDIR}/build
94
95 local myconf
96
97 # you better off when not using distcc to compile
98 # your new compiler :) maybe not all are the same
99 export SMAGE_USE_DISTCC=false
100
101 # Straight from the GCC install doc:
102 # "GCC has code to correctly determine the correct value for target
103 # for nearly all native systems. Therefore, we highly recommend you
104 # not provide a configure target when configuring a native compiler."
105 if [[ ${CHOST} != ${CCHOST} ]]
106 then
107 myconf+=" --target=${CCHOST}"
108 fi
109
110 # gcc >= 4.3 has now configure flags for uri and version - yeah!
111 AR=ar \
112 ../configure \
113 --with-bugurl="http://bugs.magellan-linux.de/" \
114 --with-pkgversion="Magellan-Linux" \
115 --build=${CHOST} \
116 --host=${CHOST} \
117 --prefix=/usr \
118 --mandir=/usr/share/man \
119 --infodir=/usr/share/info \
120 --libdir=/usr/$(mlibdir) \
121 --libexecdir=/usr/$(mlibdir) \
122 --enable-shared \
123 --enable-threads=posix \
124 --enable-__cxa_atexit \
125 --enable-clocale=gnu \
126 --disable-checking \
127 --with-system-zlib \
128 --enable-long-long \
129 --enable-cstdio=stdio \
130 --enable-languages=${MyLanguages} \
131 --disable-libstdcxx-pch \
132 --enable-gnu-unique-object \
133 --enable-lto \
134 --enable-plugin \
135 --enable-gold \
136 ${myconf} \
137 || die
138
139 # parallel builds seems to break sometimes on x86_64
140 local myopts
141 [[ ${ARCH} = x86_64 ]] && myopts=-j1
142
143 mmake ${myopts} bootstrap-lean || die
144 }
145
146 src_install_gcc()
147 {
148 cd ${SRCDIR}/build
149 minstalldir /$(mlibdir) || die
150
151 # install all targets
152 make DESTDIR=${BINDIR} install || die
153
154 # versionize all bins and symlink them
155 for bin in $(find ${BINDIR}/usr/bin -type f)
156 do
157 echo ${bin}
158 mv ${bin} ${bin}-${PVER} || die
159 ln -snf $(basename ${bin}-${PVER}) ${bin} || die
160 done
161
162 mlink ../usr/bin/cpp-${PVER} /$(mlibdir)/cpp || die
163 # this one is needed on multilib systems.
164 # rpcgen may not find the cpp compiler correctly if not in /lib/cpp
165 if [[ $(mlibdir) != lib ]]
166 then
167 minstalldir /lib || die
168 mlink ../usr/bin/cpp-${PVER} /lib/cpp || die
169 fi
170 mlink gcc-${PVER} /usr/bin/cc || die
171
172 # deletes libstdc++ && libgcc_s && libssp && libgomp
173 rm ${BINDIR}/usr/$(mlibdir)/{libgcc_s*.*,libstdc++*.*,libssp*.*,libgomp*.*} || die
174 if [[ $(mlibdir) != lib ]] && [[ -d ${BINDIR}/usr/lib ]]
175 then
176 rm ${BINDIR}/usr/lib/{libgcc_s*.*,libstdc++*.*,libssp*.*,libgomp*.*} || die
177 fi
178
179 # fix all .la files
180 # they may contain invalid libpathes which are not needed
181 local la
182 for la in $(find ${BINDIR} -name \*.la)
183 do
184 fix_la_file ${la} || die ${la}
185 done
186 }
187
188 src_install_libstdc++()
189 {
190 cd ${SRCDIR}/build
191 minstalldir /$(mlibdir) || die
192
193 local target
194 for target in libstdc++-v3 libgcc libssp libgomp
195 do
196 make DESTDIR=${BINDIR} install-target-${target} || die
197 done
198
199 # move gdb scripts to a proper location and to pretty-print ldconfig
200 minstalldir /usr/share/gdb/autoload/usr/$(mlibdir) || die
201 mv ${BINDIR}/usr/$(mlibdir)/libstdc++*gdb.py* ${BINDIR}/usr/share/gdb/autoload/usr/$(mlibdir)/ || die
202 # multilib as well
203 if [[ $(mlibdir) != lib ]] && [[ -d ${BINDIR}/usr/lib ]]
204 then
205 minstalldir /usr/share/gdb/autoload/usr/lib || die
206 mv ${BINDIR}/usr/lib/libstdc++*gdb.py* ${BINDIR}/usr/share/gdb/autoload/usr/lib/ || die
207 fi
208
209 # cleanup, only keep the libs, everything else get provided by the gcc-package
210 zapmost ${BINDIR}/usr/$(mlibdir) libgcc_s*.* libstdc++*.* libssp*.* libgomp*.* || die
211 # multilib as well
212 if [[ $(mlibdir) != lib ]] && [[ -d ${BINDIR}/usr/lib ]]
213 then
214 zapmost ${BINDIR}/usr/lib libgcc_s*.* libstdc++*.* libssp*.* libgomp*.* || die
215 fi
216
217 # clean up everything else
218 zapmost ${BINDIR} usr/$(mlibdir) $([[ $(mlibdir) != lib ]] && echo "usr/lib") || die
219 }