aboutsummaryrefslogtreecommitdiff
path: root/mach
diff options
context:
space:
mode:
Diffstat (limited to 'mach')
-rwxr-xr-xmach33
1 files changed, 18 insertions, 15 deletions
diff --git a/mach b/mach
index 17cef25..2fce8e9 100755
--- a/mach
+++ b/mach
@@ -4,11 +4,10 @@
require 'optparse'
options = {
- :settings => "#{ENV['HOME']}/.config/QtProject/qbs/1.7.1",
+ :settingsDir => "../build/config",
:profile => 'qt5',
+ :build => 'release',
:buildDir => '../build',
- :installDir => '/usr/local',
- :email => 'xian.nox@gmail.com'
}
OptionParser.new do |opts|
@@ -17,7 +16,7 @@ OptionParser.new do |opts|
opts.on("-h", "--help", "Prints this help") do
puts opts
puts "Options: #{options}"
- puts 'Commands: run, clean, build, install, tarball'
+ puts 'Commands: setup, run, clean, build'
exit
end
@@ -33,25 +32,28 @@ OptionParser.new do |opts|
options[:installDir] = dir
end
+ opts.on("--debug", "Debug build") do
+ options[:build] = 'debug'
+ end
+
+ opts.on("--release", "Release build") do
+ options[:build] = 'release'
+ end
+
end.parse!
if not ARGV.empty? then
ARGV.each do|arg|
case arg
+ when 'setup'
+ system "qbs-setup-toolchains --settings-dir #{options[:settingsDir]} --detect"
+ system "qbs-setup-qt --settings-dir #{options[:settingsDir]} /usr/bin/qmake-qt5 #{options[:profile]}"
when 'run'
- system "qbs run -d #{options[:buildDir]} -p poi profile:#{options[:profile]} release"
+ system "qbs run --settings-dir #{options[:settingsDir]} -d #{options[:buildDir]} -p poi profile:#{options[:profile]} #{options[:build]}"
when 'clean'
- system "qbs clean -d #{options[:buildDir]} profile:#{options[:profile]} release"
+ system "qbs clean --settings-dir #{options[:settingsDir]} -d #{options[:buildDir]} profile:#{options[:profile]} #{options[:build]}"
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"
+ system "qbs build --settings-dir #{options[:settingsDir]} -d #{options[:buildDir]} --force-probe-execution profile:#{options[:profile]} #{options[:build]}"
else
puts "Unknown argument #{arg}; use ./mach -h for more details"
end
@@ -60,3 +62,4 @@ if not ARGV.empty? then
else
puts 'No arguments; use ./mach -h for more details'
end
+