From eca1376ca88d9a1c5c1039bc40c728cf7b188ecd Mon Sep 17 00:00:00 2001 From: Mathieu Arnold Date: Mon, 25 Jul 2011 15:43:05 +0200 Subject: [PATCH] Make it compile on FreeBSD. --- lib/capybara_webkit_builder.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/capybara_webkit_builder.rb b/lib/capybara_webkit_builder.rb index e06a809..853cb68 100644 --- a/lib/capybara_webkit_builder.rb +++ b/lib/capybara_webkit_builder.rb @@ -3,23 +3,30 @@ require "fileutils" module CapybaraWebkitBuilder extend self + def make_bin + make_binaries = ['gmake', 'make'] + make_binaries.detect { |make| system("which #{make}") } + end + def makefile qmake_binaries = ['qmake', 'qmake-qt4'] qmake = qmake_binaries.detect { |qmake| system("which #{qmake}") } case RUBY_PLATFORM when /linux/ system("#{qmake} -spec linux-g++") + when /freebsd/ + system("#{qmake} -spec freebsd-g++") else system("#{qmake} -spec macx-g++") end end def qmake - system("make qmake") + system("#{make_bin} qmake") end def build - system("make") or return false + system(make_bin) or return false FileUtils.mkdir("bin") unless File.directory?("bin") FileUtils.cp("src/webkit_server", "bin", :preserve => true)