#include <vector>
#include <msp/fs/dir.h>
#include <msp/fs/utils.h>
+#include <msp/strings/format.h>
#include "builder.h"
#include "component.h"
#include "executable.h"
vector<string> argv;
argv.push_back(command);
- const Component &comp = bin.get_component();
+ const Component &comp = *bin.get_component();
if(shlib)
{
argv.push_back("-shared");
+ argv.push_back("-fPIC");
if(!shlib->get_soname().empty())
argv.push_back("-Wl,-soname,"+shlib->get_soname());
}
argv.push_back("-static");
const BuildInfo &binfo = comp.get_build_info();
- for(list<string>::const_iterator i=binfo.ldflags.begin(); i!=binfo.ldflags.end(); ++i)
- argv.push_back(*i);
for(list<string>::const_iterator i=binfo.libpath.begin(); i!=binfo.libpath.end(); ++i)
argv.push_back("-L"+*i);
+ if(binfo.strip)
+ argv.push_back("-s");
+ if(binfo.threads)
+ argv.push_back("-pthread");
+
+ const Architecture &arch = builder.get_current_arch();
+ const Architecture &native_arch = builder.get_native_arch();
+ if(arch.get_bits()!=native_arch.get_bits())
+ argv.push_back(format("-m%d", arch.get_bits()));
FS::Path work_dir = comp.get_package().get_source();