From 5b72a6b5787a360e36d137fe2d52f47be926a588 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sun, 19 Mar 2017 14:33:07 +0100 Subject: Added build script Additional locations are searched for configuration --- mach | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 mach (limited to 'mach') diff --git a/mach b/mach new file mode 100755 index 0000000..c99c47a --- /dev/null +++ b/mach @@ -0,0 +1,51 @@ +#!/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' +} + +OptionParser.new do |opts| + opts.banner = "Usage: ./mach [options]" + + opts.on("-h", "--help", "Prints this help") do + puts opts + puts "Options: #{options}" + puts 'Commands: build, install' + 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 'build' + system "qbs build -d #{options[:buildDir]} profile:#{options[:profile]} release" + when 'install' + system "sudo qbs install -d #{options[:buildDir]} --install-root #{options[:installDir]} --settings-dir #{options[:settings]} profile:#{options[:profile]} release" + else + puts "Unknown argument #{a}; use ./mach -h for more details" + end + end + +else + puts 'No arguments; use ./mach -h for more details' +end -- cgit v1.2.1