Skip to content

Commit

Permalink
Vendor all rust libraries from crates-io (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
mssun committed Nov 26, 2019
1 parent 410e3dc commit d6a658b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Expand Up @@ -9,3 +9,7 @@
path = third_party/mesapy path = third_party/mesapy
url = https://github.com/mesalock-linux/mesapy.git url = https://github.com/mesalock-linux/mesapy.git
branch = sgx branch = sgx
[submodule "third_party/crates-io"]
path = third_party/crates-io
url = https://github.com/mesalock-linux/crates-io.git
ignore = dirty
14 changes: 14 additions & 0 deletions cmake/scripts/setup_cmake_tomls
Expand Up @@ -71,6 +71,19 @@ def setup_cargo_for_sgx(root_dir, build_dir):
exec_cmd(cmd) exec_cmd(cmd)




def setup_cargo_for_unix(root_dir, build_dir):
"""setup cargo related files for sgx"""
third_party_dir = os.path.join(root_dir, 'third_party')
for target in ["unix_app", "sgx_untrusted_lib", "sgx_untrusted_app"]:
cmd = r'''mkdir -p {build_dir}/cmake_tomls/{target}/.cargo \
&& cp -f {third_party_dir}/crates-io/Cargo.lock {build_dir}/cmake_tomls/{target}/Cargo.lock \
&& cp -f {third_party_dir}/crates-io/config {build_dir}/cmake_tomls/{target}/.cargo/config \
&& sed -i 's/directory = "vendor"/directory = "third_party\/crates-io\/vendor"/' \
{build_dir}/cmake_tomls/{target}/.cargo/config'''
cmd = cmd.format(build_dir=build_dir, third_party_dir=third_party_dir, target=target)
exec_cmd(cmd)


def main(): def main():
"""setup tomls for cmake""" """setup tomls for cmake"""
if len(sys.argv) != 3: if len(sys.argv) != 3:
Expand All @@ -80,6 +93,7 @@ def main():
build_dir = sys.argv[2] build_dir = sys.argv[2]


create_symlinks(root_dir, build_dir) create_symlinks(root_dir, build_dir)
setup_cargo_for_unix(root_dir, build_dir)
setup_cargo_for_sgx(root_dir, build_dir) setup_cargo_for_sgx(root_dir, build_dir)




Expand Down
1 change: 1 addition & 0 deletions third_party/crates-io
Submodule crates-io added at b85481

0 comments on commit d6a658b

Please sign in to comment.