guru/dev-go/staticcheck/staticcheck-0.3.3.ebuild
Randall T. Vasquez 5bc15cbab4
dev-go/staticcheck: add ebuilds
Signed-off-by: Randall T. Vasquez <ran.dall@icloud.com>
2022-07-30 09:45:20 -07:00

64 lines
1.2 KiB
Bash

# Copyright 2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit go-module
DESCRIPTION="The advanced Go linter"
HOMEPAGE="https://staticcheck.io/"
if [[ ${PV} == *9999 ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/dominikh/go-tools.git"
RESTRICT="fetch mirror"
else
SRC_URI="https://github.com/dominikh/go-tools/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
SRC_URI+=" https://github.com/ran-dall/portage-deps/raw/master/${P}-deps.tar.xz"
KEYWORDS="~amd64 ~arm64 ~x86"
RESTRICT="mirror"
S="${WORKDIR}/go-tools-${PV}"
fi
LICENSE="MIT"
SLOT="0"
IUSE="test"
DEPEND="dev-lang/go
sys-libs/glibc"
RDEPEND="${DEPEND}"
BDEPEND=""
RESTRICT="!test? ( test )"
src_unpack() {
default
if [[ ${PV} == *9999 ]]; then
git-r3_src_unpack
go-module_live_vendor
fi
}
src_configure() {
export CGO_ENABLED=1
export CGO_CFLAGS="${CFLAGS}"
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
default
}
src_compile() {
mkdir -pv bin || die
ego build -ldflags "-linkmode=external" -o bin/"${PN}" "./cmd/staticcheck"
}
src_test() {
GOROOT="${BROOT}/usr/lib/go" ego test -v -ldflags "-linkmode=external" ./...
}
src_install() {
dobin bin/"${PN}"
}