@@ -60,6 +60,13 @@ auto linkBase(const ThreadBuildData data, CompilingSession session, string rootH
60
60
);
61
61
}
62
62
63
+ /**
64
+ * Generates a static library using archiver. FIXME: BuildRequirements should know its files.
65
+ * Params:
66
+ * data = The data containing project information
67
+ * s = Compiling Session
68
+ * command = Command for being able to print it later
69
+ */
63
70
auto executeArchiver (const ThreadBuildData data, CompilingSession s, out string command)
64
71
{
65
72
import std.process ;
@@ -72,17 +79,25 @@ auto executeArchiver(const ThreadBuildData data, CompilingSession s, out string
72
79
string [] cmd = [a.bin];
73
80
final switch (a.type) with (AcceptedArchiver)
74
81
{
75
- case ar, llvmAr: cmd~= " rcs" ; break ;
82
+ case ar, llvmAr: cmd~= [ " --format=default " , " rcs" ] ; break ;
76
83
case libtool: cmd~= [" -static" , " -o" ]; break ;
77
84
case none: break ;
78
85
}
79
86
80
- cmd~= getOutputName (data.cfg, s.os, s.isa);
81
-
82
- string objExt = getObjectExtension(s.os);
83
- cmd = mapAppend(cmd, data.cfg.sourceFiles, (string src) => stripExtension(src)~ objExt);
87
+ cmd~= buildNormalizedPath (data.cfg.outputDirectory, getOutputName(data.cfg, s.os, s.isa));
84
88
89
+ putObjectFiles(cmd, data.cfg, s.os, s.compiler.compiler.gcc ? cExt : cppExt);
85
90
command = cmd.join(" " );
86
91
87
92
return executeShell (command);
93
+ }
94
+
95
+ private void putObjectFiles (ref string [] target, const BuildConfiguration b, OS os, scope const string [] extensions... )
96
+ {
97
+ import redub.command_generators.commons;
98
+ import std.file ;
99
+ import std.path ;
100
+ string [] objectFiles;
101
+ putSourceFiles(objectFiles, b.workingDir, b.sourcePaths, b.sourceFiles, b.excludeSourceFiles, extensions);
102
+ target = mapAppend(target, objectFiles, (string src) => setExtension(src, getObjectExtension(os)));
88
103
}
0 commit comments