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

EAPI=7

inherit flag-o-matic linux-info toolchain-funcs udev

DEB_REV=${PV#*_p}
MY_PV=${PV%_p*}

DESCRIPTION="PCMCIA userspace utilities for Linux"
HOMEPAGE="https://packages.qa.debian.org/pcmciautils"
SRC_URI="mirror://debian/pool/main/${PN:0:1}/${PN}/${PN}_${MY_PV}.orig.tar.gz
	mirror://debian/pool/main/${PN:0:1}/${PN}/${PN}_${MY_PV}-${DEB_REV}.debian.tar.gz"
S="${WORKDIR}"/${PN}-${MY_PV}

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 arm ~arm64 ~loong ppc ~riscv x86"
IUSE="debug staticsocket"

RDEPEND="sys-apps/kmod[tools]"
DEPEND="${RDEPEND}
	app-alternatives/yacc
	sys-devel/flex"

PATCHES=(
	"${WORKDIR}"/debian/patches/no-modprobe-rules.patch
	"${WORKDIR}"/debian/patches/remove-libsysfs-dep.patch
	"${FILESDIR}"/${P}-flex-2.6.3-fix.patch
	"${FILESDIR}"/${PN}-018_p8-musl-unsigned-type.patch
)

pkg_setup() {
	CONFIG_CHECK="~PCMCIA"
	linux-info_pkg_setup

	kernel_is lt 2 6 32 && ewarn "${P} requires at least kernel 2.6.32."
}

src_prepare() {
	default

	sed -i \
		-e '/CFLAGS/s:-fomit-frame-pointer::' \
		-e '/dir/s:sbin:bin:g' \
		Makefile || die
}

src_configure() {
	use debug && append-cppflags -DDEBUG

	mypcmciaopts=(
		STARTUP=$(usex staticsocket false true)
		exec_prefix=/usr
		UDEV=true
		DEBUG=false
		STATIC=false
		V=true
		udevdir="$(get_udevdir)"
		CC="$(tc-getCC)"
		LD="$(tc-getCC)"
		AR="$(tc-getAR)"
		STRIP=true
		RANLIB="$(tc-getRANLIB)"
		OPTIMIZATION="${CFLAGS} ${CPPFLAGS}"
	)
}

src_compile() {
	emake "${mypcmciaopts[@]}"
}

src_install() {
	emake "${mypcmciaopts[@]}" DESTDIR="${D}" install

	dodoc doc/*.txt
}