1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#!/usr/bin/env ruby
# DISCLAIMER: this is not Mozilla's mach
require 'optparse'
options = {
:settings => "#{ENV['HOME']}/.config/QtProject/qbs/1.7.1",
:profile => 'qt5',
:buildDir => '../build',
:installDir => '/usr/local',
:email => 'xian.nox@gmail.com'
}
OptionParser.new do |opts|
opts.banner = "Usage: ./mach [options]"
opts.on("-h", "--help", "Prints this help") do
puts opts
puts "Options: #{options}"
puts 'Commands: run, clean, build, install, tarball'
exit
end
opts.on("--profile", "Set profile") do |profile|
options[:profile] = profile
end
opts.on("-d", "--build DIRECTORY", "Build location") do |dir|
options[:buildDir] = dir
end
opts.on("-i", "--install DIRECTORY", "Install location") do |dir|
options[:installDir] = dir
end
end.parse!
if not ARGV.empty? then
ARGV.each do|arg|
case arg
when 'run'
system "qbs run -d #{options[:buildDir]} -p poi profile:#{options[:profile]} release"
when 'clean'
system "qbs clean -d #{options[:buildDir]} profile:#{options[:profile]} release"
when 'build'
system "qbs build -d #{options[:buildDir]} --force-probe-execution profile:#{options[:profile]} release"
when 'install'
system "sudo qbs install -d #{options[:buildDir]} --no-build --install-root #{options[:installDir]} --settings-dir #{options[:settings]} profile:#{options[:profile]} release"
when 'tarball'
filename = "smolbote-#{`git describe --tags`}.tar.lz".gsub("\n", '')
system "tar -I\"lzip -9\" -cf #{filename} --directory=#{options[:buildDir]}/release/install-root . --owner=user:1000 --group=users:1000"
system "gpg -u #{options[:email]} -b #{filename}"
system "gpg -u #{options[:email]} -b --armor #{filename}"
system "sha512sum --binary #{filename}* > #{filename}.sha512"
else
puts "Unknown argument #{a}; use ./mach -h for more details"
end
end
else
puts 'No arguments; use ./mach -h for more details'
end
|