fix qmake bug

This commit is contained in:
John Bintz 2011-08-23 18:47:15 -04:00
parent 4fb82c2e7c
commit 01b1fcce16

View File

@ -3,7 +3,6 @@ require 'rubygems/version'
module Qt module Qt
class NotInstalledError < StandardError; end class NotInstalledError < StandardError; end
class Qmake class Qmake
class << self class << self
QMAKES = %w{qmake-qt4 qmake} QMAKES = %w{qmake-qt4 qmake}
@ -17,14 +16,13 @@ module Qt
end end
def command(project_file = nil) def command(project_file = nil)
spec = (case platform spec = (case platform
when :linux when :linux
"#{path} -spec linux-g++" "linux-g++"
when :freebsd when :freebsd
"#{path} -spec freebsd-g++" "freebsd-g++"
when :mac_os_x when :mac_os_x
"#{path} -spec macx-g++" "macx-g++"
end) end)
command = "#{path} -spec #{spec}" command = "#{path} -spec #{spec}"
@ -50,15 +48,15 @@ module Qt
end end
def make_path def make_path
get_exe_path('gmake') || get_exe_path('make') get_exe_path('gmake') || get_exe_path('make')
end end
def platform def platform
case RbConfig::CONFIG['host_os'] case RbConfig::CONFIG['host_os']
when /linux/ when /linux/
:linux :linux
when /freebsd/i when /freebsd/i
:freebsd :freebsd
when /darwin/ when /darwin/
:mac_os_x :mac_os_x
end end
@ -78,7 +76,7 @@ module Qt
end end
result result
end.compact.sort { |a, b| b.last <=> a.last }.first end.compact.sort { |a, b| b.last <=> a.last }.first
qmake_path.first qmake_path.first
else else
nil nil
end end
@ -99,15 +97,15 @@ module Qt
%{sudo apt-get install make or sudo yum install make} %{sudo apt-get install make or sudo yum install make}
when :freebsd when :freebsd
%{install /usr/ports/devel/gmake} %{install /usr/ports/devel/gmake}
when :darwin when :mac_os_x
%{Install XCode, and/or sudo port install make} %{Install XCode, and/or sudo port install make}
end end
) )
$stderr.puts <<-MSG $stderr.puts <<-MSG
make is not installed. You'll need to install it to build #{@name}. make is not installed. You'll need to install it to build #{@name}.
#{install_method} should do it for you. #{install_method} should do it for you.
MSG MSG
raise NotInstalledError raise NotInstalledError
end end
end end
@ -118,26 +116,26 @@ MSG
case platform case platform
when :linux when :linux
<<-MSG <<-MSG
sudo apt-get install libqt4-dev qt4-qmake on Debian-based systems, or downloading sudo apt-get install libqt4-dev qt4-qmake on Debian-based systems, or downloading
Nokia's prebuilt binary at http://qt.nokia.com/downloads/ Nokia's prebuilt binary at http://qt.nokia.com/downloads/
MSG MSG
when :freebsd when :freebsd
<<-MSG <<-MSG
Install /usr/ports/www/qt4-webkit and /usr/ports/devel/qmake4. Install /usr/ports/www/qt4-webkit and /usr/ports/devel/qmake4.
MSG MSG
when :darwin when :mac_os_x
<<-MSG <<-MSG
sudo port install qt4-mac (for the patient) or downloading Nokia's pre-built binary sudo port install qt4-mac (for the patient) or downloading Nokia's pre-built binary
at http://qt.nokia.com/downloads/ at http://qt.nokia.com/downloads/
MSG MSG
end end
).strip ).strip
$stderr.puts <<-MSG $stderr.puts <<-MSG
qmake is not installed or is not the right version (#{@name} needs Qt 4.7 or above). qmake is not installed or is not the right version (#{@name} needs Qt 4.7 or above).
You'll need to install it to build #{@name}. You'll need to install it to build #{@name}.
#{install_method} should do it for you. #{install_method} should do it for you.
MSG MSG
end end
end end
end end