mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-10-31 05:40:42 +00:00 
			
		
		
		
	This change allows kubectl to be built on MacOS machines using `bazel build //cmd/kubectl`. Mac OS X doesn't support static binaries because it does not have a stable syscall API. Userspace binaries are expected to dynamically link against libcrt instead. https://developer.apple.com/library/content/qa/qa1118/_index.html
		
			
				
	
	
		
			52 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| load(
 | |
|     "@io_bazel_rules_go//go:def.bzl",
 | |
|     "go_binary",
 | |
|     "go_library",
 | |
| )
 | |
| load("//pkg/version:def.bzl", "version_x_defs")
 | |
| 
 | |
| go_binary(
 | |
|     name = "kubectl",
 | |
|     gc_linkopts = select({
 | |
|         # Mac OS X doesn't support static binaries:
 | |
|         # https://developer.apple.com/library/content/qa/qa1118/_index.html
 | |
|         "@io_bazel_rules_go//go/platform:darwin_amd64": [],
 | |
|         "//conditions:default": [
 | |
|             "-linkmode",
 | |
|             "external",
 | |
|             "-extldflags",
 | |
|             "-static",
 | |
|         ],
 | |
|     }),
 | |
|     library = ":go_default_library",
 | |
|     visibility = [
 | |
|         "//build/visible_to:COMMON_release",
 | |
|     ],
 | |
|     x_defs = version_x_defs(),
 | |
| )
 | |
| 
 | |
| go_library(
 | |
|     name = "go_default_library",
 | |
|     srcs = ["kubectl.go"],
 | |
|     visibility = ["//visibility:private"],
 | |
|     deps = ["//cmd/kubectl/app:go_default_library"],
 | |
| )
 | |
| 
 | |
| filegroup(
 | |
|     name = "package-srcs",
 | |
|     srcs = glob(["**"]),
 | |
|     tags = ["automanaged"],
 | |
| )
 | |
| 
 | |
| filegroup(
 | |
|     name = "all-srcs",
 | |
|     srcs = [
 | |
|         ":package-srcs",
 | |
|         "//cmd/kubectl/app:all-srcs",
 | |
|     ],
 | |
|     tags = ["automanaged"],
 | |
|     visibility = [
 | |
|         "//build/visible_to:cmd_kubectl_CONSUMERS",
 | |
|     ],
 | |
| )
 |