rakepp 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/lib/rakepp.rb +1 -0
- data/lib/rakepp/compiler.rb +3 -2
- data/lib/rakepp/crosstools.rb +50 -0
- data/lib/rakepp/gcccompiler.rb +42 -38
- data/lib/rakepp/linuxcompiler.rb +2 -2
- data/lib/rakepp/osxcompiler.rb +5 -4
- metadata +3 -2
data/Rakefile
CHANGED
data/lib/rakepp.rb
CHANGED
data/lib/rakepp/compiler.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
class Compiler
|
2
|
-
attr_reader :targetDir
|
2
|
+
attr_reader :targetDir, :compileflags
|
3
3
|
|
4
|
-
def initialize(targetDir, defines)
|
4
|
+
def initialize(targetDir, defines, compileflags)
|
5
5
|
@targetDir = targetDir
|
6
6
|
@defines = defines
|
7
|
+
@compileflags = compileflags
|
7
8
|
end
|
8
9
|
|
9
10
|
def addTasks(artifact)
|
@@ -0,0 +1,50 @@
|
|
1
|
+
class CrossTools
|
2
|
+
|
3
|
+
def initialize(compilerHash)
|
4
|
+
@compilerHash = compilerHash
|
5
|
+
end
|
6
|
+
|
7
|
+
def sourceLib(compilers, base, name, sources, dependencies, includes, privateDefines=[], forceLib=false)
|
8
|
+
todo = get_compilers(compilers)
|
9
|
+
return todo.inject(Hash.new) do |memo, pair|
|
10
|
+
key = pair[0]
|
11
|
+
compiler = pair[1]
|
12
|
+
deps = dependencies[key]
|
13
|
+
if deps == nil
|
14
|
+
if dependencies.size == 0
|
15
|
+
deps = Array.new
|
16
|
+
else
|
17
|
+
raise "missing deps for sourcelib: '#{name}' and compiler: '#{key}'"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
memo[key] = [SourceLib.new(compiler, base, name, sources, deps, includes, privateDefines, forceLib)]
|
21
|
+
memo
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def exe(compilers, base, name, sources, libs, includes)
|
26
|
+
todo = get_compilers(compilers)
|
27
|
+
return todo.inject(Hash.new) do |memo, pair|
|
28
|
+
key = pair[0]
|
29
|
+
compiler = pair[1]
|
30
|
+
l = libs[key]
|
31
|
+
if l == nil
|
32
|
+
raise "missing libs for exe: '#{name}' and compiler: '#{key}'"
|
33
|
+
end
|
34
|
+
memo[key] = Exe.new(compiler, base, name, sources, l, includes)
|
35
|
+
memo
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def get_compilers(compilers)
|
40
|
+
if compilers == nil
|
41
|
+
return @compilerHash
|
42
|
+
else
|
43
|
+
return compilers.inject(Hash.new) do |memo, i|
|
44
|
+
memo[i] = @compilerHash[i]
|
45
|
+
memo
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
data/lib/rakepp/gcccompiler.rb
CHANGED
@@ -12,16 +12,26 @@ class GccCompiler < Compiler
|
|
12
12
|
calcDependencies(artifact, depFile)
|
13
13
|
end
|
14
14
|
|
15
|
-
|
15
|
+
recreateDepFileTask = task "#{depFile}.recreate" do | task |
|
16
|
+
puts "wird immer gemacht"
|
17
|
+
if (!File.exists?(depFile))
|
18
|
+
calcDependencies(artifact, depFile)
|
19
|
+
end
|
20
|
+
deps = YAML.load_file(depFile)
|
21
|
+
if (deps)
|
22
|
+
depFileTask.enhance(deps)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
outFile = file outName => ["#{depFile}.recreate", depFile] do | task |
|
16
27
|
command = "#{compiler(artifact)} -c #{defines(artifact)} #{includes(artifact)} -o #{outName} #{artifact.source.fullPath}"
|
17
28
|
sh command
|
18
29
|
end
|
19
|
-
|
20
|
-
applyTask = task "#{
|
30
|
+
|
31
|
+
applyTask = task "#{outFile}.apply" => recreateDepFileTask do |task|
|
21
32
|
deps = YAML.load_file(depFile)
|
22
33
|
if (deps)
|
23
34
|
outFile.enhance(deps)
|
24
|
-
depFileTask.enhance(deps[1..-1])
|
25
35
|
end
|
26
36
|
end
|
27
37
|
|
@@ -33,25 +43,18 @@ class GccCompiler < Compiler
|
|
33
43
|
dirs = [artifact.targetDir, File.dirname(outName)]
|
34
44
|
outFile.enhance(dirs)
|
35
45
|
depFileTask.enhance(dirs)
|
46
|
+
recreateDepFileTask.enhance(dirs)
|
36
47
|
|
37
48
|
All.addObject(artifact)
|
38
49
|
All.addDepFile(depFile)
|
39
50
|
end
|
40
51
|
|
41
|
-
def arch
|
42
|
-
if ARCH.length > 0
|
43
|
-
return "-arch #{ARCH}"
|
44
|
-
end
|
45
|
-
return ''
|
46
|
-
end
|
47
|
-
|
48
52
|
def compiler(artifact)
|
49
|
-
|
50
53
|
if ((artifact.source.fullPath.index(".cpp") != nil) ||
|
51
54
|
(artifact.source.fullPath.index(".cxx") != nil)) then
|
52
|
-
return "g++ #{
|
55
|
+
return "g++ #{compileflags}"
|
53
56
|
else
|
54
|
-
return "gcc #{
|
57
|
+
return "gcc #{compileflags}"
|
55
58
|
end
|
56
59
|
end
|
57
60
|
|
@@ -85,37 +88,38 @@ class GccCompiler < Compiler
|
|
85
88
|
f.write(deps.to_yaml)
|
86
89
|
end
|
87
90
|
end
|
91
|
+
|
88
92
|
def startOfSourceLibCommand(outName, artifact)
|
89
93
|
return "ar -r #{outName}"
|
90
94
|
end
|
91
95
|
|
92
|
-
def addSourceLibTasks(artifact)
|
93
|
-
|
96
|
+
def addSourceLibTasks(artifact)
|
97
|
+
outDir = File.join(@targetDir, artifact.name)
|
94
98
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
+
objects = []
|
100
|
+
artifact.sources.each do |source|
|
101
|
+
objects << ObjectFile.new(self, source, outDir, artifact.tr_includes, artifact.privateDefines).outFile
|
102
|
+
end
|
99
103
|
|
100
|
-
|
101
|
-
|
104
|
+
libsName = File.join(@targetDir, 'libs')
|
105
|
+
outName = File.join(libsName, "lib#{artifact.name}.a")
|
102
106
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
107
|
+
artifact.outFile = outName
|
108
|
+
desc "Create SourceLib #{outName}"
|
109
|
+
theTask = file outName => objects do | task |
|
110
|
+
command = startOfSourceLibCommand(outName, artifact)
|
111
|
+
objects.each do | o |
|
112
|
+
command += " #{o}"
|
113
|
+
end
|
114
|
+
sh command
|
109
115
|
end
|
110
|
-
sh command
|
111
|
-
end
|
112
116
|
|
113
|
-
|
117
|
+
addTransitiveLibraryPrerequisites(theTask, artifact)
|
114
118
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
end
|
119
|
+
file outName => [libsName]
|
120
|
+
All.add(outName)
|
121
|
+
directory libsName
|
122
|
+
end
|
119
123
|
|
120
124
|
def addSharedLibTasks(artifact)
|
121
125
|
outDir = File.join(@targetDir, artifact.name)
|
@@ -169,7 +173,7 @@ def addExeTasks(artifact)
|
|
169
173
|
artifact.outFile = File.join(exesName, artifact.name + '.exe')
|
170
174
|
desc "Create Exe #{artifact.outFile}"
|
171
175
|
theTask = file artifact.outFile => objects do | task |
|
172
|
-
command = "g++ #{
|
176
|
+
command = "g++ #{compileflags} -o #{artifact.outFile}"
|
173
177
|
objects.each do |o|
|
174
178
|
command += " #{o}"
|
175
179
|
end
|
@@ -198,13 +202,13 @@ end
|
|
198
202
|
end
|
199
203
|
def doAdditionalWorkForExe(artifact)
|
200
204
|
end
|
201
|
-
|
205
|
+
|
202
206
|
def addTransitiveLibraryPrerequisites(theTask, artifact)
|
203
207
|
LibHelper.tr_libs(artifact.libs).each do |lib|
|
204
208
|
theTask.prerequisites << lib.outFile unless lib.kind_of?(BinaryLib)
|
205
209
|
end
|
206
210
|
end
|
207
|
-
|
211
|
+
|
208
212
|
def addLib(task, lib)
|
209
213
|
if (lib.instance_of?(BinaryLib)) then
|
210
214
|
return " -L#{lib.path||'/usr/lib'} -l#{lib.name} "
|
data/lib/rakepp/linuxcompiler.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class LinuxCompiler < GccCompiler
|
2
2
|
|
3
|
-
def initialize(defines, output_suffix='')
|
4
|
-
super("linux#{output_suffix}", defines)
|
3
|
+
def initialize(defines, compileflags, output_suffix='')
|
4
|
+
super("linux#{output_suffix}", defines, compileflags)
|
5
5
|
end
|
6
6
|
|
7
7
|
def startOfSharedLibCommand(libName, artifact)
|
data/lib/rakepp/osxcompiler.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
class OsxCompiler < GccCompiler
|
2
2
|
|
3
|
-
def initialize(defines, gui=true, output_suffix='')
|
4
|
-
super("osx#{output_suffix}", defines)
|
3
|
+
def initialize(defines, compileflags, architecture, gui=true, output_suffix='')
|
4
|
+
super("osx#{output_suffix}", defines, "#{compileflags} -arch #{architecture}")
|
5
|
+
@architecture = architecture
|
5
6
|
@gui = gui
|
6
7
|
end
|
7
8
|
|
8
9
|
def startOfSourceLibCommand(outname, artifact)
|
9
|
-
return "libtool -static -arch_only #{
|
10
|
+
return "libtool -static -arch_only #{@architecture} -o #{outname}"
|
10
11
|
end
|
11
12
|
|
12
13
|
def startOfSharedLibCommand(libName, artifact)
|
@@ -14,7 +15,7 @@ class OsxCompiler < GccCompiler
|
|
14
15
|
if name == nil
|
15
16
|
name = File.basename(libName)
|
16
17
|
end
|
17
|
-
return "g++ -arch #{
|
18
|
+
return "g++ -arch #{@architecture} -dynamiclib -install_name #{name}"
|
18
19
|
end
|
19
20
|
|
20
21
|
def sharedExtension
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rakepp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Koestlin
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-03-
|
12
|
+
date: 2010-03-30 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- lib/rakepp/binarylib.rb
|
36
36
|
- lib/rakepp/cleaner.rb
|
37
37
|
- lib/rakepp/compiler.rb
|
38
|
+
- lib/rakepp/crosstools.rb
|
38
39
|
- lib/rakepp/exe.rb
|
39
40
|
- lib/rakepp/files.rb
|
40
41
|
- lib/rakepp/framework.rb
|