blob: 02a66df0cfc14609890752b1811d5d8dba610440 (
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit toolchain-funcs
# check the VERSION in libnvidia-container/mk/nvidia-modprobe.mk
NVMODV="550.54.14"
DESCRIPTION="NVIDIA container runtime library"
HOMEPAGE="https://github.com/NVIDIA/libnvidia-container"
if [[ "${PV}" == "9999" ]] ; then
inherit git-r3
EGIT_REPO_URI="https://github.com/NVIDIA/${PN}.git"
else
SRC_URI="
https://github.com/NVIDIA/${PN}/archive/v${PV/_rc/-rc.}.tar.gz -> ${P}.tar.gz
"
S="${WORKDIR}/${PN}-${PV/_rc/-rc.}"
KEYWORDS="~amd64"
fi
NVMODS="${WORKDIR}/nvidia-modprobe-${NVMODV}"
SRC_URI+="
https://github.com/NVIDIA/nvidia-modprobe/archive/${NVMODV}.tar.gz -> ${PN}-nvidia-modprobe-${NVMODV}.tar.gz
"
LICENSE="Apache-2.0"
SLOT="0/${PV}"
IUSE="+seccomp static-libs"
# libtirpc
# NOTE It seams that library also has optional support for net-libs/libtirpc, but I didn't
# manage to build without it, probably the support for that build-roted away.
DEPEND="
net-libs/libtirpc:=
sys-libs/libcap
virtual/libelf:=
seccomp? ( sys-libs/libseccomp )
"
RDEPEND="${DEPEND}
elibc_glibc? ( x11-drivers/nvidia-drivers )
"
BDEPEND="
dev-lang/go
net-libs/rpcsvc-proto
sys-apps/lsb-release
virtual/pkgconfig
"
PATCHES=(
"${FILESDIR}/${PN}-1.17.0-fix-makefile-r1.patch"
)
DOCS=( NOTICE README.md )
src_unpack() {
default_src_unpack
if [[ "${PV}" == "9999" ]] ; then
git-r3_src_unpack
fi
}
src_prepare() {
# nvidia-modprobe patching based on libnvidia-container/mk/nvidia-modprobe.mk
mkdir -p "${S}"/deps/src/nvidia-modprobe-"${NVMODV}" || die
cp -r "${NVMODS}"/modprobe-utils/ "${S}"/deps/src/nvidia-modprobe-"${NVMODV}"/ || die
touch "${S}/deps/src/nvidia-modprobe-${NVMODV}/.download_stamp" || die
pushd "${S}/deps/src/nvidia-modprobe-${NVMODV}" || die
eapply -p1 "${S}"/mk/nvidia-modprobe.patch
popd || die
default
}
src_configure() {
export GOPATH="${S}"
export GOFLAGS="-mod=vendor"
export CFLAGS="${CFLAGS}"
export LDFLAGS="${LDFLAGS}"
export CGO_CFLAGS="${CGO_CFLAGS:-$CFLAGS}"
export CGO_LDFLAGS="${CGO_LDFLAGS:-$LDFLAGS}"
tc-export CC LD OBJCOPY PKG_CONFIG
if ! tc-is-gcc; then
eerror "Building ${PN} with clang is not supported because of option \"-fplan9-extensions\"!"
die "$(tc-getCC) is not a supported compiler. Please use sys-devel/gcc"
fi
# we could also set GO compiller, but it currently defaults to gccgo, but as for now I believe
# most users will prefer dev-lang/go and they usually don't define GO="go" their make.conf either.
# tc-export GO
my_makeopts=(
prefix="${EPREFIX}/usr"
libdir="${EPREFIX}/usr/$(get_libdir)"
GO_LDFLAGS="-compressdwarf=false -linkmode=external"
WITH_SECCOMP="$(usex seccomp)"
)
# WITH_TIRPC="$(usex libtirpc)"
if [[ "${PV}" != "9999" ]] ; then
IFS='_' read -r MY_LIB_VERSION MY_LIB_TAG <<< "${PV}"
my_makeopts=( "${my_makeopts[@]}"
REVISION="${PV}"
LIB_VERSION="${MY_LIB_VERSION}"
LIB_TAG="${MY_LIB_TAG}"
)
fi
}
src_compile() {
emake "${my_makeopts[@]}"
}
src_install() {
emake "${my_makeopts[@]}" DESTDIR="${D}" install
# Install docs
einstalldocs # Bug 831705
# Cleanup static libraries
if ! use static-libs ; then
find "${ED}" -name '*.a' -delete || die # Bug 783984
fi
}
|