|
| 1 | +#!/usr/bin/env python |
| 2 | +# |
| 3 | +# Copyright 2016 Google Inc. |
| 4 | +# |
| 5 | +# Use of this source code is governed by a BSD-style license that can be |
| 6 | +# found in the LICENSE file. |
| 7 | + |
| 8 | + |
| 9 | +"""Create a ccache binary for mac hosts.""" |
| 10 | + |
| 11 | + |
| 12 | +import argparse |
| 13 | +import common |
| 14 | +import os |
| 15 | +import subprocess |
| 16 | +import utils |
| 17 | + |
| 18 | +URL = "https://github.com/ccache/ccache/releases/download/v3.7.7/ccache-3.7.7.tar.gz" |
| 19 | +VERSION = "ccache-3.7.7" |
| 20 | + |
| 21 | +def create_asset(target_dir): |
| 22 | + # configure --prefix requires an absolute path. |
| 23 | + target_dir = os.path.abspath(target_dir) |
| 24 | + |
| 25 | + # Download and extract the source. |
| 26 | + with utils.tmp_dir(): |
| 27 | + subprocess.check_call(["curl", "-L", "-o", VERSION + ".tar.gz", |
| 28 | + "https://github.com/ccache/ccache/releases/download/v3.7.7/ccache-3.7.7.tar.gz"]) |
| 29 | + subprocess.check_call(["tar", "-xzf", VERSION + ".tar.gz"]) |
| 30 | + os.chdir(VERSION) |
| 31 | + |
| 32 | + subprocess.check_call(["./configure", "--disable-man", "--prefix=" + target_dir]) |
| 33 | + subprocess.check_call(["make"]) |
| 34 | + subprocess.check_call(["make" ,"install"]) |
| 35 | + |
| 36 | +def main(): |
| 37 | + parser = argparse.ArgumentParser() |
| 38 | + parser.add_argument('--target_dir', '-t', required=True) |
| 39 | + args = parser.parse_args() |
| 40 | + create_asset(args.target_dir) |
| 41 | + |
| 42 | + |
| 43 | +if __name__ == '__main__': |
| 44 | + main() |
0 commit comments