2021-06-07 22:56:15 +03:00
|
|
|
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
|
|
|
|
|
|
|
|
# go build -ldflags "-linkmode external -extldflags -static" hello.go
|
|
|
|
go_library(
|
|
|
|
name = "go_lib",
|
|
|
|
srcs = ["hello.go"],
|
|
|
|
cgo = True,
|
|
|
|
importpath = "github.com/motiejus/bazel-zig-cc/test/go",
|
|
|
|
visibility = ["//visibility:private"],
|
2021-06-07 23:00:32 +03:00
|
|
|
target_compatible_with = select({
|
|
|
|
"@platforms//os:linux": ["@com_github_ziglang_zig//:musl"],
|
|
|
|
"//conditions:default": [],
|
|
|
|
}),
|
2021-06-07 22:56:15 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
go_binary(
|
|
|
|
name = "go",
|
|
|
|
embed = [":go_lib"],
|
|
|
|
visibility = ["//visibility:public"],
|
2021-06-07 23:00:32 +03:00
|
|
|
static = "on",
|
2021-06-07 22:56:15 +03:00
|
|
|
)
|