1 |
|
# Copyright 1999-2023 Gentoo Authors
|
|
1 |
# Copyright 2017-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
4 |
EAPI=8
|
5 |
5 |
EGO_PN=github.com/git-lfs/git-lfs
|
6 |
|
inherit go-module
|
|
6 |
# Update the ID as it's included in each build.
|
|
7 |
COMMIT_ID="d06d6e9efd78ff4f958b072146ce167d87f60285"
|
|
8 |
|
|
9 |
inherit go-module shell-completion
|
7 |
10 |
|
8 |
11 |
DESCRIPTION="Command line extension and specification for managing large files with git"
|
9 |
|
HOMEPAGE="https://git-lfs.com/"
|
|
12 |
HOMEPAGE="
|
|
13 |
https://git-lfs.com
|
|
14 |
https://github.com/git-lfs/git-lfs
|
|
15 |
"
|
10 |
16 |
|
11 |
17 |
if [[ "${PV}" = 9999* ]]; then
|
12 |
18 |
EGIT_REPO_URI="https://${EGO_PN}"
|
13 |
19 |
inherit git-r3
|
14 |
20 |
else
|
15 |
|
SRC_URI="https://${EGO_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
|
16 |
|
KEYWORDS="amd64 ~arm64 ~ppc64 ~riscv ~x86 ~amd64-linux ~x86-linux"
|
|
21 |
SRC_URI="https://${EGO_PN}/releases/download/v${PV}/${PN}-v${PV}.tar.gz -> ${P}.tar.gz"
|
|
22 |
# Add the manually vendored tarball.
|
|
23 |
# 1) Create a tar archive optimized to reproduced by other users or devs.
|
|
24 |
# 2) Compress the archive using XZ limiting decompression memory for
|
|
25 |
# pretty constraint systems.
|
|
26 |
# Use something like:
|
|
27 |
# tar cf $P-deps.tar go-mod \
|
|
28 |
# --mtime="1970-01-01" --sort=name --owner=portage --group=portage
|
|
29 |
# xz -k -9eT0 --memlimit-decompress=256M $P-deps.tar
|
|
30 |
SRC_URI+=" https://files.holgersson.xyz/gentoo/distfiles/golang-pkg-deps/${P}-deps.tar.xz"
|
|
31 |
KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86 ~amd64-linux ~x86-linux"
|
17 |
32 |
fi
|
18 |
33 |
|
19 |
34 |
LICENSE="Apache-2.0 BSD BSD-2 BSD-4 ISC MIT"
|
20 |
35 |
SLOT="0"
|
21 |
36 |
IUSE="doc test"
|
22 |
37 |
|
23 |
|
BDEPEND="doc? ( app-text/ronn-ng )"
|
|
38 |
BDEPEND="
|
|
39 |
doc? ( dev-ruby/asciidoctor )
|
|
40 |
"
|
24 |
41 |
RDEPEND="dev-vcs/git"
|
25 |
42 |
|
26 |
43 |
RESTRICT+=" !test? ( test )"
|
... | ... | |
34 |
51 |
)
|
35 |
52 |
|
36 |
53 |
src_compile() {
|
|
54 |
export CGO_ENABLED=0
|
|
55 |
|
37 |
56 |
# Flags -w, -s: Omit debugging information to reduce binary size,
|
38 |
57 |
# see https://golang.org/cmd/link/.
|
39 |
58 |
local mygobuildargs=(
|
40 |
|
-ldflags="-X ${EGO_PN}/config.GitCommit=${GIT_COMMIT} -s -w"
|
41 |
|
-mod vendor -v -work -x
|
|
59 |
-ldflags="-X ${EGO_PN}/config.GitCommit=${COMMIT_ID} -s -w"
|
|
60 |
-gcflags=" "
|
|
61 |
-trimpath
|
|
62 |
-v -work -x
|
42 |
63 |
)
|
43 |
|
go build "${mygobuildargs[@]}" -o git-lfs git-lfs.go || die
|
|
64 |
ego build "${mygobuildargs[@]}" -o git-lfs git-lfs.go
|
44 |
65 |
|
45 |
66 |
if use doc; then
|
46 |
|
ronn docs/man/*.ronn || die "man building failed"
|
|
67 |
for doc in docs/man/*adoc;
|
|
68 |
do asciidoctor -b manpage ${doc} || die "man building failed"
|
|
69 |
done
|
47 |
70 |
fi
|
|
71 |
|
|
72 |
# Generate auto-completion scripts.
|
|
73 |
# bug 914542
|
|
74 |
./git-lfs completion bash > "${PN}.bash" || die
|
|
75 |
./git-lfs completion fish > "${PN}.fish" || die
|
|
76 |
./git-lfs completion zsh > "${PN}.zsh" || die
|
48 |
77 |
}
|
49 |
78 |
|
50 |
79 |
src_install() {
|
51 |
80 |
dobin git-lfs
|
52 |
81 |
einstalldocs
|
|
82 |
|
|
83 |
# Install auto-completion scripts generated earlier.
|
|
84 |
# bug 914542
|
|
85 |
newbashcomp "${PN}.bash" "${PN}"
|
|
86 |
dofishcomp "${PN}.fish"
|
|
87 |
newzshcomp "${PN}.zsh" "_${PN}"
|
|
88 |
|
53 |
89 |
use doc && doman docs/man/*.1
|
54 |
90 |
}
|
55 |
91 |
|
56 |
92 |
src_test() {
|
57 |
93 |
local mygotestargs=(
|
58 |
|
-ldflags="-X ${EGO_PN}/config.GitCommit=${GIT_COMMIT}"
|
59 |
|
-mod vendor
|
|
94 |
-ldflags="-X ${EGO_PN}/config.GitCommit=${COMMIT_ID}"
|
60 |
95 |
)
|
61 |
96 |
go test "${mygotestargs[@]}" ./... || die
|
62 |
97 |
}
|