rakepp 0.1.6.2 → 0.1.6.3
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/binarylib.rb +1 -1
- data/lib/rakepp/compiler.rb +7 -7
- data/lib/rakepp/crosstools.rb +1 -1
- data/lib/rakepp/gcccompiler.rb +88 -112
- data/lib/rakepp/gccwin32compiler.rb +3 -3
- data/lib/rakepp/linuxcompiler.rb +5 -5
- data/lib/rakepp/objectfile.rb +1 -1
- data/lib/rakepp/osxcompiler.rb +1 -1
- data/lib/rakepp/sourcelib.rb +1 -1
- metadata +26 -12
data/Rakefile
CHANGED
data/lib/rakepp/binarylib.rb
CHANGED
data/lib/rakepp/compiler.rb
CHANGED
@@ -7,19 +7,19 @@ class Compiler
|
|
7
7
|
@compileflags = compileflags
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
10
|
+
def add_tasks(artifact)
|
11
11
|
if (artifact.instance_of?(Exe)) then
|
12
|
-
|
12
|
+
add_exe_tasks(artifact)
|
13
13
|
elsif (artifact.instance_of?(SourceLib)) then
|
14
|
-
|
14
|
+
add_source_lib_tasks(artifact)
|
15
15
|
elsif (artifact.instance_of?(ObjectFile)) then
|
16
|
-
|
16
|
+
add_object_tasks(artifact)
|
17
17
|
elsif (artifact.instance_of?(Framework)) then
|
18
|
-
|
18
|
+
add_framework_tasks(artifact)
|
19
19
|
elsif (artifact.instance_of?(BinaryLib)) then
|
20
|
-
|
20
|
+
add_binary_lib_tasks(artifact)
|
21
21
|
elsif (artifact.instance_of?(SharedLib)) then
|
22
|
-
|
22
|
+
add_shared_lib_tasks(artifact)
|
23
23
|
else
|
24
24
|
raise "unknown type " + artifact.to_s
|
25
25
|
end
|
data/lib/rakepp/crosstools.rb
CHANGED
@@ -4,7 +4,7 @@ class CrossTools
|
|
4
4
|
@compilerHash = compilerHash
|
5
5
|
end
|
6
6
|
|
7
|
-
def
|
7
|
+
def source_lib(compilers, base, name, sources, dependencies, includes, privateDefines=[], forceLib=false)
|
8
8
|
todo = get_compilers(compilers)
|
9
9
|
return todo.inject(Hash.new) do |memo, pair|
|
10
10
|
key = pair[0]
|
data/lib/rakepp/gcccompiler.rb
CHANGED
@@ -3,55 +3,57 @@ require 'progressbar'
|
|
3
3
|
require 'yaml'
|
4
4
|
|
5
5
|
class GccCompiler < Compiler
|
6
|
-
def
|
6
|
+
def add_object_tasks(artifact)
|
7
7
|
outName = File.join(artifact.targetDir, artifact.source.to_o)
|
8
|
+
outDir = File.dirname(outName)
|
9
|
+
|
8
10
|
artifact.outFile = outName
|
9
11
|
depFile = artifact.dep_file
|
10
12
|
|
11
|
-
depFileTask = file depFile => artifact.source.fullPath
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
recreateDepFileTask = task "#{depFile}.recreate" do | task |
|
16
|
-
if (!File.exists?(depFile))
|
17
|
-
calcDependencies(artifact, depFile)
|
18
|
-
end
|
19
|
-
deps = YAML.load_file(depFile)
|
20
|
-
missing = deps.inject(false) do |memo, d|
|
21
|
-
memo || !File.exists?(d)
|
22
|
-
end
|
23
|
-
if (missing)
|
24
|
-
calcDependencies(artifact, depFile)
|
25
|
-
deps = YAML.load_file(depFile)
|
26
|
-
end
|
27
|
-
depFileTask.enhance(deps)
|
28
|
-
end
|
13
|
+
depFileTask = file depFile => artifact.source.fullPath { | task | calc_dependencies(artifact, depFile) }
|
14
|
+
recreateDepFileTask = recreate_task(depFile, artifact, depFileTask)
|
29
15
|
|
30
16
|
outFile = file outName => ["#{outName}.apply"] do | task |
|
31
|
-
|
32
|
-
sh command
|
17
|
+
sh "#{compiler(artifact)} -c #{defines(artifact)} #{includes(artifact)} -o #{outName} #{artifact.source.fullPath}"
|
33
18
|
end
|
34
19
|
|
35
|
-
applyTask =
|
20
|
+
applyTask = apply_task(outFile, recreateDepFileTask, depFile)
|
21
|
+
outFile.enhance([applyTask])
|
22
|
+
dirs = [artifact.targetDir, outDir]
|
23
|
+
dirs.each { |d| directory d }
|
24
|
+
[outFile, depFileTask, recreateDepFileTask].each { |task| task.enhance(dirs) }
|
25
|
+
All.addObject(artifact)
|
26
|
+
All.addDepFile(depFile)
|
27
|
+
end
|
28
|
+
|
29
|
+
def apply_task(outFile, recreateDepFileTask, depFile)
|
30
|
+
task "#{outFile}.apply" => recreateDepFileTask do |task|
|
36
31
|
deps = YAML.load_file(depFile)
|
37
32
|
if (deps)
|
38
33
|
outFile.enhance(deps)
|
39
34
|
end
|
40
35
|
outFile.enhance([depFile])
|
41
36
|
end
|
37
|
+
end
|
42
38
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
39
|
+
def recreate_task(depFile, artifact, depFileTask)
|
40
|
+
task "#{depFile}.recreate" do | task |
|
41
|
+
if (!File.exists?(depFile))
|
42
|
+
calc_dependencies(artifact, depFile)
|
43
|
+
end
|
44
|
+
deps = YAML.load_file(depFile)
|
45
|
+
if (dep_missing?(deps))
|
46
|
+
calc_dependencies(artifact, depFile)
|
47
|
+
deps = YAML.load_file(depFile)
|
48
|
+
end
|
49
|
+
depFileTask.enhance(deps)
|
50
|
+
end
|
51
|
+
end
|
52
52
|
|
53
|
-
|
54
|
-
|
53
|
+
def dep_missing?(deps)
|
54
|
+
deps.inject(false) do |memo, d|
|
55
|
+
memo || !File.exists?(d)
|
56
|
+
end
|
55
57
|
end
|
56
58
|
|
57
59
|
def compiler(artifact)
|
@@ -80,7 +82,7 @@ class GccCompiler < Compiler
|
|
80
82
|
return res
|
81
83
|
end
|
82
84
|
|
83
|
-
def
|
85
|
+
def calc_dependencies(artifact, taskToEnhance)
|
84
86
|
source = artifact.source
|
85
87
|
command = "#{compiler(artifact)} -M #{defines(artifact)} #{includes(artifact)} #{source.fullPath}"
|
86
88
|
deps = `#{command}`
|
@@ -97,13 +99,10 @@ class GccCompiler < Compiler
|
|
97
99
|
return "ar -r #{outName}"
|
98
100
|
end
|
99
101
|
|
100
|
-
def
|
102
|
+
def add_source_lib_tasks(artifact)
|
101
103
|
outDir = File.join(@targetDir, artifact.name)
|
102
104
|
|
103
|
-
objects =
|
104
|
-
artifact.sources.each do |source|
|
105
|
-
objects << ObjectFile.new(self, source, outDir, artifact.tr_includes, artifact.privateDefines).outFile
|
106
|
-
end
|
105
|
+
objects = artifact.sources.map { |source| ObjectFile.new(self, source, outDir, artifact.tr_includes, artifact.privateDefines).outFile }
|
107
106
|
|
108
107
|
libsName = File.join(@targetDir, 'libs')
|
109
108
|
outName = File.join(libsName, "lib#{artifact.name}.a")
|
@@ -111,113 +110,90 @@ class GccCompiler < Compiler
|
|
111
110
|
artifact.outFile = outName
|
112
111
|
desc "Create SourceLib #{outName}"
|
113
112
|
theTask = file outName => objects do | task |
|
114
|
-
|
115
|
-
objects.each do | o |
|
116
|
-
command += " #{o}"
|
117
|
-
end
|
118
|
-
sh command
|
113
|
+
sh objects.inject(start_of_source_lib_command(outName, artifact)) { | command, o | "#{command} #{o}" }
|
119
114
|
end
|
120
115
|
|
121
|
-
|
116
|
+
add_transitive_library_prerequisites(theTask, artifact)
|
122
117
|
|
123
118
|
file outName => [libsName]
|
124
119
|
All.add(outName)
|
125
120
|
directory libsName
|
126
121
|
end
|
127
122
|
|
128
|
-
def
|
129
|
-
|
130
|
-
|
131
|
-
artifact.sources.each do |source|
|
132
|
-
objects << ObjectFile.new(self, source, outDir, artifact.tr_includes, artifact.privateDefines).outFile
|
133
|
-
end
|
134
|
-
libsName = File.join(@targetDir, 'libs')
|
135
|
-
outName = File.join(libsName, "#{artifact.name}.#{shared_extension()}")
|
136
|
-
artifact.outFile = outName
|
137
|
-
desc "Create SharedLib #{outName}"
|
138
|
-
theTask = file outName => objects do | task |
|
139
|
-
command = start_of_shared_lib_command(outName, artifact)
|
140
|
-
objects.each do |o|
|
141
|
-
command += " #{o}"
|
142
|
-
end
|
123
|
+
def add_shared_lib_tasks(artifact)
|
124
|
+
outDir = File.join(@targetDir, artifact.name)
|
125
|
+
objects = artifact.sources.map { |source| ObjectFile.new(self, source, outDir, artifact.tr_includes, artifact.privateDefines).outFile }
|
143
126
|
|
144
|
-
|
145
|
-
|
127
|
+
libsName = File.join(@targetDir, 'libs')
|
128
|
+
outName = File.join(libsName, "#{artifact.name}.#{shared_extension()}")
|
129
|
+
artifact.outFile = outName
|
130
|
+
desc "Create SharedLib #{outName}"
|
131
|
+
theTask = file outName => objects do | task |
|
132
|
+
command = start_of_shared_lib_command(outName, artifact)
|
133
|
+
objects.each { |o| command += " #{o}" }
|
134
|
+
LibHelper.tr_libs(artifact.libs).each { |lib| command += add_lib(task, lib) }
|
135
|
+
command += " -o #{outName}"
|
136
|
+
sh command
|
146
137
|
end
|
147
138
|
|
148
|
-
|
149
|
-
sh command
|
150
|
-
end
|
151
|
-
|
152
|
-
addTransitiveLibraryPrerequisites(theTask, artifact)
|
153
|
-
|
154
|
-
file outName => [libsName]
|
155
|
-
All.add(outName)
|
156
|
-
directory libsName
|
157
|
-
end
|
158
|
-
|
159
|
-
def addBinaryLibTasks(artifact)
|
160
|
-
artifact.outFile = "lib#{artifact.name}.a"
|
161
|
-
end
|
162
|
-
|
163
|
-
def addFrameworkTasks(artifact)
|
164
|
-
artifact.outFile = artifact.name
|
165
|
-
end
|
139
|
+
add_transitive_library_prerequisites(theTask, artifact)
|
166
140
|
|
141
|
+
file outName => [libsName]
|
142
|
+
All.add(outName)
|
143
|
+
directory libsName
|
144
|
+
end
|
167
145
|
|
168
|
-
def
|
169
|
-
|
146
|
+
def add_binary_lib_tasks(artifact)
|
147
|
+
artifact.outFile = "lib#{artifact.name}.a"
|
148
|
+
end
|
170
149
|
|
171
|
-
|
172
|
-
|
173
|
-
objects << ObjectFile.new(self, source, outDir, artifact.tr_includes).outFile
|
150
|
+
def add_framework_tasks(artifact)
|
151
|
+
artifact.outFile = artifact.name
|
174
152
|
end
|
175
153
|
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
154
|
+
def add_exe_tasks(artifact)
|
155
|
+
outDir = File.join(@targetDir, artifact.name)
|
156
|
+
objects = artifact.sources.map { |source| ObjectFile.new(self, source, outDir, artifact.tr_includes).outFile }
|
157
|
+
exesName = File.join(@targetDir, 'exes')
|
158
|
+
artifact.outFile = File.join(exesName, artifact.name + '.exe')
|
159
|
+
desc "Create Exe #{artifact.outFile}"
|
160
|
+
theTask = file artifact.outFile => objects do | task |
|
161
|
+
command = "g++ #{compileflags} -o #{artifact.outFile}"
|
162
|
+
objects.each { |o| command += " #{o}" }
|
163
|
+
command += start_of_libs()
|
164
|
+
LibHelper.tr_libs(artifact.libs).each { |lib| command += add_lib(task, lib) }
|
165
|
+
command += end_of_libs()
|
166
|
+
sh command
|
167
|
+
do_additional_work_for_exe(artifact)
|
183
168
|
end
|
184
169
|
|
185
|
-
|
186
|
-
LibHelper.tr_libs(artifact.libs).each do |lib|
|
187
|
-
command += addLib(task, lib)
|
188
|
-
end
|
189
|
-
command += endOfLibs
|
170
|
+
add_transitive_library_prerequisites(theTask, artifact)
|
190
171
|
|
191
|
-
|
192
|
-
|
172
|
+
file artifact.outFile => [exesName]
|
173
|
+
All.add(artifact.outFile)
|
174
|
+
directory exesName
|
193
175
|
end
|
194
176
|
|
195
|
-
|
196
|
-
|
197
|
-
file artifact.outFile => [exesName]
|
198
|
-
All.add(artifact.outFile)
|
199
|
-
directory exesName
|
200
|
-
end
|
201
|
-
def startOfLibs
|
177
|
+
def start_of_libs()
|
202
178
|
return ''
|
203
179
|
end
|
204
|
-
def
|
180
|
+
def end_of_libs()
|
205
181
|
return ''
|
206
182
|
end
|
207
183
|
def do_additional_work_for_exe(artifact)
|
208
184
|
end
|
209
185
|
|
210
|
-
def
|
186
|
+
def add_transitive_library_prerequisites(theTask, artifact)
|
211
187
|
LibHelper.tr_libs(artifact.libs).each do |lib|
|
212
188
|
theTask.prerequisites << lib.outFile unless lib.kind_of?(BinaryLib)
|
213
189
|
end
|
214
190
|
end
|
215
191
|
|
216
|
-
def
|
192
|
+
def add_lib(task, lib)
|
217
193
|
if (lib.instance_of?(BinaryLib)) then
|
218
194
|
return " -L#{lib.path||'/usr/lib'} -l#{lib.name} "
|
219
195
|
elsif (lib.instance_of?(SourceLib)) then
|
220
|
-
return "#{
|
196
|
+
return "#{add_lib_prefix(lib)} -L#{targetDir}/libs -l#{lib.name} #{add_lib_suffix(lib)}"
|
221
197
|
elsif (lib.instance_of?(SharedLib)) then
|
222
198
|
return " #{targetDir}/libs/#{lib.name}.so "
|
223
199
|
else
|
@@ -225,11 +201,11 @@ end
|
|
225
201
|
end
|
226
202
|
end
|
227
203
|
|
228
|
-
def
|
204
|
+
def add_lib_prefix(lib)
|
229
205
|
return ''
|
230
206
|
end
|
231
207
|
|
232
|
-
def
|
208
|
+
def add_lib_suffix(lib)
|
233
209
|
return ''
|
234
210
|
end
|
235
211
|
|
@@ -7,17 +7,17 @@ class GccWin32Compiler < GccCompiler
|
|
7
7
|
return "g++ -shared -Wl,--out-implib=#{libName}.a"
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
10
|
+
def shared_extension()
|
11
11
|
return 'dll'
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
14
|
+
def add_lib(task, lib)
|
15
15
|
if (lib.instance_of?(BinaryLib)) then
|
16
16
|
return " -l#{lib.name}"
|
17
17
|
elsif (lib.instance_of?(SourceLib)) then
|
18
18
|
return " -L#{targetDir}/libs -l#{lib.name}"
|
19
19
|
elsif (lib.instance_of?(SharedLib)) then
|
20
|
-
return " #{targetDir}/libs/#{lib.name}.#{
|
20
|
+
return " #{targetDir}/libs/#{lib.name}.#{shared_extension()}.a"
|
21
21
|
else
|
22
22
|
raise "#{lib} not supported"
|
23
23
|
end
|
data/lib/rakepp/linuxcompiler.rb
CHANGED
@@ -8,12 +8,12 @@ class LinuxCompiler < GccCompiler
|
|
8
8
|
return "g++ -shared"
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
11
|
+
def shared_extension()
|
12
12
|
return 'so'
|
13
13
|
end
|
14
14
|
|
15
15
|
|
16
|
-
def
|
16
|
+
def add_lib_prefix(lib)
|
17
17
|
if lib.forceLib
|
18
18
|
return '-Wl,--whole-archive'
|
19
19
|
else
|
@@ -21,7 +21,7 @@ class LinuxCompiler < GccCompiler
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
24
|
+
def add_lib_suffix(lib)
|
25
25
|
if lib.forceLib
|
26
26
|
return '-Wl,--no-whole-archive'
|
27
27
|
else
|
@@ -29,11 +29,11 @@ class LinuxCompiler < GccCompiler
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
def
|
32
|
+
def start_of_libs()
|
33
33
|
return ' -Wl,--start-group '
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
36
|
+
def end_of_libs()
|
37
37
|
return ' -Wl,--end-group '
|
38
38
|
end
|
39
39
|
|
data/lib/rakepp/objectfile.rb
CHANGED
data/lib/rakepp/osxcompiler.rb
CHANGED
data/lib/rakepp/sourcelib.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rakepp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 6
|
9
|
+
- 3
|
10
|
+
version: 0.1.6.3
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Christian Koestlin
|
@@ -9,20 +15,24 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2010-04-
|
18
|
+
date: 2010-04-08 00:00:00 +02:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: progressbar
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
25
|
requirements:
|
21
26
|
- - ">="
|
22
27
|
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
- 0
|
31
|
+
- 3
|
23
32
|
version: 0.0.3
|
24
|
-
|
25
|
-
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
description: " Some more high level building blocks for cpp projects.\n"
|
26
36
|
email: gizmoATflopcodeDOTcom
|
27
37
|
executables: []
|
28
38
|
|
@@ -51,8 +61,10 @@ files:
|
|
51
61
|
- lib/rakepp/sourcelib.rb
|
52
62
|
- lib/rakepp.rb
|
53
63
|
- Rakefile
|
54
|
-
has_rdoc:
|
64
|
+
has_rdoc: true
|
55
65
|
homepage: http://www.flopcode.com
|
66
|
+
licenses: []
|
67
|
+
|
56
68
|
post_install_message:
|
57
69
|
rdoc_options: []
|
58
70
|
|
@@ -62,20 +74,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
62
74
|
requirements:
|
63
75
|
- - ">="
|
64
76
|
- !ruby/object:Gem::Version
|
77
|
+
segments:
|
78
|
+
- 0
|
65
79
|
version: "0"
|
66
|
-
version:
|
67
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
81
|
requirements:
|
69
82
|
- - ">="
|
70
83
|
- !ruby/object:Gem::Version
|
84
|
+
segments:
|
85
|
+
- 0
|
71
86
|
version: "0"
|
72
|
-
version:
|
73
87
|
requirements: []
|
74
88
|
|
75
89
|
rubyforge_project: rakepp
|
76
|
-
rubygems_version: 1.3.
|
90
|
+
rubygems_version: 1.3.6
|
77
91
|
signing_key:
|
78
|
-
specification_version:
|
92
|
+
specification_version: 3
|
79
93
|
summary: Cpp Support for Rake.
|
80
94
|
test_files: []
|
81
95
|
|