summaryrefslogtreecommitdiff
blob: b08d9a3d45a7f1795b6fa4a4b9e77d0866e5d600 (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
# Copyright 1999-2018 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit linux-info linux-mod autotools toolchain-funcs

MY_PN=${PN/modules/kernel}

DESCRIPTION="Kernel modules for GPIB (IEEE 488.2) hardware"
HOMEPAGE="https://linux-gpib.sourceforge.io/"
SRC_URI="mirror://sourceforge/linux-gpib/${MY_PN}-${PV}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"
IUSE="isa pcmcia debug"

COMMONDEPEND=""
RDEPEND="${COMMONDEPEND}
	!<sci-libs/linux-gpib-4.2.0_rc1
"
DEPEND="${COMMONDEPEND}
	virtual/pkgconfig"

PATCHES=(
	"${FILESDIR}"/${PN}-4.2.0_rc1-reallydie.patch
)

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

pkg_setup () {
	linux-mod_pkg_setup

	if kernel_is -lt 2 6 8; then
		die "Kernel versions older than 2.6.8 are not supported."
	fi

	# https://sourceforge.net/p/linux-gpib/bugs/43/
	if use pcmcia && kernel_is -ge 2 6 38; then
		die "pcmcia support is broken on kernels newer 2.6.38"
	fi
}

src_prepare () {
	default
	eautoreconf
}

src_configure() {
	set_arch_to_kernel
	econf \
		$(use_enable isa) \
		$(use_enable pcmcia) \
		$(use_enable debug driver-debug) \
		--with-linux-srcdir=${KV_DIR}
}

src_compile() {
	set_arch_to_kernel
	emake \
		DESTDIR="${D}" \
		INSTALL_MOD_PATH="${D}" \
		docdir=/usr/share/doc/${PF}/html
}

src_install() {
	set_arch_to_kernel
	emake \
		DESTDIR="${D}" \
		INSTALL_MOD_PATH="${D}" \
		DEPMOD="/bin/true" \
		docdir=/usr/share/doc/${PF}/html install

	dodoc ChangeLog AUTHORS README* NEWS
}

pkg_preinst () {
	linux-mod_pkg_preinst
	enewgroup gpib
}

pkg_postinst () {
	linux-mod_pkg_postinst
}