summaryrefslogtreecommitdiffstats
path: root/Rakefile
diff options
context:
space:
mode:
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile14
1 files changed, 14 insertions, 0 deletions
diff --git a/Rakefile b/Rakefile
index f6ad2c5..fa66d3b 100644
--- a/Rakefile
+++ b/Rakefile
@@ -59,6 +59,16 @@ def enough_free_memory?
end
end
+def system_cpus
+ return nil unless RbConfig::CONFIG['host_os'] =~ /linux/i
+
+ begin
+ File.read('/proc/cpuinfo').scan(/^processor\s+:/).count
+ rescue
+ nil
+ end
+end
+
task :parse_build_options do
options = ''
@@ -68,6 +78,10 @@ task :parse_build_options do
# Use in-VM proxy unless an external proxy is set
options += 'vmproxy ' unless EXTERNAL_HTTP_PROXY
+ # Default to the number of system CPUs when we can figure it out
+ cpus = system_cpus
+ options += "cpus=#{cpus} " if cpus
+
options += ENV['TAILS_BUILD_OPTIONS'] if ENV['TAILS_BUILD_OPTIONS']
options.split(' ').each do |opt|
case opt