summaryrefslogtreecommitdiff
path: root/dev-util/buildbox/buildbox-1.4.13.ebuild
blob: 946fce28579b3135dba99b58081b0904629cb0dd (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
# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit cmake linux-info

DESCRIPTION="Suite of tools conforming to the Remote Execution and Workers API"
HOMEPAGE="https://buildgrid.gitlab.io/buildbox/buildbox/index.html"
SRC_URI="https://gitlab.com/BuildGrid/buildbox/${PN}/-/archive/${PV}/${P}.tar.bz2"

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64"
IUSE="casd fuse oci recc test tools"
REQUIRED_USE="
	^^ ( casd tools recc )
	fuse? ( casd )
	oci? ( tools )
"

DEPEND="
	dev-cpp/abseil-cpp:=
	dev-libs/openssl:=
	dev-libs/protobuf:=
	net-libs/grpc:=
	sys-apps/util-linux
	fuse? ( sys-fs/fuse:3= )
	oci? (
		dev-cpp/nlohmann_json
		net-misc/curl
	)
"

# FIXME: cmake doesn't catch this dependency during configure
DEPEND+="dev-cpp/nlohmann_json"

RDEPEND="${DEPEND}
	sys-apps/attr
	sys-apps/bubblewrap
	sys-apps/net-tools
	oci? ( app-containers/runc )
"

BDEPEND="
	dev-cpp/gtest
	dev-cpp/tomlplusplus
	sys-libs/libunwind
	net-dns/c-ares
	virtual/pkgconfig
	recc? ( virtual/zlib:= )
"

RESTRICT="!test? ( test )"

PATCHES=(
	# for musl libc
	"${FILESDIR}"/${P}-include-types.h.patch
)

pkg_setup() {
	if use fuse && use test; then
		CONFIG_CHECK="FUSE_FS"
		linux-info_pkg_setup
	elif use fuse; then
		CONFIG_CHECK="~FUSE_FS"
		linux-info_pkg_setup
	fi
}

src_configure() {
	local mycmakeargs=(
			# only accepts capital ON/OFF
			-DTOOLS=$(usex tools ON OFF)
			-DCASD=$(usex casd ON OFF)
			-DCASD_WRAP=$(usex casd ON OFF)
			-DCASUPLOAD_OCI=$(usex oci ON OFF)
			-DFUSE=$(usex fuse ON OFF)
			-DLOGSTREAMRECEIVER=$(usex tools ON OFF)
			-DLOGSTREAMTAIL=$(usex tools ON OFF)
			-DOCI=$(usex oci ON OFF)
			-DOUTPUTSTREAMER=$(usex tools ON OFF)
			-DRECC=$(usex recc ON OFF)
			-DREXPLORER=$(usex casd ON OFF)
			-DRUMBAD=$(usex tools ON OFF)
			-DRUN_BUBBLEWRAP=$(usex casd ON OFF)
			-DRUN_HOSTTOOLS=$(usex tools ON OFF)
			-DRUN_OCI=$(usex oci ON OFF)
			# bwrap on linux
			-DRUN_SYMLINK=$(usex casd bubblewrap OFF)
			-DRUN_USERCHROOT=OFF
			-DTREXE=$(usex tools ON OFF)
			-DWORKER=$(usex tools ON OFF)
			-DBUILD_MOSTLY_STATIC=OFF
			# Passes "-O1 -D_FORTIFY_SOURCE=2", which we already do
			-DHARDEN=OFF
			-DBUILD_SHARED_LIBS=ON
			)

		if use casd; then
			# manually specified variable with USE=-casd
			# QA Notice: One or more CMake variables were not used by the project:
			mycmakeargs+=( -DCASD_BUILD_BENCHMARK=OFF )
		fi

	cmake_src_configure
}

src_test() {
	local CMAKE_SKIP_TESTS=(
	)

	if use fuse; then
		# fuse: failed to open /dev/fuse: Permission denied
		addwrite "/dev/fuse"
	fi

	cmake_src_test
}