aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/build.py
diff options
context:
space:
mode:
Diffstat (limited to 'compiler_wrapper/build.py')
-rwxr-xr-xcompiler_wrapper/build.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/compiler_wrapper/build.py b/compiler_wrapper/build.py
index 763b3e64..037b940f 100755
--- a/compiler_wrapper/build.py
+++ b/compiler_wrapper/build.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2019 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
@@ -39,10 +39,16 @@ def calc_go_args(args, version):
'-X',
'main.Version=' + version,
]
+
+ # If the wrapper is intended for Chrome OS, we need to use libc's exec.
+ extra_args = []
+ if 'cros' in args.config:
+ extra_args = ['-tags', 'libc_exec']
+
return [
'go', 'build', '-o',
os.path.abspath(args.output_file), '-ldflags', ' '.join(ldFlags)
- ]
+ ] + extra_args
def read_version(build_dir):
@@ -52,7 +58,7 @@ def read_version(build_dir):
return r.read()
last_commit_msg = subprocess.check_output(
- ['git', '-C', build_dir, 'log', '-1', '--pretty=%B'])
+ ['git', '-C', build_dir, 'log', '-1', '--pretty=%B'], encoding='utf-8')
# Use last found change id to support reverts as well.
change_ids = re.findall(r'Change-Id: (\w+)', last_commit_msg)
if not change_ids: