Class: Xezat::Detector::Autoconf

Inherits:
Object
  • Object
show all
Defined in:
lib/xezat/detector/autoconf.rb

Instance Method Summary collapse

Instance Method Details

#detect?(variables) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/xezat/detector/autoconf.rb', line 8

def detect?(variables)
  return false unless variables.keys.index do |key|
    %i[_cmake_CYGCLASS_ _meson_CYGCLASS_ _ninja_CYGCLASS_].include?(key)
  end.nil?

  cygautoreconf = false
  File.foreach(File.join(variables[:top], variables[:cygportfile])) do |line|
    if line.index('cygautoreconf')
      cygautoreconf = true
      return true
    end
  end

  unless cygautoreconf
    File.foreach(File.join(variables[:top], variables[:cygportfile])) do |line|
      return false if line.index('src_compile')
    end
  end

  Find.find(variables[:S]) do |file|
    return true if file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
  end
  false
end