/[gentoo-x86]/sys-devel/gcc/gcc-2.95.3-r9.ebuild
Gentoo

Contents of /sys-devel/gcc/gcc-2.95.3-r9.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations) (download)
Wed Jul 20 08:58:35 2011 UTC (3 years, 1 month ago) by dirtyepic
Branch: MAIN
Changes since 1.7: +19 -19 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-2.95.3-r9.ebuild,v 1.7 2008/03/20 20:39:50 vapier Exp $
4
5 inherit eutils flag-o-matic toolchain-funcs versionator fixheadtails gnuconfig
6
7 # The next command strips most flags from CFLAGS/CXXFLAGS. If you do
8 # not like it, comment it out, but do not file bugreports if you run into
9 # problems.
10 do_filter_flags() {
11 strip-flags
12
13 # In general gcc does not like optimization ... we'll add -O2 where safe
14 filter-flags -O?
15
16 # Compile problems with these (bug #6641 among others)...
17 filter-flags -fno-exceptions -fomit-frame-pointer -ggdb
18
19 # Are we trying to compile with gcc3 ? CFLAGS and CXXFLAGS needs to be
20 # valid for gcc-2.95.3 ...
21 if [[ $(tc-arch) == "x86" || $(tc-arch) == "amd64" ]] ; then
22 CFLAGS=${CFLAGS//-mtune=/-mcpu=}
23 CXXFLAGS=${CXXFLAGS//-mtune=/-mcpu=}
24 fi
25
26 replace-cpu-flags k6-{2,3} k6
27 replace-cpu-flags athlon{,-{tbird,4,xp,mp}} i686
28
29 replace-cpu-flags pentium-mmx i586
30 replace-cpu-flags pentium{2,3,4} i686
31
32 replace-cpu-flags ev6{7,8} ev6
33
34 export CFLAGS CXXFLAGS
35 }
36
37 export CTARGET=${CTARGET:-${CHOST}}
38 if [[ ${CTARGET} = ${CHOST} ]] ; then
39 if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
40 export CTARGET=${CATEGORY/cross-}
41 fi
42 fi
43
44 LOC="/usr"
45 GCC_BRANCH_VER="$(get_version_component_range 1-2)"
46 GCC_RELEASE_VER="$(get_version_component_range 1-3)"
47
48 LIBPATH="${LOC}/lib/gcc-lib/${CTARGET}/${GCC_RELEASE_VER}"
49 BINPATH="${LOC}/${CTARGET}/gcc-bin/${GCC_BRANCH_VER}"
50 DATAPATH="${LOC}/share/gcc-data/${CTARGET}/${GCC_BRANCH_VER}"
51 # Dont install in /usr/include/g++/, but in gcc internal directory.
52 # We will handle /usr/include/g++/ with gcc-config ...
53 STDCXX_INCDIR="${LIBPATH}/include/g++"
54
55 PATCH_VER=1.2
56 DESCRIPTION="The GNU Compiler Collection"
57 HOMEPAGE="http://gcc.gnu.org/"
58 SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/${P}/${P}.tar.gz
59 mirror://gentoo/${P}-patches-${PATCH_VER}.tar.bz2"
60
61 LICENSE="GPL-2 LGPL-2.1"
62 KEYWORDS="x86 ppc sparc alpha"
63 IUSE="static nls build multislot nocxx fortran"
64
65 if use multislot ; then
66 SLOT="${CTARGET}-${GCC_CONFIG_VER}"
67 elif [[ ${CTARGET} != ${CHOST} ]] ; then
68 SLOT="${CTARGET}-${GCC_BRANCH_VER}"
69 else
70 SLOT="${GCC_BRANCH_VER}"
71 fi
72
73 RDEPEND=">=sys-devel/gcc-config-1.4
74 >=sys-libs/zlib-1.1.4
75 >=sys-apps/texinfo-4.2-r4
76 !build? ( >=sys-libs/ncurses-5.2-r2 )"
77 DEPEND="${RDEPEND}
78 !build? ( nls? ( sys-devel/gettext ) )"
79
80 # Hack used to patch Makefiles to install into the build dir
81 FAKE_ROOT=""
82
83 src_unpack() {
84 unpack ${P}.tar.gz
85 unpack ${P}-patches-${PATCH_VER}.tar.bz2
86 [[ $(tc-arch ${TARGET}) == "alpha" ]] \
87 && rm -f "${EPATCH_SOURCE}"/10_all_new-atexit.patch
88
89 cd "${S}"
90 epatch
91
92 # Fixup libtool to correctly generate .la files with portage
93 libtoolize --copy --force
94
95 # Fix outdated head/tails format #65668
96 ht_fix_file configure gcc/Makefile.in
97
98 # Currently if any path is changed via the configure script, it breaks
99 # installing into ${D}. We should not patch it in src_install() with
100 # absolute paths, as some modules then gets rebuild with the wrong
101 # paths. Thus we use $FAKE_ROOT.
102 for x in $(find . -name Makefile.in) ; do
103 sed -i \
104 -e 's:datadir = @datadir@:datadir = $(FAKE_ROOT)@datadir@:' \
105 -e 's:bindir = @bindir@:bindir = $(FAKE_ROOT)@bindir@:' \
106 -e 's:gxx_include_dir=${includedir}:gxx_include_dir=$(FAKE_ROOT)${includedir}:' \
107 ${x} || die "could not sed $x"
108 done
109
110 gnuconfig_update
111 }
112
113 src_compile() {
114 export LINGUAS=""
115
116 # Make sure we have sane CFLAGS
117 do_filter_flags
118
119 # Build in a separate build tree
120 mkdir -p "${WORKDIR}"/build
121 cd "${WORKDIR}"/build
122
123 local gcclangs="c"
124 local myconf=""
125 if use build ; then
126 myconf="--disable-nls"
127 else
128 myconf=""
129 use !nocxx && gcclangs="${gcclangs},c++"
130 use fortran && gcclangs="${gcclangs},f77"
131 use nls && myconf="${myconf} --enable-nls --without-included-gettext"
132 fi
133 [[ -n ${CBUILD} ]] && myconf="${myconf} --build=${CBUILD}"
134 [[ ${CHOST} == ${CTARGET} ]] \
135 && myconf="${myconf} --enable-shared --enable-threads=posix" \
136 || myconf="${myconf} --disable-shared --disable-threads"
137 myconf="--prefix=${LOC}
138 --bindir=${BINPATH}
139 --datadir=${DATAPATH}
140 --mandir=${DATAPATH}/man
141 --infodir=${DATAPATH}/info
142 --host=${CHOST}
143 --target=${CTARGET}
144 --with-system-zlib
145 --enable-long-long
146 --enable-version-specific-runtime-libs
147 --with-local-prefix=${LOC}/local
148 --enable-languages=${gcclangs}
149 ${myconf}
150 ${EXTRA_ECONF}"
151 echo ./configure "${myconf}"
152 addwrite "/dev/zero"
153 "${S}"/configure ${myconf} || die "configure failed"
154
155 touch "${S}"/gcc/c-gperf.h
156
157 if ! use static ; then
158 # Fix for our libtool-portage.patch
159 S="${WORKDIR}/build" \
160 emake bootstrap-lean \
161 LIBPATH="${LIBPATH}" STAGE1_CFLAGS="-O" || die "make failed"
162 # Above FLAGS optimize and speedup build, thanks
163 # to Jeff Garzik <jgarzik@mandrakesoft.com>
164 else
165 S="${WORKDIR}/build" \
166 emake LDFLAGS=-static bootstrap \
167 LIBPATH="${LIBPATH}" STAGE1_CFLAGS="-O" || die "make static failed"
168 fi
169 }
170
171 src_install() {
172 # Do allow symlinks in ${LOC}/lib/gcc-lib/${CHOST}/${PV}/include as
173 # this can break the build.
174 for x in "${WORKDIR}"/build/gcc/include/* ; do
175 [[ -L ${x} ]] && rm -f "${x}"
176 done
177
178 # Do the 'make install' from the build directory
179 cd "${WORKDIR}"/build
180 S="${WORKDIR}/build" \
181 make \
182 prefix=${D}${LOC} \
183 bindir=${D}${BINPATH} \
184 datadir=${D}${DATAPATH} \
185 mandir=${D}${DATAPATH}/man \
186 infodir=${D}${DATAPATH}/info \
187 LIBPATH="${LIBPATH}" \
188 FAKE_ROOT="${D}" \
189 install || die
190
191 [[ -r ${D}${BINPATH}/gcc ]] || die "gcc not found in ${D}"
192
193 dodir /lib /usr/bin
194 dodir /etc/env.d/gcc
195 cat << EOF > "${D}"/etc/env.d/gcc/${CTARGET}-${GCC_RELEASE_VER}
196 PATH="${BINPATH}"
197 ROOTPATH="${BINPATH}"
198 LDPATH="${LIBPATH}"
199 MANPATH="${DATAPATH}/man"
200 INFOPATH="${DATAPATH}/info"
201 STDCXX_INCDIR="${STDCXX_INCDIR##*/}"
202 EOF
203
204 # Make sure we dont have stuff lying around that
205 # can nuke multiple versions of gcc
206 if ! use build ; then
207 cd "${D}"${LIBPATH}
208
209 # Tell libtool files where real libraries are
210 for LA in "${D}"${LOC}/lib/*.la "${D}"${LIBPATH}/../*.la ; do
211 if [[ -f ${LA} ]] ; then
212 sed -i -e "s:/usr/lib:${LIBPATH}:" "${LA}"
213 mv "${LA}" "${D}"${LIBPATH}
214 fi
215 done
216
217 # Move all the libraries to version specific libdir.
218 for x in "${D}"${LOC}/lib/*.{so,a}* "${D}"${LIBPATH}/../*.{so,a}* ; do
219 [[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}
220 done
221
222 # These should be symlinks
223 cd "${D}"${BINPATH}
224 for x in gcc g++ c++ g77 gcj ; do
225 # For some reason, g77 gets made instead of ${CTARGET}-g77... this makes it safe
226 [[ -f ${x} ]] && mv ${x} ${CTARGET}-${x}
227
228 if [[ ${CHOST} == ${CTARGET} ]] && [[ -f ${CTARGET}-${x} ]] ; then
229 [[ ! -f ${x} ]] && mv ${CTARGET}-${x} ${x}
230 ln -sf ${x} ${CTARGET}-${x}
231 fi
232 done
233 fi
234
235 # This one comes with binutils
236 rm -f "${D}"${LOC}/lib/libiberty.a
237
238 cd "${S}"
239 if use build ; then
240 rm -r "${D}"/usr/share/{man,info}
241 rm -r "${D}"/${DATAPATH}/{man,info}
242 elif ! has nodoc ${FEATURES} ; then
243 cd "${S}"
244 docinto /
245 dodoc README* FAQ MAINTAINERS
246 docinto html
247 dodoc faq.html
248 docinto gcc
249 cd "${S}"/gcc
250 dodoc BUGS ChangeLog* FSFChangeLog* LANGUAGES NEWS PROBLEMS README* SERVICE TESTS.FLUNK
251 cd "${S}"/libchill
252 docinto libchill
253 dodoc ChangeLog
254 cd "${S}"/libf2c
255 docinto libf2c
256 dodoc ChangeLog changes.netlib README TODO
257 cd "${S}"/libio
258 docinto libio
259 dodoc ChangeLog NEWS README
260 cd dbz
261 docinto libio/dbz
262 dodoc README
263 cd ../stdio
264 docinto libio/stdio
265 dodoc ChangeLog*
266 cd "${S}"/libobjc
267 docinto libobjc
268 dodoc ChangeLog README* THREADS*
269 cd "${S}"/libstdc++
270 docinto libstdc++
271 dodoc ChangeLog NEWS
272 fi
273 has noman ${FEATURES} && rm -r "${D}"/${DATAPATH}/man
274 has noinfo ${FEATURES} && rm -r "${D}"/${DATAPATH}/info
275 }
276
277 pkg_postinst() {
278 [[ ${ROOT} != "/" ]] && return 0
279 gcc-config --use-portage-chost ${CTARGET}-${GCC_RELEASE_VER}
280 }

  ViewVC Help
Powered by ViewVC 1.1.20