DRY out the X11 detection code

This commit is contained in:
Max Howell 2009-12-05 18:27:12 +00:00
parent 4c1c677fee
commit 4731d17805

View file

@ -16,10 +16,14 @@ class Qt <Formula
['--with-qt3support', "Enable deprecated Qt3Support module."], ['--with-qt3support', "Enable deprecated Qt3Support module."],
] ]
end end
def self.x11?
File.exist? "/usr/X11R6/lib"
end
depends_on "dbus" if ARGV.include? '--with-dbus' depends_on "dbus" if ARGV.include? '--with-dbus'
depends_on "dbus" if ARGV.include? '--with-qt3support' depends_on "dbus" if ARGV.include? '--with-qt3support'
depends_on 'libpng' unless File.exist? "/usr/X11R6/lib" depends_on 'libpng' unless x11?
def install def install
if version == '4.5.3' if version == '4.5.3'
@ -48,7 +52,7 @@ class Qt <Formula
conf_args << "-no-qt3support" conf_args << "-no-qt3support"
end end
if File.exist? "/usr/X11R6/lib" if x11?
conf_args << "-L/usr/X11R6/lib" conf_args << "-L/usr/X11R6/lib"
conf_args << "-I/usr/X11R6/include" conf_args << "-I/usr/X11R6/include"
else else