]> git.tdb.fi Git - builder.git/blobdiff - source/gnulinker.cpp
Move the bpk files into a subdirectory and install them
[builder.git] / source / gnulinker.cpp
index 2d7438d61b547e01f137c0905c049ed7f1f7d89d..e266a8ea6123a53e59d4d06cc3666a04dbc7dc22 100644 (file)
 using namespace std;
 using namespace Msp;
 
-GnuLinker::GnuLinker(Builder &b, const Architecture &a):
+GnuLinker::GnuLinker(Builder &b, const Architecture &a, const FS::Path &sysroot):
        Tool(b, a, "LINK")
 {
        input_suffixes.push_back(".o");
        input_suffixes.push_back(".a");
 
-       if(architecture->is_native())
+       if(!sysroot.empty())
+       {
+               build_info.sysroot = sysroot;
+               system_path.push_back(sysroot/"usr"/"lib");
+       }
+       else if(architecture->is_native())
        {
                system_path.push_back("/lib");
                system_path.push_back("/usr/lib");
@@ -201,6 +206,11 @@ Task *GnuLinker::Linker::run(const Target &target) const
 
        BuildInfo binfo;
        target.collect_build_info(binfo);
+
+       const FS::Path &sysroot = binfo.sysroot;
+       if(!sysroot.empty())
+               argv.push_back("--sysroot="+sysroot.str());
+
        for(BuildInfo::PathList::const_iterator i=binfo.libpath.begin(); i!=binfo.libpath.end(); ++i)
                argv.push_back("-L"+i->str());
        if(binfo.strip)