Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Unified Diff: mojo/public/rust/build.rs

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/rust/README.md ('k') | mojo/public/rust/src/bindings/decoding.rs » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/rust/build.rs
diff --git a/mojo/public/rust/build.rs b/mojo/public/rust/build.rs
deleted file mode 100644
index 4c5740c6800caa1945750905645d7aabce50c088..0000000000000000000000000000000000000000
--- a/mojo/public/rust/build.rs
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-//! This build.rs generates some parameters for Cargo which are necessary to build.
-//! Particularly, it searches for libsystem_thunks.a.
-
-use std::env;
-use std::ffi::OsStr;
-use std::fs;
-use std::path::Path;
-use std::path::PathBuf;
-use std::vec::Vec;
-
-/// Searches a directory recursively for libsystem_thunks.a
-/// and returns the path if found, or None if not found.
-fn search_output(p: &Path, search_file: &OsStr) -> Option<PathBuf> {
- let mut dirs = Vec::new();
- let paths = fs::read_dir(p).unwrap();
- for dir_entry in paths {
- let path = dir_entry.unwrap().path();
- if path.is_dir() {
- dirs.push(path);
- } else {
- let found = match path.file_name() {
- Some(name) => name == search_file,
- None => false,
- };
- if found {
- return Some(p.to_path_buf());
- }
- }
- }
- for path in dirs.iter() {
- match search_output(path.as_path(), search_file) {
- Some(thunks_path) => return Some(thunks_path),
- None => continue,
- }
- }
- None
-}
-
-fn main() {
- let mojo_out_dir = Path::new(env!("MOJO_OUT_DIR"));
- let embed = match env::var("MOJO_RUST_NO_EMBED") {
- Ok(_) => false,
- Err(_) => true,
- };
- if mojo_out_dir.is_dir() {
- if !embed {
- match search_output(mojo_out_dir, OsStr::new("libsystem_thunks.a")) {
- Some(path) => {
- println!("cargo:rustc-link-lib=static=system_thunks");
- println!("cargo:rustc-link-search=native={}", path.display());
- }
- None => panic!("Failed to find system_thunks."),
- }
- } else {
- println!("cargo:rustc-link-lib=stdc++");
- match search_output(mojo_out_dir, OsStr::new("libvalidation_parser.a")) {
- Some(path) => {
- println!("cargo:rustc-link-lib=static=validation_parser");
- println!("cargo:rustc-link-search=native={}", path.display());
- }
- None => panic!("Failed to find validation_parser."),
- }
- match search_output(mojo_out_dir, OsStr::new("librust_embedder.a")) {
- Some(path) => {
- println!("cargo:rustc-link-lib=static=rust_embedder");
- println!("cargo:rustc-link-search=native={}", path.display());
- }
- None => panic!("Failed to find rust_embedder."),
- }
- }
- } else {
- panic!("MOJO_OUT_DIR is not a valid directory.");
- }
-}
« no previous file with comments | « mojo/public/rust/README.md ('k') | mojo/public/rust/src/bindings/decoding.rs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698