summaryrefslogtreecommitdiff
blob: 61e3cfa6d0190effae8e2208e78d7e8a731c57a7 (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-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/pcmciautils/pcmciautils-017.ebuild,v 1.4 2012/10/31 19:24:28 ssuominen Exp $

EAPI=4
inherit flag-o-matic linux-info toolchain-funcs udev

DESCRIPTION="PCMCIA userspace utilities for Linux kernel 2.6.13 and beyond"
HOMEPAGE="http://www.kernel.org/pub/linux/utils/kernel/pcmcia/"
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.3.0
	virtual/modutils"
DEPEND="${RDEPEND}
	virtual/yacc
	sys-devel/flex"

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

pkg_setup() {
	linux-info_pkg_setup
	kernel_is lt 2 6 13 && ewarn "${P} requires at least kernel 2.6.13."
}

use_tf() { use $1 && echo true || echo false ; }
src_prepare() {
	sed -i \
		-e '/^DEBUG\>/s:=.*:= false:' \
		-e '/^UDEV\>/s:=.*:= true:' \
		-e '/CFLAGS/s:-fomit-frame-pointer::' \
		-e '/^STATIC\>/s:=.*:= '$(use_tf static)':' \
		-e '/^STARTUP\>/s:=.*:= '$(use_tf staticsocket)':' \
		Makefile || die
	use debug && append-flags -DDEBUG
}

src_compile() {
	emake \
		OPTIMIZATION="${CFLAGS} ${CPPFLAGS}" \
		V=true \
		CC="$(tc-getCC)" \
		LD="$(tc-getCC)" \
		STRIP=true
}

src_install() {
	emake \
		DESTDIR="${D}" \
		udevdir="$(udev_get_udevdir)" \
		install

	dodoc doc/*.txt
}

pkg_postinst() {
	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"
}