diff options
author | John Hodge <tpg@mutabah.net> | 2017-08-30 21:08:51 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2017-08-31 16:31:24 +0800 |
commit | 5dce4fe24f29818b250eda177c68da5e2c7ee487 (patch) | |
tree | 5293dec3a5d154634ae211fe60997afd4bbccd67 /tools/minicargo/manifest.cpp | |
parent | 4e9adae0c15e163290426db1c7d1956abc4c56f5 (diff) | |
download | mrust-5dce4fe24f29818b250eda177c68da5e2c7ee487.tar.gz |
minicargo - Build scripts working (mostly)
Diffstat (limited to 'tools/minicargo/manifest.cpp')
-rw-r--r-- | tools/minicargo/manifest.cpp | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/tools/minicargo/manifest.cpp b/tools/minicargo/manifest.cpp index dd7d8d23..5f7ecdf0 100644 --- a/tools/minicargo/manifest.cpp +++ b/tools/minicargo/manifest.cpp @@ -510,20 +510,50 @@ void PackageManifest::load_build_script(const ::std::string& path) } // cargo:rustc-link-search=foo/bar/baz else if( key == "rustc-link-search" ) { - // TODO: Check for an = (otherwise default to dynamic) - throw ::std::runtime_error("TODO: rustc-link-search"); + // Check for an = (otherwise default to native) + ::std::string value_str = value; + auto pos = value_str.find_first_of('='); + const char* type = "native"; + ::std::string name; + if(pos == ::std::string::npos) { + name = ::std::move(value_str); + } + else { + name = value_str.substr(pos+1); + auto ty_str = value_str.substr(0, pos); + if( ty_str == "native" ) { + type = "native"; + } + else { + throw ::std::runtime_error(::format("TODO: rustc-link-search ", ty_str)); + } + } + rv.rustc_link_search.push_back(::std::make_pair(type, ::std::move(name))); } // cargo:rustc-link-lib=mysql else if( key == "rustc-link-lib" ) { - // TODO: Check for an = (otherwise default to dynamic) - ::std::string lazy = value; - auto pos = lazy.find_first_of('='); + // Check for an = (otherwise default to dynamic) + ::std::string value_str = value; + auto pos = value_str.find_first_of('='); + const char* type = "static"; + ::std::string name; if(pos == ::std::string::npos) { - rv.rustc_link_lib.push_back(::std::make_pair("static", lazy)); + name = ::std::move(value_str); } else { - throw ::std::runtime_error("TODO: rustc-link-lib"); + name = value_str.substr(pos+1); + auto ty_str = value_str.substr(0, pos); + if( ty_str == "static" ) { + type = "static"; + } + else if( ty_str == "dynamic" ) { + type = "dynamic"; + } + else { + throw ::std::runtime_error(::format("TODO: rustc-link-lib ", ty_str)); + } } + rv.rustc_link_lib.push_back(::std::make_pair(type, ::std::move(name))); } // cargo:rustc-cfg=foo else if( key == "rustc-cfg" ) { |