summaryrefslogtreecommitdiff
path: root/net-misc/rclone/rclone-1.66.0-r1.ebuild
blob: b59ebe324c669987c034ab558ca09e8b6ebe016a (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
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit bash-completion-r1 check-reqs edo go-module

DESCRIPTION="A program to sync files to and from various cloud storage providers"
HOMEPAGE="https://rclone.org/
	https://github.com/rclone/rclone/"
SRC_URI="
	https://github.com/rclone/rclone/archive/v${PV}.tar.gz
		-> ${P}.tar.gz
	https://dev.gentoo.org/~xgqt/distfiles/deps/${P}-deps.tar.xz
"

LICENSE="Apache-2.0 BSD BSD-2 ISC MIT MPL-2.0"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86"

RDEPEND="
	sys-fs/fuse:3
"

CHECKREQS_DISK_BUILD="2500M"

pkg_setup() {
	check-reqs_pkg_setup
}

src_compile() {
	local go_ldflags="
		-X github.com/rclone/rclone/fs.Version=${PV}
	"
	local -a go_buildargs=(
		-ldflags "${go_ldflags}"
		-mod=readonly
		-o ./
	)
	ego build "${go_buildargs[@]}" .

	edob ./rclone genautocomplete bash "${PN}.bash"
	edob ./rclone genautocomplete zsh "${PN}.zsh"
}

src_test() {
	# Setting CI skips unreliable tests, see "fstest/testy/testy.go"
	# "TestAddPlugin" and "TestRemovePlugin" fail.
	local -x CI="true"
	local -x RCLONE_CONFIG="/not_found"

	edob go test -mod=readonly -v -run "!Test.*Plugin" ./...
}

src_install() {
	exeinto /usr/bin
	doexe "${PN}"
	dosym -r "/usr/bin/${PN}" /usr/bin/mount.rclone
	dosym -r "/usr/bin/${PN}" /usr/bin/rclonefs

	newbashcomp "${PN}.bash" "${PN}"
	insinto /usr/share/zsh/site-functions
	newins "${PN}.zsh" "_${PN}"

	doman "${PN}.1"
	einstalldocs
}