Magellan Linux

Contents of /smage/trunk/core/gcc/gcc-4.6.1-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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