Skip to content

Commit 253b03a

Browse files
committed
fixed compilation
1 parent c3a89e1 commit 253b03a

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

rust1.32/compile

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,31 @@ serde_json = "1.0"
4949
"""
5050

5151
def build(tgt_dir):
52-
pass
52+
# support RELEASE
53+
cmd = ["cargo", "build"]
54+
bin_dir = "debug"
55+
if "RELEASE" in os.environ:
56+
cmd += "--release"
57+
bin_dir = "release"
58+
env = {
59+
"CARGO_HOME": "/usr/local/cargo",
60+
"PATH": "/usr/local/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
61+
"RUSTUP_HOME": "/usr/local/rustup"
62+
}
63+
p = subprocess.Popen(cmd,
64+
stdout=subprocess.PIPE,
65+
stderr=subprocess.PIPE,
66+
cwd="/usr/src", env=env)
67+
(o, e) = p.communicate()
68+
if isinstance(o, bytes): o = o.decode('utf-8')
69+
if isinstance(e, bytes): e = e.decode('utf-8')
70+
if p.returncode != 0:
71+
sys.stdout.write(o)
72+
sys.stdout.write(e)
73+
else:
74+
shutil.move(
75+
"/usr/src/target/%s/action_loop" % bin_dir,
76+
"%s/exec" % tgt_dir)
5377

5478
def sources(main, src_dir):
5579
# move away the action dir and replace with the new

0 commit comments

Comments
 (0)