2021-06-07 23:17:19 +03:00
|
|
|
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
|
|
|
|
|
|
|
|
go_library(
|
|
|
|
name = "go_lib",
|
|
|
|
srcs = ["hello.go"],
|
|
|
|
cgo = True,
|
|
|
|
importpath = "github.com/motiejus/bazel-zig-cc/test",
|
|
|
|
visibility = ["//visibility:private"],
|
|
|
|
)
|
|
|
|
|
|
|
|
go_binary(
|
|
|
|
name = "gognu",
|
|
|
|
embed = [":go_lib"],
|
2021-06-16 14:44:57 +03:00
|
|
|
gc_linkopts = select({
|
|
|
|
"@platforms//os:macos": ["-s", "-w", "-buildmode=pie"],
|
|
|
|
"//conditions:default": [],
|
|
|
|
}),
|
2021-06-07 23:17:19 +03:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
go_binary(
|
|
|
|
name = "gomusl",
|
|
|
|
embed = [":go_lib"],
|
|
|
|
static = "on",
|
2021-06-07 22:10:33 +03:00
|
|
|
target_compatible_with = select({
|
2021-06-10 16:12:50 +03:00
|
|
|
"@platforms//os:linux": ["@zig_sdk//:libc_musl"],
|
2021-06-07 22:10:33 +03:00
|
|
|
"//conditions:default": [],
|
|
|
|
}),
|
2021-06-07 23:17:19 +03:00
|
|
|
visibility = ["//visibility:public"],
|
2021-04-10 01:05:01 +03:00
|
|
|
)
|