summaryrefslogtreecommitdiff
blob: f2fec70b4b6eeb69c00aff72c8dc0d5acc2222fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# Copyright 1999-2000 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# Author Achim Gottinger <achim@gentoo.org>
# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/glibc-2.2.3.ebuild,v 1.2 2001/05/08 07:23:45 achim Exp $

A="$P.tar.gz glibc-linuxthreads-${PV}.tar.gz"
S=${WORKDIR}/${P}
DESCRIPTION="GNU libc6 (also called glibc2) C library"
SRC_URI="ftp://sourceware.cygnus.com/pub/glibc/releases/glibc-${PV}.tar.gz
	 ftp://sourceware.cygnus.com/pub/glibc/releases/glibc-linuxthreads-${PV}.tar.gz
	 ftp://ftp.unina.it/pub/Unix/cygnus/glibc/releases/glibc-${PV}.tar.gz
	 ftp://ftp.unina.it/pub/Unix/cygnus/glibc/releases/glibc-linuxthreads-${PV}.tar.gz
	 ftp://ftp.gnu.org/pub/gnu/glibc/glibc-${PV}.tar.gz
	 ftp://ftp.gnu.org/pub/gnu/glibc/glibc-linuxthreads-${PV}.tar.gz"
HOMEPAGE="http://www.gnu.org/software/libc/libc.html"

DEPEND="nls? ( sys-devel/gettext ) gd? ( media-libs/libgd )"

RDEPEND="gd? ( sys-libs/zlib media-libs/libpng )"

PROVIDE="virtual/glibc"

src_unpack() {

    unpack glibc-${PV}.tar.gz
    cd ${S}
    unpack glibc-linuxthreads-${PV}.tar.gz
    for i in mtrace-intl-perl 
    do
      echo "Applying $i patch..."
      patch -p0 < ${FILESDIR}/glibc-2.2.2-${i}.diff
    done
    patch -p0 < ${FILESDIR}/glibc-2.2.3-libnss.diff
    cd io
    patch -p0 < ${FILESDIR}/glibc-2.2.2-test-lfs-timeout.patch


}

src_compile() {

	local myconf
	if [ "`use build`" ]
	then
	  # If we build for the build system we use the kernel headers from the target
	  myconf="--with-header=${ROOT}usr/include"
	fi
	if [ "`use gd`" ]
	then
	  myconf="${myconf} --with-gd=yes"
	else
	  myconf="${myconf} --with-gd=no"
	fi
    if [ -z "`use nls`" ]
    then
      myconf="${myconf} --disable-nls"
    fi
    rm -rf buildhere
	mkdir buildhere
	cd buildhere
	try ../configure --host=${CHOST} --without-cvs \
		--enable-add-ons=linuxthreads \
		--disable-profile --prefix=/usr \
                --mandir=/usr/share/man --infodir=/usr/share/info \
                --libexecdir=/usr/lib/misc \
		--enable-kernel=2.4.0 ${myconf}
	try make 
	make check
}


src_install() {

    rm -rf ${D}
    mkdir ${D}
    dodir /etc/rc.d/init.d
    export LC_ALL=C
    try make PARALELLMFLAGS=${MAKEOPTS} install_root=${D} install -C buildhere
    try make PARALELLMFLAGS=${MAKEOPTS} install_root=${D} info -C buildhere
    if [ -z "`use build`" ]
    then
      try make PARALELLMFLAGS=${MAKEOPTS} install_root=${D} localedata/install-locales -C buildhere

	# I commented out linuxthreads man pages because I don't want
	# glibc to build depend on perl
	#    dodir /usr/share/man/man3
	#    try make MANDIR=${D}/usr/share/man/man3 install -C linuxthreads/man
	#    cd ${D}/usr/share/man/man3
	#    for i in *.3thr
	#    do
	#      mv ${i} ${i%.3thr}.3
	#    done

      install -m 644 nscd/nscd.conf ${D}/etc
      install -m 755 ${FILESDIR}/nscd ${D}/etc/rc.d/init.d/nscd
      dodoc BUGS ChangeLog* CONFORMANCE COPYING* FAQ INTERFACE NEWS NOTES \
	  PROJECTS README*
    else
      rm -rf ${D}/usr/share/{man,info,zoneinfo}
    fi

    if [ "`use pic`" ]
    then
        find ${S}/buildhere -name "*_pic.a" -exec cp {} ${D}/lib \;
        find ${S}/buildhere -name "*.map" -exec cp {} ${D}/lib \;
        for i in ${D}/lib/*.map
        do
          mv ${i} ${i%.map}_pic.map
        done
    fi
    rm ${D}/lib/ld-linux.so.2
    rm ${D}/lib/libc.so.6
    rm ${D}/lib/libpthread.so.0
    chmod 755 ${D}/usr/lib/misc/pt_chown
 
}

pkg_preinst()
{
  # Check if we run under X
  if [ -e /usr/X11R6/bin/X ] ; then
	if [ "`/sbin/pidof /usr/X11R6/bin/X`" ] ; then
	  echo "glibc can not be installed wHile X is running!!"
	  exit 1
        fi
  fi
  echo "Saving ld-linux,libc6 and libpthread"

  /bin/cp ${ROOT}lib/ld-linux.so.2 ${ROOT}tmp
  /sbin/sln ${ROOT}tmp/ld-linux.so.2 ${ROOT}lib/ld-linux.so.2
  /bin/cp ${ROOT}lib/libc.so.6 ${ROOT}tmp
  /sbin/sln ${ROOT}tmp/libc.so.6 ${ROOT}lib/libc.so.6
  /bin/cp ${ROOT}lib/libpthread.so.0 ${ROOT}tmp
  /sbin/sln ${ROOT}tmp/libpthread.so.0 ${ROOT}lib/libpthread.so.0

	if [ -e ${ROOT}etc/localtime ]
	then
		#keeping old timezone
		if [ -e ${D}/etc/localtime ] ; then
		  /bin/rm ${D}/etc/localtime
		fi
	else
		echo "Please remember to set your timezone using the zic command."
	fi
}

pkg_postinst()
{
  echo "Setting ld-linux,libc6 and libpthread"

  /sbin/sln ${ROOT}lib/ld-${PV}.so ${ROOT}lib/ld-linux.so.2
  /sbin/sln ${ROOT}lib/libc-${PV}.so ${ROOT}lib/libc.so.6
  /sbin/sln ${ROOT}lib/libpthread-0.9.so ${ROOT}lib/libpthread.so.0
  /bin/rm  ${ROOT}tmp/ld-linux.so.2
  /bin/rm  ${ROOT}tmp/libc.so.6
  /bin/rm  ${ROOT}tmp/libpthread.so.0
  /sbin/ldconfig -r ${ROOT}

}