summaryrefslogtreecommitdiff
blob: e919d996c479f72c7fbd6fcb00b35963a010b8e7 (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/pcmciautils/pcmciautils-014-r1.ebuild,v 1.6 2007/02/10 22:16:36 genstef Exp $

inherit eutils toolchain-funcs linux-info

DESCRIPTION="PCMCIA userspace utilities for Linux kernel 2.6.13 and beyond"

HOMEPAGE="http://www.kernel.org/pub/linux/utils/kernel/pcmcia/pcmcia.html"
SRC_URI="mirror://kernel/linux/utils/kernel/pcmcia/${P}.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 arm ppc sh x86"

IUSE="debug static staticsocket"
RDEPEND=">=sys-fs/sysfsutils-1.2.0-r1
	>=sys-apps/module-init-tools-3.2_pre4"
DEPEND="${RDEPEND}
	dev-util/yacc
	sys-devel/flex
	sys-apps/sed"

CONFIG_CHECK="~PCMCIA"
ERROR_PCMCIA="${P} requires 16-bit PCMCIA support (CONFIG_PCMCIA)"

pkg_setup() {
	linux-info_pkg_setup

	if kernel_is lt 2 6 13; then
		eerror
		eerror "${P} requires at least kernel 2.6.13."
		eerror
		die "${P} requires at least kernel 2.6.13."
	fi
}

src_unpack() {
	unpack ${A}
	epatch "${FILESDIR}/014-udev-rules.patch"

	sed -i \
		-e "s:^\(KERNEL_DIR\) = .*:\1 = ${KV_DIR}:" \
		-e "s:^\(V\) = false:\1 = true:" \
		-e "s:^\(CFLAGS \:=.*\):\1 ${CFLAGS}:" \
		${S}/Makefile || die

	if use debug; then
		sed -i -e "s:^\(DEBUG\) = .*:\1 = true:" ${S}/Makefile || die
	fi

	if use static; then
		sed -i -e "s:^\(STATIC\) = .*:\1 = true:" ${S}/Makefile || die
	fi

	if use staticsocket; then
		sed -i -e "s:^\(STARTUP\) = .*:\1 = false:" ${S}/Makefile || die
	fi

	# we always use udev
	sed -i -e "s:^\(UDEV\) = .*:\1 = true:" ${S}/Makefile || die
}

src_compile() {
	emake CC="$(tc-getCC)" LD="$(tc-getCC)" \
		|| die "emake failed"
}

src_install() {
	make DESTDIR="${D}" install || die "make install failed"

	dodoc doc/*.txt
}

pkg_postinst() {
	ewarn
	ewarn "If you relied on pcmcia-cs to automatically load the appropriate"
	ewarn "PCMCIA-related modules upon boot, you need to add 'pcmcia' and the"
	ewarn "PCMCIA socket driver you need for this system (yenta-socket,"
	ewarn "i82092, i82365, ...) to /etc/modules.autoload.d/kernel-2.6"
	ewarn
}