# Importada de Alpine aports por `hammer import-alpine` (Etapa G). PUNTO DE PARTIDA — pero
# YA trae los parches de musl de Alpine (lo que un import de nix pierde). Pendiente: el
# sha256 del tarball (el wrapper lo calcula), y adaptar build/install del shell de abuild.
name    = "staticcheck"
version = "2026.1"

[source]
tarball = "https://github.com/dominikh/go-tools/archive/refs/tags/2026.1.tar.gz"
# FIXME sha256: el wrapper lo calcula (Alpine publica sha512). sha512 de Alpine:
# sha512 = "d0594069505f3a16cb0de51c92edf22d53c66ce42829575e29b72f1a83e9b929a2c7876d5af3d12321ead054cf525a9de6cdfbbd163e070314788f5aea20bcab"
sha256  = "4b20d65194e5462264c784f2968de65fcd7aba8e9efa37aa9b1fadc13b29699b"

[build]
compiler = "zig-cc"
target   = "x86_64-linux-musl"
link     = "static"
flags    = []

[build.phases]
# de build() de Alpine (traducido; el lab provee $CBUILD/$CHOST — Etapa G Fase 3; revisá --shared para estático):
compile = '''
_abuild_phase() {
export CGO_CPPFLAGS="$CPPFLAGS"
	export CGO_CFLAGS="$CFLAGS"
	export CGO_CXXFLAGS="$CXXFLAGS"
	export CGO_LDFLAGS="$LDFLAGS"

	mkdir -p bin
	go build -o ./bin ./...
}
_abuild_phase
'''
# de package() de Alpine (traducido $pkgdir→/out):
install = '''
_abuild_phase() {
install -p -Dm755 -t "/out/usr/bin/" bin/*

	install -Dm644 "LICENSE"  "/out/usr/share/licenses/staticcheck/LICENSE"
	install -Dm644 "LICENSE-THIRD-PARTY" \
		"/out/usr/share/licenses/staticcheck/LICENSE-THIRD-PARTY"
}
_abuild_phase
'''
