/[gentoo-x86]/sys-devel/gcc/gcc-3.1.1-r2.ebuild
Gentoo

Contents of /sys-devel/gcc/gcc-3.1.1-r2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (show annotations) (download)
Wed Jul 20 08:58:35 2011 UTC (3 years, 7 months ago) by dirtyepic
Branch: MAIN
Changes since 1.11: +61 -61 lines
Repoman talks too much.

(Portage version: 2.2.0_alpha46/cvs/Linux x86_64)

1 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.1.1-r2.ebuild,v 1.11 2009/09/23 21:28:19 patrick Exp $
4
5 # NOTE TO MAINTAINER: Info pages get nuked for multiple version installs.
6 # Ill fix it later if i get a chance.
7 #
8 # IMPORTANT: The versions of libs installed should be updated
9 # in src_install() ... Ill implement auto-version detection
10 # later on.
11
12 inherit flag-o-matic libtool eutils
13
14 do_filter_flags() {
15 # Compile problems with these ...
16 filter-flags -fno-exceptions
17
18 # In general gcc does not like optimization, and add -O2 where
19 # it is safe.
20 filter-flags -O?
21 }
22
23 MY_PV="`echo ${PV} | cut -d. -f1,2`"
24 GCC_SUFFIX=-${MY_PV}
25 LOC="/usr"
26 # dont install in /usr/include/g++-v3/, as it will nuke gcc-3.0.x installs
27 STDCXX_INCDIR="${LOC}/include/g++-v${MY_PV/\./}"
28
29 DESCRIPTION="The GNU Compiler Collection"
30 HOMEPAGE="http://gcc.gnu.org/"
31 SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/${P}/${P}.tar.bz2
32 http://www.ibiblio.org/gentoo/distfiles/${P}_final-patches-1.0.tbz2"
33
34 LICENSE="GPL-2 LGPL-2.1"
35 SLOT="${MY_PV}"
36 KEYWORDS="x86 sparc -ppc"
37 IUSE="static nls bootstrap java build"
38
39 DEPEND="!build? ( >=sys-libs/ncurses-5.2-r2
40 nls? ( sys-devel/gettext ) )"
41 RDEPEND=">=sys-libs/zlib-1.1.4
42 >=sys-apps/texinfo-4.2-r4
43 !build? ( >=sys-libs/ncurses-5.2-r2 )"
44
45 build_multiple() {
46 #try to make sure that we should build multiple
47 #versions of gcc (dual install of gcc2 and gcc3)
48 profile="`readlink /etc/make.profile`"
49 # [ "`gcc -dumpversion | cut -d. -f1,2`" != "`echo ${PV} | cut -d. -f1,2`" ]
50 #
51 # Check the major and minor versions only, and drop the micro version.
52 # This is done, as compadibility only differ when major and minor differ.
53 if ! use build && ! use bootstrap && \
54 [ "`gcc -dumpversion | cut -d. -f1,2`" != "${MY_PV}" ] && \
55 [ "${profile/gcc3}" = "${profile}" ] && \
56 [ "${GCCBUILD}" != "default" ]
57 then
58 return 0
59 else
60 return 1
61 fi
62 }
63
64 # used to patch Makefiles to install into the build dir
65 FAKE_ROOT=""
66
67 src_unpack() {
68 unpack ${P}.tar.bz2
69
70 cd "${S}"
71 # Fixup libtool to correctly generate .la files with portage
72 elibtoolize --portage --shallow
73
74 mkdir -p "${WORKDIR}"/patch
75 tar -jxf "${DISTDIR}"/${P}_final-patches-1.0.tbz2 -C "${WORKDIR}"/patch \
76 || die "Could not unpack patches"
77 for f in "${WORKDIR}"/patch/*.patch ; do
78 epatch ${f}
79 done
80
81 # Currently if any path is changed via the configure script, it breaks
82 # installing into ${D}. We should not patch it in src_install() with
83 # absolute paths, as some modules then gets rebuild with the wrong
84 # paths. Thus we use $FAKE_ROOT.
85 cd "${S}"
86 for x in $(find . -name Makefile.in)
87 do
88 # cp ${x} ${x}.orig
89 # Fix --datadir=
90 # sed -e 's:datadir = @datadir@:datadir = $(FAKE_ROOT)@datadir@:' \
91 # ${x}.orig > ${x}
92 cp ${x} ${x}.orig
93 # Fix --with-gxx-include-dir=
94 sed -e 's:gxx_include_dir = @gxx_:gxx_include_dir = $(FAKE_ROOT)@gxx_:' \
95 -e 's:glibcppinstalldir = @gxx_:glibcppinstalldir = $(FAKE_ROOT)@gxx_:' \
96 ${x}.orig > ${x}
97 rm -f ${x}.orig
98 done
99 }
100
101 src_compile() {
102 local myconf=""
103 local gcc_lang=""
104 if ! use build
105 then
106 myconf="${myconf} --enable-shared"
107 gcc_lang="c,c++,f77,objc"
108 else
109 gcc_lang="c"
110 fi
111 if ! use nls || use build
112 then
113 myconf="${myconf} --disable-nls"
114 else
115 myconf="${myconf} --enable-nls --without-included-gettext"
116 fi
117 if use java && ! use build
118 then
119 gcc_lang="${gcc_lang},java"
120 fi
121
122 #only build with a program suffix if it is not our
123 #default compiler. Also check $GCCBUILD until we got
124 #compilers sorted out.
125 #
126 #NOTE: for software to detirmine gcc version, it will be easier
127 # if we have gcc, gcc-3.0 and gcc-3.1, and NOT gcc-3.0.4.
128 if build_multiple
129 then
130 myconf="${myconf} --program-suffix=${GCC_SUFFIX}"
131 fi
132
133 # Make sure we have sane CFLAGS
134 do_filter_flags
135
136 #build in a separate build tree
137 mkdir -p "${WORKDIR}"/build
138 cd "${WORKDIR}"/build
139
140 addwrite "/dev/zero"
141 "${S}"/configure --prefix=${LOC} \
142 --mandir=${LOC}/share/man \
143 --infodir=${LOC}/share/info \
144 --enable-shared \
145 --host=${CHOST} \
146 --build=${CHOST} \
147 --target=${CHOST} \
148 --with-system-zlib \
149 --enable-languages=${gcc_lang} \
150 --enable-threads=posix \
151 --enable-long-long \
152 --disable-checking \
153 --enable-cstdio=stdio \
154 --enable-clocale=generic \
155 --enable-version-specific-runtime-libs \
156 --with-gxx-include-dir=${STDCXX_INCDIR} \
157 --with-local-prefix=${LOC}/local \
158 ${myconf} || die
159
160 touch "${S}"/gcc/c-gperf.h
161
162 if ! use static
163 then
164 #fix for our libtool-portage.patch
165 S="${WORKDIR}/build" \
166 emake bootstrap-lean || die
167 else
168 S="${WORKDIR}/build" \
169 emake LDFLAGS=-static bootstrap || die
170 fi
171 }
172
173 src_install() {
174 #make install from the build directory
175 cd "${WORKDIR}"/build
176 S="${WORKDIR}/build" \
177 make prefix="${D}"${LOC} \
178 mandir="${D}"${LOC}/share/man \
179 infodir="${D}"${LOC}/share/info \
180 FAKE_ROOT="${D}" \
181 install || die
182
183 if ! build_multiple
184 then
185 GCC_SUFFIX=""
186 fi
187
188 [ -e "${D}"${LOC}/bin/gcc${GCC_SUFFIX} ] || die "gcc not found in ${D}"
189
190 FULLPATH=${LOC}/lib/gcc-lib/${CHOST}/${PV}
191 FULLPATH_D=${D}${LOC}/lib/gcc-lib/${CHOST}/${PV}
192 cd "${FULLPATH_D}"
193 dodir /lib
194 dodir /etc/env.d
195 echo "LDPATH=${FULLPATH}" > "${D}"/etc/env.d/05gcc${GCC_SUFFIX}
196 echo "CC=\"gcc\"" >> "${D}"/etc/env.d/05gcc${GCC_SUFFIX}
197 echo "CXX=\"g++\"" >> "${D}"/etc/env.d/05gcc${GCC_SUFFIX}
198 if ! build_multiple
199 then
200 dosym /usr/bin/cpp /lib/cpp
201 dosym gcc /usr/bin/cc
202 fi
203
204 # gcc-3.1 have a problem with the ordering of Search Directories. For
205 # instance, if you have libreadline.so in /lib, and libreadline.a in
206 # /usr/lib, then it will link with libreadline.a instead of .so. As far
207 # as I can see from the source, /lib should be searched before /usr/lib,
208 # and this also differs from gcc-2.95.3 and possibly 3.0.4, but ill have
209 # to check on 3.0.4. Thanks to Daniel Robbins for noticing this oddity,
210 # bugzilla bug #4411
211 #
212 # Azarah - 3 Jul 2002
213 #
214 cd "${FULLPATH_D}"
215 dosed -e "s:%{L\*} %(link_libgcc):%{L\*} -L/lib %(link_libgcc):" \
216 "${FULLPATH}"/specs
217
218 #make sure we dont have stuff lying around that
219 #can nuke multiple versions of gcc
220 if ! use build
221 then
222 cd "${FULLPATH_D}"
223
224 #Tell libtool files where real libraries are
225 for LA in "${D}"${LOC}/lib/*.la "${FULLPATH_D}"/../*.la
226 do
227 if [ -f ${LA} ]
228 then
229 sed -e "s:/usr/lib:${FULLPATH}:" ${LA} > ${LA}.hacked
230 mv ${LA}.hacked ${LA}
231 mv ${LA} "${FULLPATH_D}"
232 fi
233 done
234
235 #move all the libraries to version specific libdir.
236 for x in "${D}"${LOC}/lib/*.{so,a}* "${FULLPATH_D}"/../*.{so,a}*
237 do
238 [ -f ${x} ] && mv -f ${x} "${FULLPATH_D}"
239 done
240
241 #move Java headers to compiler-specific dir
242 for x in "${D}"${LOC}/include/gc*.h "${D}"${LOC}/include/j*.h
243 do
244 [ -f ${x} ] && mv -f ${x} "${FULLPATH_D}"/include/
245 done
246 for x in gcj gnu java javax org
247 do
248 if [ -d "${D}"${LOC}/include/${x} ]
249 then
250 mkdir -p "${FULLPATH_D}"/include/${x}
251 mv -f "${D}"${LOC}/include/${x}/* "${FULLPATH_D}"/include/${x}/
252 rm -rf "${D}"${LOC}/include/${x}
253 fi
254 done
255
256 #move libgcj.spec to compiler-specific directories
257 [ -f "${D}"${LOC}/lib/libgcj.spec ] && \
258 mv -f "${D}"${LOC}/lib/libgcj.spec "${FULLPATH_D}"/libgcj.spec
259
260 #rename jar because it could clash with Kaffe's jar if this gcc is
261 #primary compiler (aka don't have the -<version> extension)
262 cd "${D}"${LOC}/bin
263 [ -f jar${GCC_SUFFIX} ] && mv -f jar${GCC_SUFFIX} gcj-jar${GCC_SUFFIX}
264
265 #move <cxxabi.h> to compiler-specific directories
266 [ -f "${D}"${STDCXX_INCDIR}/cxxabi.h ] && \
267 mv -f "${D}"${STDCXX_INCDIR}/cxxabi.h "${FULLPATH_D}"/include/
268
269 if build_multiple
270 then
271 #now fix the manpages
272 cd "${D}"${LOC}/share/man/man1
273 mv cpp.1 cpp${GCC_SUFFIX}.1
274 mv gcov.1 gcov${GCC_SUFFIX}.1
275 fi
276 fi
277
278 #this one comes with binutils
279 if [ -f "${D}"${LOC}/lib/libiberty.a ]
280 then
281 rm -f "${D}"${LOC}/lib/libiberty.a
282 fi
283
284 cd "${S}"
285 if ! use build
286 then
287 cd "${S}"
288 docinto /
289 dodoc ChangeLog LAST_UPDATED README MAINTAINERS
290 cd "${S}"/boehm-gc
291 docinto boehm-gc
292 dodoc ChangeLog doc/{README*,barrett_diagram}
293 docinto boehm-gc/html
294 dohtml doc/*.html
295 cd "${S}"/gcc
296 docinto gcc
297 dodoc ChangeLog* FSFChangeLog* LANGUAGES NEWS ONEWS \
298 README* SERVICE
299 cd "${S}"/libf2c
300 docinto libf2c
301 dodoc ChangeLog README TODO changes.netlib disclaimer.netlib \
302 permission.netlib readme.netlib
303 cd "${S}"/libffi
304 docinto libffi
305 dodoc ChangeLog* README
306 cd "${S}"/libiberty
307 docinto libiberty
308 dodoc ChangeLog README
309 cd "${S}"/libobjc
310 docinto libobjc
311 dodoc ChangeLog README* THREADS*
312 cd "${S}"/libstdc++-v3
313 docinto libstdc++-v3
314 dodoc ChangeLog* README
315
316 if use java
317 then
318 cd "${S}"/fastjar
319 docinto fastjar
320 dodoc AUTHORS CHANGES ChangeLog NEWS README
321 cd "${S}"/libjava
322 docinto libjava
323 dodoc ChangeLog* HACKING NEWS README THANKS
324 fi
325 else
326 rm -rf "${D}"/usr/share/{man,info}
327 fi
328
329 # Fix ncurses b0rking
330 find "${D}"/ -name '*curses.h' -exec rm -f {} \;
331 }
332
333 pkg_postrm() {
334 if [ ! -L "${ROOT}"/lib/cpp ]
335 then
336 ln -sf /usr/bin/cpp "${ROOT}"/lib/cpp
337 fi
338 if [ ! -L "${ROOT}"/usr/bin/cc ]
339 then
340 ln -sf gcc "${ROOT}"/usr/bin/cc
341 fi
342
343 # Fix ncurses b0rking (if r5 isn't unmerged)
344 find "${ROOT}"/usr/lib/gcc-lib -name '*curses.h' -exec rm -f {} \;
345 }

  ViewVC Help
Powered by ViewVC 1.1.20