Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support darwin_x86_64 cpu value #428

Merged
merged 1 commit into from
May 3, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions go/def.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ def go_environment_vars(ctx):
"GOARCH": "386"},
"darwin": {"GOOS": "darwin",
"GOARCH": "amd64"},
"darwin_x86_64": {"GOOS": "darwin",
"GOARCH": "amd64"},
"freebsd": {"GOOS": "freebsd",
"GOARCH": "amd64"},
"armeabi-v7a": {"GOOS": "linux",
Expand All @@ -183,6 +185,10 @@ def go_environment_vars(ctx):
{"GOOS": "linux",
"GOARCH": "amd64"})

def _is_darwin_cpu(ctx):
cpu = ctx.fragments.cpp.cpu
return cpu == "darwin" or cpu == "darwin_x86_64"

def _emit_generate_params_action(cmds, ctx, fn):
cmds_all = [
# Use bash explicitly. /bin/sh is default, and it may be linked to a
Expand Down Expand Up @@ -542,7 +548,7 @@ def _emit_go_link_action(ctx, importmap, transitive_libs, cgo_deps, lib,
# http://lists.apple.com/archives/Darwin-dev/2006/Sep/msg00084.html
# TODO(yugui) Remove this workaround once rules_go stops supporting XCode 7.2
# or earlier.
if ctx.fragments.cpp.cpu != 'darwin':
if not _is_darwin_cpu(ctx):
link_cmd += ["-s"]

link_cmd += [
Expand Down Expand Up @@ -1151,7 +1157,7 @@ def _cgo_object_impl(ctx):
"-nostdlib",
"-Wl,-r",
]
if ctx.fragments.cpp.cpu == "darwin":
if _is_darwin_cpu(ctx):
arguments += ["-shared", "-Wl,-all_load"]
else:
arguments += ["-Wl,-whole-archive"]
Expand Down