autobuild 1.5.43 → 1.5.45

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.
@@ -1,3 +1,18 @@
1
+ == Version 1.5.45
2
+ * fix zip support in the archive importer (patch from Thomas Roehr)
3
+
4
+ == Version 1.5.44
5
+ * when autodetecting the parallel build level, use the number of physical cores
6
+ (ignore "logical processors" that are present due to SMT technologies like
7
+ HyperThreading)
8
+ * add an experimental feature to make autobuild run doxygen by itself instead of
9
+ using "make doc" for CMake targets. This will sped up documentation
10
+ generation in simple cases, as dependencies won't need to be installed before
11
+ "make doc" can be run. This feature is turned OFF by default, and can be
12
+ turned ON by doing
13
+
14
+ Autobuild::CMake.always_use_doc_target = false
15
+
1
16
  == Version 1.5.43
2
17
  * cvs: accept the common importer options, such as :patches
3
18
  (Patch from Charles Lesire-Cabaniols)
@@ -101,9 +101,6 @@ module Autobuild
101
101
  end
102
102
  end
103
103
  task "#{name}-build" => buildstamp
104
- if has_doc?
105
- task "#{name}-doc" => configurestamp
106
- end
107
104
  file installstamp => buildstamp
108
105
  end
109
106
 
@@ -151,7 +151,9 @@ module Autobuild
151
151
  else base_dir
152
152
  end
153
153
 
154
- cmd = [ 'unzip', '-o', '-f', cachefile, '-d', main_dir ]
154
+ cmd = [ '-o', cachefile, '-d', main_dir ]
155
+ Subprocess.run(package, :import, Autobuild.tool('unzip'), *cmd)
156
+
155
157
  if archive_dir
156
158
  FileUtils.rm_rf File.join(package.srcdir)
157
159
  FileUtils.mv File.join(base_dir, archive_dir), package.srcdir
@@ -361,6 +361,8 @@ module Autobuild
361
361
  install_doc
362
362
  end
363
363
 
364
+ rescue Interrupt
365
+ raise
364
366
  rescue ::Exception => e
365
367
  if Autobuild.doc_errors
366
368
  raise
@@ -38,6 +38,7 @@ module Autobuild
38
38
 
39
39
  # Declare that the given target can be used to generate documentation
40
40
  def with_doc(target = 'doc')
41
+ task "#{name}-doc" => configurestamp
41
42
  doc_task do
42
43
  Dir.chdir(builddir) do
43
44
  progress "generating documentation for %s"
@@ -65,12 +65,131 @@ module Autobuild
65
65
  end
66
66
  end
67
67
 
68
+ DOXYGEN_ACCEPTED_VARIABLES = {
69
+ '@CMAKE_SOURCE_DIR@' => lambda { |pkg| pkg.srcdir },
70
+ '@PROJECT_SOURCE_DIR@' => lambda { |pkg| pkg.srcdir },
71
+ '@CMAKE_BINARY_DIR@' => lambda { |pkg| pkg.builddir },
72
+ '@PROJECT_BINARY_DIR@' => lambda { |pkg| pkg.builddir },
73
+ '@PROJECT_NAME@' => lambda { |pkg| pkg.name }
74
+ }
75
+
76
+ class << self
77
+ # Flag controlling whether autobuild should run doxygen itself or
78
+ # use the "doc" target generated by CMake
79
+ #
80
+ # This is experimental and OFF by default. See CMake#run_doxygen for
81
+ # more details
82
+ #
83
+ # See also CMake#always_use_doc_target= and CMake#always_use_doc_target?
84
+ # for a per-package control of that feature
85
+ attr_writer :always_use_doc_target
86
+
87
+ # Flag controlling whether autobuild should run doxygen itself or
88
+ # use the "doc" target generated by CMake
89
+ #
90
+ # This is experimental and OFF by default. See CMake#run_doxygen for
91
+ # more details
92
+ #
93
+ # See also CMake#always_use_doc_target= and CMake#always_use_doc_target?
94
+ # for a per-package control of that feature
95
+ def always_use_doc_target?
96
+ @always_use_doc_target
97
+ end
98
+ end
99
+ @always_use_doc_target = true
100
+
101
+ # Flag controlling whether autobuild should run doxygen itself or
102
+ # use the "doc" target generated by CMake
103
+ #
104
+ # This is experimental and OFF by default. See CMake#run_doxygen for
105
+ # more details
106
+ #
107
+ # See also CMake.always_use_doc_target= and CMake.always_use_doc_target?
108
+ # for a global control of that feature
109
+ attr_reader :always_use_doc_target
110
+
111
+ # Flag controlling whether autobuild should run doxygen itself or
112
+ # use the "doc" target generated by CMake
113
+ #
114
+ # This is experimental and OFF by default. See CMake#run_doxygen for
115
+ # more details
116
+ #
117
+ # See also CMake.always_use_doc_target= and CMake.always_use_doc_target?
118
+ # for a global control of that feature
119
+ def always_use_doc_target?
120
+ if @always_use_doc_target.nil?
121
+ return CMake.always_use_doc_target?
122
+ else
123
+ @always_use_doc_target
124
+ end
125
+ end
126
+
127
+ # To avoid having to build packages to run the documentation target, we
128
+ # try to autodetect whether (1) the package is using doxygen and (2)
129
+ # whether the cmake variables in the doxyfile can be provided by
130
+ # autobuild itself.
131
+ #
132
+ # This can be disabled globally by setting
133
+ # Autobuild::CMake.always_use_doc_target= or on a per-package basis with
134
+ # #always_use_doc_target=
135
+ #
136
+ # This method returns true if the package can use the internal doxygen
137
+ # mode and false otherwise
138
+ def internal_doxygen_mode?
139
+ if always_use_doc_target?
140
+ return false
141
+ end
142
+
143
+ doxyfile_in = File.join(srcdir, "Doxyfile.in")
144
+ if !File.file?(doxyfile_in)
145
+ puts "NO INTERNAL: #{name}"
146
+ return false
147
+ end
148
+ File.readlines(doxyfile_in).each do |line|
149
+ matches = line.scan(/@[^@]+@/)
150
+ if matches.any? { |str| !DOXYGEN_ACCEPTED_VARIABLES.has_key?(str) }
151
+ return false
152
+ end
153
+ end
154
+ end
155
+
156
+ # To avoid having to build packages to run the documentation target, we
157
+ # try to autodetect whether (1) the package is using doxygen and (2)
158
+ # whether the cmake variables in the doxyfile can be provided by
159
+ # autobuild itself.
160
+ #
161
+ # This can be disabled globally by setting
162
+ # Autobuild::CMake.always_use_doc_target or on a per-package basis with
163
+ # #always_use_doc_target
164
+ #
165
+ # This method generates the corresponding doxygen file in
166
+ # <builddir>/Doxygen and runs doxygen. It raises if the internal doxygen
167
+ # support cannot be used on this package
168
+ def run_doxygen
169
+ doxyfile_in = File.join(srcdir, "Doxyfile.in")
170
+ if !File.file?(doxyfile_in)
171
+ raise RuntimeError, "no Doxyfile.in in this package, cannot use the internal doxygen support"
172
+ end
173
+ doxyfile_data = File.readlines(doxyfile_in).map do |line|
174
+ line.gsub(/@[^@]+@/) { |match| DOXYGEN_ACCEPTED_VARIABLES[match].call(self) }
175
+ end
176
+ doxyfile = File.join(builddir, "Doxyfile")
177
+ File.open(doxyfile, 'w') do |io|
178
+ io.write(doxyfile_data)
179
+ end
180
+ Subprocess.run(self, 'doc', Autobuild.tool(:doxygen), doxyfile)
181
+ end
182
+
68
183
  # Declare that the given target can be used to generate documentation
69
184
  def with_doc(target = 'doc')
70
185
  doc_task do
71
186
  Dir.chdir(builddir) do
72
187
  progress "generating documentation for %s"
73
- Subprocess.run(self, 'doc', Autobuild.tool(:make), "-j#{parallel_build_level}", target)
188
+ if internal_doxygen_mode?
189
+ run_doxygen
190
+ else
191
+ Subprocess.run(self, 'doc', Autobuild.tool(:make), "-j#{parallel_build_level}", target)
192
+ end
74
193
  yield if block_given?
75
194
  end
76
195
  end
@@ -106,6 +225,10 @@ module Autobuild
106
225
  end
107
226
 
108
227
  def prepare
228
+ if !internal_doxygen_mode? && has_doc?
229
+ task "#{name}-doc" => configurestamp
230
+ end
231
+
109
232
  # A failed initial CMake configuration leaves a CMakeCache.txt file,
110
233
  # but no Makefile.
111
234
  #
@@ -71,16 +71,32 @@ module Autobuild
71
71
  return @processor_count
72
72
  end
73
73
 
74
- if File.file?('/sys/devices/system/cpu/present')
75
- range = File.read('/sys/devices/system/cpu/present').
76
- chomp
77
-
78
- @processor_count = Integer(range.split('-').last) + 1
79
- elsif File.file?('/proc/cpuinfo')
80
- # Just count the numer of processor: \d lines
81
- @processor_count = File.readlines('/proc/cpuinfo').
82
- find_all { |l| l =~ /^processor\s+:\s+\d+$/ }.
83
- count
74
+ if File.file?('/proc/cpuinfo')
75
+ cpuinfo = File.readlines('/proc/cpuinfo')
76
+ physical_ids, core_count, processor_ids = [], [], []
77
+ cpuinfo.each do |line|
78
+ case line
79
+ when /^processor\s+:\s+(\d+)$/
80
+ processor_ids << Integer($1)
81
+ when /^physical id\s+:\s+(\d+)$/
82
+ physical_ids << Integer($1)
83
+ when /^cpu cores\s+:\s+(\d+)$/
84
+ core_count << Integer($1)
85
+ end
86
+ end
87
+
88
+ # Try to count the number of physical cores, not the number of
89
+ # logical ones. If the info is not available, fallback to the
90
+ # logical count
91
+ if (physical_ids.size == core_count.size) && (physical_ids.size == processor_ids.size)
92
+ info = Array.new
93
+ while (id = physical_ids.shift)
94
+ info[id] = core_count.shift
95
+ end
96
+ @processor_count = info.inject(&:+)
97
+ else
98
+ @processor_count = processor_ids.size
99
+ end
84
100
  else
85
101
  # Hug... What kind of system is it ?
86
102
  STDERR.puts "INFO: cannot autodetect the number of CPUs on this sytem"
@@ -1,5 +1,5 @@
1
1
  module Autobuild
2
- VERSION = "1.5.43" unless defined? Autobuild::VERSION
2
+ VERSION = "1.5.45" unless defined? Autobuild::VERSION
3
3
  end
4
4
 
5
5
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autobuild
3
3
  version: !ruby/object:Gem::Version
4
- hash: 85
4
+ hash: 89
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 5
9
- - 43
10
- version: 1.5.43
9
+ - 45
10
+ version: 1.5.45
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sylvain Joyeux
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-05 00:00:00 Z
18
+ date: 2011-08-12 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rake