build-tool 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +1 -0
- data/History.txt +14 -0
- data/Rakefile +2 -1
- data/lib/build-tool.rb +1 -1
- data/lib/build-tool/application.rb +1 -1
- data/lib/build-tool/build-system/autoconf.rb +3 -21
- data/lib/build-tool/build-system/base.rb +117 -12
- data/lib/build-tool/build-system/cmake.rb +7 -22
- data/lib/build-tool/build-system/custom.rb +3 -13
- data/lib/build-tool/build-system/none.rb +0 -18
- data/lib/build-tool/build-system/qmake.rb +2 -20
- data/lib/build-tool/build-system/qt.rb +1 -30
- data/lib/build-tool/cfg/lexer.rb +10 -1
- data/lib/build-tool/cfg/lexer.rex +4 -1
- data/lib/build-tool/cfg/parser.rb +358 -320
- data/lib/build-tool/cfg/parser.y +8 -4
- data/lib/build-tool/cfg/visitor.rb +59 -26
- data/lib/build-tool/command_actions.rb +63 -4
- data/lib/build-tool/commands.rb +3 -1
- data/lib/build-tool/commands/environments/list.rb +26 -11
- data/lib/build-tool/commands/modules/info.rb +5 -2
- data/lib/build-tool/configuration.rb +30 -20
- data/lib/build-tool/module.rb +9 -0
- data/lib/mj/logging.rb +14 -4
- metadata +54 -18
- metadata.gz.sig +1 -0
data.tar.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
k�#��Wg>��%��BA���l�Tq�4f����85V���52l�� �Ď����܆!�7B���9CH�09H[=]�K4����O��Aі���ͬ֔���^DS�0�;{@(0��74s��64IЏ�w��O?��L�f��xϗ$�4�u��!�m@�艢��Se&��02���hY�ْ�U?�4b�4ݔb�/�P��.��ָ���0�9��Cz7PPT�;���B(�7B"��q��<%`����\{�ܥ�
|
data/History.txt
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
== 0.4.0
|
2
|
+
- Feature
|
3
|
+
- Show a ansi terminal code based progressbar when compiling or installing in non verbose mode.
|
4
|
+
That feature is courtesy of the ansi rubygem from (http://github.com/rubyworks/ansi). The lib
|
5
|
+
has some shortcomings.
|
6
|
+
- Colorize output. Powered by the ansi module too. The lib has a shortcoming here. It does not
|
7
|
+
check if the terminal supports colors. You will get some escape codes then. I will send a
|
8
|
+
patch upstream.
|
9
|
+
- Enhancements
|
10
|
+
- Rework the way build-systems are handled. This makes it possible to solve the cmake issue with
|
11
|
+
rpath handling by properly creating an inheritance between build-systems. It makes it possible
|
12
|
+
to alter or overwrite build-system options too.
|
13
|
+
|
14
|
+
|
1
15
|
== 0.3.3
|
2
16
|
- Feature
|
3
17
|
- The history command now supports the -n --number [COUNT] option. Use it to specify how many
|
data/Rakefile
CHANGED
data/lib/build-tool.rb
CHANGED
@@ -135,7 +135,7 @@ def BuildTool.main(name, args, root_directory)
|
|
135
135
|
# Special case for the configurationParser. It is very verbose if active.
|
136
136
|
Logging.logger['BuildTool::Cfg::Parser'].level = :info
|
137
137
|
Logging.logger['MJ::Logging::LoggerAdapter'].level = :warn
|
138
|
-
Logging.logger
|
138
|
+
Logging.logger['root'].appenders = Logging.appenders.stdout(
|
139
139
|
:layout => MJ::Logging::BasicLayout.new(),
|
140
140
|
:level => :info)
|
141
141
|
# Create the application
|
@@ -12,6 +12,7 @@ class AutoConfError < BuildTool::Error; end
|
|
12
12
|
|
13
13
|
def intitialize( *args )
|
14
14
|
super( *args )
|
15
|
+
@supported_options << 'libdir'
|
15
16
|
end
|
16
17
|
|
17
18
|
#
|
@@ -30,26 +31,6 @@ def configured?
|
|
30
31
|
### METHODS
|
31
32
|
#
|
32
33
|
|
33
|
-
def[]( var )
|
34
|
-
if @options.has_key? var
|
35
|
-
return @options[var]
|
36
|
-
end
|
37
|
-
|
38
|
-
case var
|
39
|
-
|
40
|
-
when 'libdir'
|
41
|
-
return ""
|
42
|
-
|
43
|
-
else
|
44
|
-
# *TODO* raise correct exception
|
45
|
-
raise NotImplementedError
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def[]=( var, val )
|
50
|
-
@options[var] = val
|
51
|
-
end
|
52
|
-
|
53
34
|
# Configure the module
|
54
35
|
def reconfigure()
|
55
36
|
configure
|
@@ -126,7 +107,8 @@ def make( target = nil )
|
|
126
107
|
|
127
108
|
def option_string
|
128
109
|
arr = []
|
129
|
-
|
110
|
+
option_names.each do |var|
|
111
|
+
val = self[var]
|
130
112
|
if val
|
131
113
|
arr << "--#{var}='#{val}'"
|
132
114
|
else
|
@@ -2,52 +2,156 @@
|
|
2
2
|
|
3
3
|
module BuildTool; module BuildSystem
|
4
4
|
|
5
|
+
class UnknownOptionError < BuildTool::Error; end
|
6
|
+
|
5
7
|
#
|
6
8
|
# Base class for all build system implementations
|
7
9
|
#
|
8
10
|
class Base
|
9
11
|
|
10
|
-
def initialize
|
12
|
+
def initialize ( parent = nil )
|
11
13
|
@module = nil
|
14
|
+
@default = nil
|
12
15
|
@options = Hash.new
|
13
16
|
@out_of_source = true
|
17
|
+
@supported_options = Array.new
|
18
|
+
@feature = nil
|
19
|
+
if parent and parent.name == name
|
20
|
+
@parent = parent
|
21
|
+
else
|
22
|
+
@parent = nil
|
23
|
+
end
|
14
24
|
end
|
15
25
|
|
16
26
|
#
|
17
27
|
### ATTRIBUTES
|
18
28
|
#
|
19
29
|
attr_accessor :module
|
30
|
+
attr_accessor :feature
|
20
31
|
attr_accessor :out_of_source
|
32
|
+
attr_accessor :defaults
|
21
33
|
|
22
34
|
def build_directory
|
23
35
|
@module.build_directory
|
24
36
|
end
|
25
37
|
|
26
38
|
def dup
|
27
|
-
|
28
|
-
cp.instance_variable_set( "@options", Marshal.load( Marshal.dump( @options ) ) )
|
29
|
-
cp
|
39
|
+
self.class.new( self )
|
30
40
|
end
|
31
41
|
|
32
42
|
def env
|
33
43
|
@module.environment.values
|
34
44
|
end
|
35
45
|
|
36
|
-
def
|
37
|
-
if
|
38
|
-
|
39
|
-
|
46
|
+
def parent
|
47
|
+
if @parent
|
48
|
+
par = @parent
|
49
|
+
elsif @module && @module.parent && @module.parent.build_system && ( @module.parent.build_system.name == name )
|
50
|
+
par = @module.parent.build_system
|
51
|
+
elsif @module
|
52
|
+
par = defaults
|
40
53
|
else
|
41
|
-
|
54
|
+
par = nil
|
42
55
|
end
|
56
|
+
return par
|
43
57
|
end
|
44
58
|
|
45
59
|
def option_hash
|
46
|
-
|
60
|
+
# Check the parents names (if any)
|
61
|
+
par = parent
|
62
|
+
if par
|
63
|
+
parent_option_hash = par.option_hash
|
64
|
+
else
|
65
|
+
parent_option_hash = {}
|
66
|
+
end
|
67
|
+
# If this build-system declaration is not active we are done
|
68
|
+
if active?
|
69
|
+
return parent_option_hash.merge( @options )
|
70
|
+
else
|
71
|
+
return parent_option_hash
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def option_names
|
76
|
+
# Check the parents names (if any)
|
77
|
+
par = parent
|
78
|
+
if par
|
79
|
+
parent_option_names = par.option_names
|
80
|
+
else
|
81
|
+
parent_option_names = []
|
82
|
+
end
|
83
|
+
# If this build-system declaration is not active we are done
|
84
|
+
if active?
|
85
|
+
return ( @options.keys + parent_option_names ).uniq
|
86
|
+
else
|
87
|
+
return parent_option_names
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def to_s
|
92
|
+
return "#{self.object_id} #{self.module} #{@options.keys.join( ', ')}"
|
93
|
+
end
|
94
|
+
|
95
|
+
def active?
|
96
|
+
if @feature.nil?
|
97
|
+
true
|
98
|
+
else
|
99
|
+
@feature.active?
|
100
|
+
end
|
47
101
|
end
|
48
102
|
|
49
|
-
def
|
50
|
-
|
103
|
+
def []( var )
|
104
|
+
# Get the parents value (if any)
|
105
|
+
par = parent
|
106
|
+
if par and par.option_set?( var )
|
107
|
+
parentval = par[var]
|
108
|
+
else
|
109
|
+
parentval = nil
|
110
|
+
end
|
111
|
+
# If this build-system declaration is not active we are done
|
112
|
+
if !active?
|
113
|
+
return parentval if !parentval.nil?
|
114
|
+
raise UnknownOptionError, "#{self} Option #{var} is unknown for build-system #{name}"
|
115
|
+
end
|
116
|
+
# Now check our value and merge with parents
|
117
|
+
if @options.has_key?( var )
|
118
|
+
return @options[ var ].
|
119
|
+
sub( '{{{}}} ', parentval.nil? ? "" : "#{parentval} " ).
|
120
|
+
sub( ' {{{}}}', parentval.nil? ? "" : " #{parentval}" )
|
121
|
+
end
|
122
|
+
return parentval if !parentval.nil?
|
123
|
+
return "" if @supported_options.include?( var )
|
124
|
+
raise UnknownOptionError, "#{self} Option #{var} is unknown for build-system #{name}"
|
125
|
+
end
|
126
|
+
|
127
|
+
def []=( var, value )
|
128
|
+
@options[ var ] = value
|
129
|
+
end
|
130
|
+
|
131
|
+
def option_set?( var )
|
132
|
+
return true if active? && @options.has_key?( var )
|
133
|
+
return true if parent && parent.option_set?( var )
|
134
|
+
return false
|
135
|
+
end
|
136
|
+
|
137
|
+
def set( var, value )
|
138
|
+
self[var]= value
|
139
|
+
end
|
140
|
+
|
141
|
+
def append( var, value )
|
142
|
+
if option_set?( var )
|
143
|
+
self[var]= self[var] + " " + value
|
144
|
+
else
|
145
|
+
self[var]= "{{{}}} " + value
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
def prepend( var, value )
|
150
|
+
if option_set?( var )
|
151
|
+
self[var]= value + " " + self[var]
|
152
|
+
else
|
153
|
+
self[var]= value + " {{{}}}"
|
154
|
+
end
|
51
155
|
end
|
52
156
|
|
53
157
|
def install_prefix
|
@@ -70,6 +174,7 @@ def after_rebase
|
|
70
174
|
### VIRTUAL FUNCTIONS
|
71
175
|
#
|
72
176
|
for method in [
|
177
|
+
:clone,
|
73
178
|
:configure,
|
74
179
|
:configured?,
|
75
180
|
:make,
|
@@ -16,6 +16,11 @@ class CMakeError < BuildTool::Error; end
|
|
16
16
|
|
17
17
|
def initialize( *args )
|
18
18
|
super( *args )
|
19
|
+
@supported_options <<
|
20
|
+
'CMAKE_BUILD_TYPE' <<
|
21
|
+
'CMAKE_CXXFLAGS' <<
|
22
|
+
'CMAKE_VERBOSE_MAKEFILE' <<
|
23
|
+
'LIB_SUFFIX'
|
19
24
|
end
|
20
25
|
|
21
26
|
#
|
@@ -35,27 +40,6 @@ def name
|
|
35
40
|
### METHODS
|
36
41
|
#
|
37
42
|
|
38
|
-
def[]( var )
|
39
|
-
if @options.has_key? var
|
40
|
-
return @options[var]
|
41
|
-
end
|
42
|
-
|
43
|
-
case var
|
44
|
-
|
45
|
-
when 'CMAKE_BUILD_TYPE', 'CMAKE_CXXFLAGS', 'CMAKE_VERBOSE_MAKEFILE', 'LIB_SUFFIX'
|
46
|
-
return ""
|
47
|
-
|
48
|
-
else
|
49
|
-
# *TODO* raise correct exception
|
50
|
-
raise NotImplementedError
|
51
|
-
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def[]=( var, val )
|
56
|
-
@options[var] = val
|
57
|
-
end
|
58
|
-
|
59
43
|
# Configure the module
|
60
44
|
def reconfigure()
|
61
45
|
if File.exist?( "#{build_directory}/CMakeCache.txt" )
|
@@ -107,7 +91,8 @@ def make( target = nil )
|
|
107
91
|
|
108
92
|
def option_string
|
109
93
|
arr = []
|
110
|
-
|
94
|
+
option_names.each do |var|
|
95
|
+
val = self[var]
|
111
96
|
arr << "-D#{var}='#{val}'"
|
112
97
|
end
|
113
98
|
arr.join(" ")
|
@@ -35,17 +35,6 @@ def name
|
|
35
35
|
### METHODS
|
36
36
|
#
|
37
37
|
|
38
|
-
def[]( var )
|
39
|
-
if @options.has_key? var
|
40
|
-
return @options[var]
|
41
|
-
end
|
42
|
-
raise NotImplementedError
|
43
|
-
end
|
44
|
-
|
45
|
-
def[]=( var, val )
|
46
|
-
@options[var] = val
|
47
|
-
end
|
48
|
-
|
49
38
|
# Configure the module
|
50
39
|
def reconfigure()
|
51
40
|
raise NotImplementedError
|
@@ -69,7 +58,7 @@ def execute( script )
|
|
69
58
|
build_directory,
|
70
59
|
{
|
71
60
|
'INSTALL_PREFIX' => install_prefix.to_s,
|
72
|
-
}.merge(Hash[
|
61
|
+
}.merge(Hash[option_hash]))
|
73
62
|
end
|
74
63
|
|
75
64
|
def install( fast )
|
@@ -86,7 +75,8 @@ def make( target = nil )
|
|
86
75
|
|
87
76
|
def option_string
|
88
77
|
arr = []
|
89
|
-
|
78
|
+
option_names.each do |var|
|
79
|
+
val = self[var]
|
90
80
|
arr << "-D#{var}='#{val}'"
|
91
81
|
end
|
92
82
|
arr.join(" ")
|
@@ -32,24 +32,6 @@ def name
|
|
32
32
|
### METHODS
|
33
33
|
#
|
34
34
|
|
35
|
-
def[]( var )
|
36
|
-
if @options.has_key? var
|
37
|
-
return @options[var]
|
38
|
-
end
|
39
|
-
|
40
|
-
# case var
|
41
|
-
|
42
|
-
# else
|
43
|
-
# *TODO* raise correct exception
|
44
|
-
raise NotImplementedError
|
45
|
-
|
46
|
-
# end
|
47
|
-
end
|
48
|
-
|
49
|
-
def[]=( var, val )
|
50
|
-
@options[var] = val
|
51
|
-
end
|
52
|
-
|
53
35
|
# Configure the module
|
54
36
|
def reconfigure()
|
55
37
|
0
|
@@ -34,25 +34,6 @@ def name
|
|
34
34
|
### METHODS
|
35
35
|
#
|
36
36
|
|
37
|
-
def[]( var )
|
38
|
-
if @options.has_key? var
|
39
|
-
return @options[var]
|
40
|
-
end
|
41
|
-
|
42
|
-
# case var
|
43
|
-
|
44
|
-
|
45
|
-
# else
|
46
|
-
# *TODO* raise correct exception
|
47
|
-
raise NotImplementedError
|
48
|
-
|
49
|
-
# end
|
50
|
-
end
|
51
|
-
|
52
|
-
def[]=( var, val )
|
53
|
-
@options[var] = val
|
54
|
-
end
|
55
|
-
|
56
37
|
# Configure the module
|
57
38
|
def reconfigure()
|
58
39
|
configure
|
@@ -97,7 +78,8 @@ def make( target = nil )
|
|
97
78
|
|
98
79
|
def option_string
|
99
80
|
arr = []
|
100
|
-
|
81
|
+
option_names.each do |var|
|
82
|
+
val = self[var]
|
101
83
|
arr << "#{var}='#{val}'"
|
102
84
|
end
|
103
85
|
arr.join(" ")
|
@@ -32,35 +32,6 @@ def name
|
|
32
32
|
### METHODS
|
33
33
|
#
|
34
34
|
|
35
|
-
def[]( var )
|
36
|
-
if @options.has_key? var
|
37
|
-
return @options[var]
|
38
|
-
end
|
39
|
-
|
40
|
-
case var
|
41
|
-
|
42
|
-
when 'flags'
|
43
|
-
return @options[var]
|
44
|
-
|
45
|
-
else
|
46
|
-
# *TODO* raise correct exception
|
47
|
-
raise NotImplementedError
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def[]=( var, val )
|
52
|
-
case var
|
53
|
-
|
54
|
-
when 'flags'
|
55
|
-
@options[var] = val
|
56
|
-
|
57
|
-
else
|
58
|
-
# *TODO* raise correct exception
|
59
|
-
raise NotImplementedError
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
35
|
# Execute a cmake command in the context of the build directory
|
65
36
|
def _configure( command, wd = build_directory )
|
66
37
|
rc = self.class.execute "#{source_directory}/configure #{command}", wd, env
|
@@ -80,7 +51,7 @@ def configure
|
|
80
51
|
check_build_directory( true )
|
81
52
|
opt = ""
|
82
53
|
opt += " -prefix #{install_prefix.to_s} " if install_prefix
|
83
|
-
opt +=
|
54
|
+
opt += self['flags']
|
84
55
|
rc = _configure opt
|
85
56
|
rc
|
86
57
|
end
|