Magellan Linux

Contents of /trunk/toolchain/toolchain-glibc/toolchain-glibc-2.3.5-r3.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 153 - (show annotations) (download)
Mon Jul 4 00:41:38 2005 UTC (18 years, 10 months ago) by niro
File size: 3511 byte(s)
new toolchain create utilities and smages

1 # $Header: /home/cvsd/magellan-cvs/magellan-src/toolchain/toolchain-glibc/toolchain-glibc-2.3.5-r3.smage2,v 1.1 2005-07-04 00:41:38 niro Exp $
2
3 PNAME="toolchain-glibc"
4 PVER="2.3.5"
5 PBUILD="r3"
6
7 SRCFILE="glibc-${PVER}.tar.bz2"
8 SRCDIR="${BUILDDIR}/glibc-${PVER}"
9
10 LINUXTHREADS="glibc-linuxthreads-${PVER}.tar.bz2"
11
12 SRC_URI=(
13 mirror://glibc/${SRCFILE}
14 mirror://glibc/${LINUXTHREADS}
15 mirror://glibc/glibc-2.3.5-fix_test-1.patch
16 )
17
18 ## global toolchain var ##
19 # export CFLAGS, CHOST, TOOLCHAIN_PREFIX
20 export CFLAGS="-mtune=i486 -Os -pipe"
21 export CXXFLAGS="${CFLAGS}"
22 export TOOLCHAIN_PREFIX="/tools"
23
24 zapmost() {
25 local rootdir
26 rootdir="${1}/"
27 [ ! -e "$rootdir" ] && echo "zapmost: $rootdir not found; skipping..." && return 1
28 install -d ${BUILDDIR}/zap
29 local dirs
30 shift
31 local x
32 for x in ${*}
33 do
34 if [ "${x##*/}" = "${x}" ]
35 then
36 #one deep
37 mv ${rootdir}${x} ${BUILDDIR}/zap
38 else
39 #more than one deep; create intermediate directories
40 dirs=${x%/*}
41 install -d ${BUILDDIR}/zap/${dirs}
42 mv ${rootdir}${x} ${BUILDDIR}/zap/${x}
43 fi
44 done
45 rm -rf ${rootdir}*
46 mv ${BUILDDIR}/zap/* ${rootdir}
47 }
48
49 # glibc -> nptl thread don't like striping
50 NOSTRIP=true
51
52 # gcc 3.0 - 3.3 needs this:
53 export CFLAGS="${CFLAGS} -finline-limit=2000"
54 export CXXFLAGS="${CFLAGS}"
55 export LDFLAGS="${LDFLAGS//-Wl,--relax}"
56
57 # use other linux-headers
58 [ -z "${ALT_HEADERS}" ] && export ALT_HEADERS="/usr/include"
59
60 # needs:
61 # compile time: 54m16.506s (Athlon XP 1600+, 256mb DDR333)
62
63 src_prepare() {
64 munpack ${SRCFILE} || die
65 munpack ${LINUXTHREADS} ${SRCDIR} || die
66 cd ${SRCDIR}
67
68 # disable binutils -as-needed
69 sed -e 's/^have-as-needed.*/have-as-needed = no/' -i ${SRCDIR}/config.make.in || die
70
71 # fix some tests which will fail with a kernel-2.6.11.x
72 mpatch -Np1 glibc-2.3.5-fix_test-1.patch || die
73
74 # fix permissions on some of the scripts
75 chmod u+x ${SRCDIR}/scripts/*.sh || die
76
77 mkdir ${SRCDIR}/build || die
78 cd ${SRCDIR}/build
79
80 touch /etc/ld.so.conf || die
81 }
82
83 src_compile() {
84 cd ${SRCDIR}/build
85
86 # linuxthreads kernel-2.4 enabled glibc
87 ../configure \
88 --build=${CHOST} \
89 --host=${CHOST} \
90 --prefix=${TOOLCHAIN_PREFIX} \
91 --disable-profile \
92 --enable-add-ons=linuxthreads \
93 --without-__thread \
94 --enable-kernel=2.4.1 \
95 --without-cvs \
96 --with-headers=${ALT_HEADERS} \
97 --without-gd \
98 --without-selinux \
99 --disable-nls \
100 || die
101
102 make PARALLELMFLAGS="-j2" || die
103 }
104
105 src_install() {
106 cd ${SRCDIR}/build
107
108 make PARALLELMFLAGS="-j2" install_root=${BINDIR} install || die
109
110 # strip all binaries
111 find ${BINDIR} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die
112
113 # strip all libraries
114 # want to be safe here; --strip-unneeded seems to cause pthread problems
115 # strip all but libpthread
116 install -d ${BUILDDIR}/thread-backup || die
117 mv ${BINDIR}${TOOLCHAIN_PREFIX}/lib/lib{pthread,thread_db}* ${BUILDDIR}/thread-backup/ || die
118 # now strip
119 find ${BINDIR} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die
120 mv -f ${BUILDDIR}/thread-backup/* ${BINDIR}${TOOLCHAIN_PREFIX}/lib/ || die
121 # remove stale directory
122 rm -rf ${BUILDDIR}/thread-backup || die
123
124 # remove unwanted stuff
125 KEEPFILES="bin/ldd bin/getent lib sbin/ldconfig"
126 zapmost ${BINDIR}${TOOLCHAIN_PREFIX} ${KEEPFILES} || die
127
128 # remove static libs and other stale stuff
129 rm ${BINDIR}/${TOOLCHAIN_PREFIX}/lib/*.a || die
130 rm ${BINDIR}/${TOOLCHAIN_PREFIX}/lib/*crt*.o || die
131 rm -rf ${BINDIR}/${TOOLCHAIN_PREFIX}/lib/gconv || die
132 }