Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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