summaryrefslogtreecommitdiff
blob: 2a2a4c7ced51d85d5fa345df26c007b72280fee8 (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
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-emulation/emul-linux-x86-glibc-errno-compat/emul-linux-x86-glibc-errno-compat-2.5.ebuild,v 1.1 2008/02/18 23:50:45 vapier Exp $

inherit flag-o-matic

PATCH_VER="1.8"

DESCRIPTION="standalone glibc for old x86 binaries that require errno compat"
HOMEPAGE="http://dev.gentoo.org/~vapier/old-broken-errno-apps"
SRC_URI="mirror://gnu/glibc/glibc-${PV}.tar.bz2
	mirror://gnu/glibc/glibc-linuxthreads-${PV}.tar.bz2
	mirror://gentoo/glibc-${PV}-patches-${PATCH_VER}.tar.bz2"

LICENSE="LGPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE=""

DEPEND=""

S=${WORKDIR}/glibc-${PV}

CRAZY_PREFIX="/usr/lib/glibc-errno-compat"

src_unpack() {
	unpack glibc-${PV}.tar.bz2
	cd "${S}"
	unpack glibc-linuxthreads-${PV}.tar.bz2
	unpack glibc-${PV}-patches-${PATCH_VER}.tar.bz2
	grep -l '^--- ports/' patches/*.patch | xargs rm -f
	EPATCH_SUFFIX="patch" epatch patches
	test-flags -fgnu89-inline && append-flags -fgnu89-inline
}

src_compile() {
	mkdir build || die
	cd build || die
	../configure \
		--prefix="${CRAZY_PREFIX}" \
		--build=${CBUILD} \
		--host=${CHOST} \
		--without-tls \
		--without-__thread \
		--disable-sanity-checks \
		--enable-add-ons=linuxthreads \
		|| die
	sed -i '/^defines/s:$: -U__i686:' config.make || die
	emake -j1 \
		PARALLELMFLAGS="${MAKEOPTS}" \
		build-programs="no" \
		lib \
		|| die
	emake -C ../linuxthreads objdir=${PWD} ${PWD}/linuxthreads/libpthread.so || die
}

src_install() {
	dobin "${FILESDIR}"/glibc-errno-wrapper || die
	dosed "s:@PREFIX@:${CRAZY_PREFIX}:g" /usr/bin/glibc-errno-wrapper || die

	cd build || die
	into "${CRAZY_PREFIX}"
	newlib.so elf/ld.so ld-linux.so.2 || die
	newlib.so libc.so libc.so.6 || die
	newlib.so linuxthreads/libpthread.so libpthread.so.0 || die
}