autorake 2.1.1 → 2.2

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODk3MTNhZjU5MzVlZDQ4OTRiZjFlYWIxYThjYmZhMzJhMGRhN2I3MA==
4
+ ZGVkY2MwNDQwNWY2YzYwMmE3OGI2MTc4ZGQwNWVlZTNlODhiNzk4Ng==
5
5
  data.tar.gz: !binary |-
6
- NGY4OTk5MGJkMDI4MjI0MjU5NzE5OTVkZjU5OTEwZGNiMjUwZGY0Zg==
6
+ Zjg4NWFjZmU0ODExMDU2NWE1MTNhZWMxZGZlMmUyOGYwYzAzM2EyZg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZDQ4NWUxZjFiYzBhODEzZGQ2MDVjNzRjZjZkZjg2OTExZTFkYTllODdkMWYy
10
- ZTI1OGQyZjY5MGVkMjMyYjdiMjkzYjMzZmM1YjM3Njc3YzFmYTVlYTBkNDlm
11
- OGExOGE1YmI3M2I4N2JhY2ZjMGY0M2MxMWY1ZjljNDkwMTg2NTg=
9
+ OGIwMDJlZmM5YzUyOTk1OTk3ZTAwOWEyZmYxZmU2YmVmYzk0ZDFiMTNjNTdk
10
+ Mzg2OTQxOTM2NTdjMGZiMzY1MTJjNzViZWE4NTg3MWQ1YzcwNTg1NTJlNWI3
11
+ M2ZlOTQwOTFlZmYyYTZkOTAwNTM1MmYwOWQ2MWQyNjU1NDVjMzY=
12
12
  data.tar.gz: !binary |-
13
- NmE5YzUwN2M2YWMxMGIxNDhhYmY4YjkwMzRlMTEzZTA5NTkzODM5ZDk2ODVh
14
- OWYyODEzZWJiMjBkZGZiZTA1NzUyYzM2ZGJiYWJiNTU2NDI1ZjRmZjlmZGVm
15
- YjNhNTRkNGI4YmRjZjA2NjYyZjljYTdmMGExOTZhZTJlZDUzZDA=
13
+ MTFkYWQ1ZDQ0Mzg5ZTFkOWRiMWEzZWI5Y2MzMTI3ZDlkMWUwZDA0M2E2MzE0
14
+ MjAzZjdlYWQ0ZTEyNjhkN2RjOTJkNTVjMDg5Njg5YTI3NzVhYTlkNTcwYTc4
15
+ NzNjOTA3NTg0NWQ2Y2Y2ZDQ5YzMxZTQyMTdhOTI0NTU1ZWExYjA=
data/lib/autorake.rb CHANGED
@@ -12,7 +12,7 @@ module Autorake
12
12
  class <<self
13
13
  def extended obj
14
14
  obj.load_autorake ENV[ "AUTORAKE_CONFIGURE"]
15
- Compiler.verbose = true
15
+ Builder.verbose = true
16
16
  end
17
17
  end
18
18
 
@@ -25,7 +25,7 @@ module Autorake
25
25
  end
26
26
 
27
27
  def compiler *args
28
- CompilerC.new @autorake.incdirs, @autorake.macros, *args
28
+ Compiler.new @autorake.incdirs, @autorake.macros, *args
29
29
  end
30
30
 
31
31
  def linker *args
@@ -4,7 +4,7 @@
4
4
 
5
5
  module Autorake
6
6
 
7
- class Compiler
7
+ class Builder
8
8
 
9
9
  class Error < StandardError ; end
10
10
 
@@ -13,30 +13,42 @@ module Autorake
13
13
  end
14
14
 
15
15
  def cc *a
16
- a.flatten!
17
- a.compact!
18
- a.unshift ENV[ "CC"] || "cc"
19
- message a
20
- f = fork do
21
- $stderr.reopen "/dev/null" if Compiler.quiet
22
- exec *a
23
- end
24
- Process.waitpid f
25
- $?.success? or raise Error, "#{self.class} failed."
16
+ command "CC", "cc" do build *a end
26
17
  end
27
18
 
19
+ def cxx *a
20
+ command "CXX", "c++" do build *a end
21
+ end
22
+ alias cpp cxx
23
+
28
24
  private
29
25
 
30
- def message a
31
- if Compiler.verbose then
26
+ def command env, default
27
+ @cmd = ENV[ env] || default
28
+ yield
29
+ ensure
30
+ @cmd = nil
31
+ end
32
+
33
+ def build *a
34
+ a.flatten!
35
+ a.compact!
36
+ a.unshift @cmd
37
+ if Builder.verbose then
32
38
  m = a.join " "
33
39
  puts m
34
40
  end
41
+ f = fork do
42
+ $stderr.reopen "/dev/null" if Builder.quiet
43
+ exec *a
44
+ end
45
+ Process.waitpid f
46
+ $?.success? or raise Error, "#{self.class} failed."
35
47
  end
36
48
 
37
49
  end
38
50
 
39
- class CompilerPP < Compiler
51
+ class Preprocessor < Builder
40
52
 
41
53
  def initialize incdirs, macros, *args
42
54
  @incdirs = incdirs.map { |d| "-I#{d}" }
@@ -51,7 +63,7 @@ module Autorake
51
63
  @cflags = e.split if e
52
64
  end
53
65
 
54
- def cc obj, src
66
+ def build obj, src
55
67
  io = [ "-o", obj.to_s, "-c", src.to_s]
56
68
  super @cflags, @macros, @incdirs, @args, opt_E, io
57
69
  end
@@ -64,7 +76,7 @@ module Autorake
64
76
 
65
77
  end
66
78
 
67
- class CompilerC < CompilerPP
79
+ class Compiler < Preprocessor
68
80
 
69
81
  private
70
82
 
@@ -72,17 +84,17 @@ module Autorake
72
84
 
73
85
  end
74
86
 
75
- class Linker < Compiler
87
+ class Linker < Builder
76
88
 
77
89
  def initialize libdirs, libs, *args
78
90
  @libdirs = libdirs.map { |d| "-Wl,-L#{d}" }
79
91
  @libs = libs.map { |d| "-Wl,-l#{d}" }
80
- @args = args
92
+ @args = args
81
93
  e = ENV[ "LDFLAGS"]
82
94
  @ldflags = e.split if e
83
95
  end
84
96
 
85
- def cc bin, *objs
97
+ def build bin, *objs
86
98
  io = [ "-o", bin.to_s, objs]
87
99
  super @ldflags, @libdirs, @libs, @args, io
88
100
  end
@@ -28,7 +28,7 @@ module Autorake
28
28
  end
29
29
 
30
30
  def perform
31
- Compiler.quiet = true
31
+ Builder.quiet = true
32
32
  c = Configuration.new @environment, @directories
33
33
  c.do_env
34
34
  c.features.update @features
@@ -197,7 +197,7 @@ module Autorake
197
197
  end
198
198
  print "yes"
199
199
  true
200
- rescue Compiler::Error
200
+ rescue Builder::Error
201
201
  print "no"
202
202
  false
203
203
  ensure
@@ -214,7 +214,7 @@ module Autorake
214
214
  SRC
215
215
  end
216
216
  def compile t
217
- c = CompilerPP.new @config.incdirs, @config.macros, "-w"
217
+ c = Preprocessor.new @config.incdirs, @config.macros, "-w"
218
218
  c.cc t.cpp, t.src
219
219
  end
220
220
  def set!
@@ -247,7 +247,7 @@ module Autorake
247
247
  SRC
248
248
  end
249
249
  def compile t
250
- c = CompilerPP.new @config.incdirs, @config.macros, "-w"
250
+ c = Preprocessor.new @config.incdirs, @config.macros, "-w"
251
251
  c.cc t.cpp, t.src
252
252
  end
253
253
  def check!
@@ -267,7 +267,7 @@ void dummy( void)
267
267
  SRC
268
268
  end
269
269
  def compile t
270
- c = CompilerC.new @config.incdirs, @config.macros, "-w"
270
+ c = Compiler.new @config.incdirs, @config.macros, "-w"
271
271
  c.cc t.obj, t.src
272
272
  end
273
273
  def set!
@@ -283,7 +283,7 @@ int main( int argc, char *argv[]) { return 0; }
283
283
  SRC
284
284
  end
285
285
  def compile t
286
- c = CompilerC.new @config.incdirs, @config.macros, "-w"
286
+ c = Compiler.new @config.incdirs, @config.macros, "-w"
287
287
  c.cc t.obj, t.src
288
288
  l = Linker.new @config.libdirs, [ @name], "-w"
289
289
  l.cc t.bin, t.obj
@@ -5,7 +5,7 @@
5
5
  module Autorake
6
6
 
7
7
  NAME = "autorake"
8
- VERSION = "2.1.1"
8
+ VERSION = "2.2"
9
9
  SUMMARY = "Automake like project config before Rake build or install."
10
10
 
11
11
  DESCRIPTION = <<EOT
@@ -11,7 +11,7 @@ rule ".o" => ".c" do |t|
11
11
  c.cc t.name, t.source
12
12
  end
13
13
 
14
- task "hello" => "hello.o" do |t|
14
+ file "hello" => "hello.o" do |t|
15
15
  l.cc t.name, t.prerequisites
16
16
  end
17
17
 
@@ -7,7 +7,7 @@
7
7
  #define SAY_IT
8
8
  #endif
9
9
 
10
- int main( int argc, char ** argv)
10
+ int main( int argc, char **argv)
11
11
  {
12
12
  #ifdef SAY_IT
13
13
  printf( "Hello, world!\n");
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autorake
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: '2.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bertram Scharpf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-09 00:00:00.000000000 Z
11
+ date: 2013-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake