BuildInfo::BuildInfo():
libmode(DYNAMIC),
+ rpath_mode(NO_RPATH),
threads(false),
debug(false),
optimize(0),
sysroot = bi.sysroot;
local_incpath.insert(local_incpath.begin(), bi.local_incpath.begin(), bi.local_incpath.end());
libmode = bi.libmode;
+ rpath_mode = bi.rpath_mode;
for(LibModeMap::const_iterator i=bi.libmodes.begin(); i!=bi.libmodes.end(); ++i)
libmodes[i->first] = i->second;
keep_symbols.insert(keep_symbols.end(), bi.keep_symbols.begin(), bi.keep_symbols.end());
add("libmode", &Loader::libmode_for_lib);
add("local_incpath", &Loader::local_incpath);
add("optimize", &BuildInfo::optimize);
+ add("runtime_path_mode", &BuildInfo::rpath_mode);
add("standard", &Loader::standard);
add("strip", &BuildInfo::strip);
add("sysroot", &Loader::sysroot);
else
throw lexical_error(format("Conversion of '%s' to LibraryMode", conv.get()));
}
+
+
+void operator>>(const LexicalConverter &conv, BuildInfo::RuntimePathMode &rpath_mode)
+{
+ if(conv.get()=="NONE")
+ rpath_mode = BuildInfo::NO_RPATH;
+ else if(conv.get()=="RELATIVE")
+ rpath_mode = BuildInfo::RELATIVE;
+ else if(conv.get()=="ABSOLUTE")
+ rpath_mode = BuildInfo::ABSOLUTE;
+ else
+ throw lexical_error(format("Conversion of '%s' to RuntimePathMode", conv.get()));
+}
FORCE_DYNAMIC //< Only accept dynamic libraries
};
+ enum RuntimePathMode
+ {
+ NO_RPATH, //< Do not record rpath in binaries
+ RELATIVE, //< Record relative rpath in binaries
+ ABSOLUTE //< Record absolute rpath in binaries
+ };
+
class Loader: public Msp::DataFile::ObjectLoader<BuildInfo>
{
public:
PathList libpath;
WordList libs;
Tracked<LibraryMode> libmode;
+ Tracked<RuntimePathMode> rpath_mode;
LibModeMap libmodes;
WordList keep_symbols;
StandardMap standards;
if(!sysroot.empty())
argv.push_back("--sysroot="+sysroot.str());
+ FS::Path lib_dir = builder.get_prefix()/"lib";
+ if(binfo.rpath_mode==BuildInfo::ABSOLUTE)
+ argv.push_back("-Wl,-rpath,"+lib_dir.str());
+ else
+ {
+ if(binfo.rpath_mode==BuildInfo::RELATIVE)
+ argv.push_back("-Wl,-rpath,$ORIGIN/../lib");
+ argv.push_back("-Wl,-rpath-link,"+lib_dir.str());
+ }
+
for(BuildInfo::PathList::const_iterator i=binfo.libpath.begin(); i!=binfo.libpath.end(); ++i)
argv.push_back("-L"+i->str());
if(binfo.strip)