31 lines
526 B
Ruby
31 lines
526 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "requirement"
|
|
|
|
# A requirement on a specific architecture.
|
|
#
|
|
# @api private
|
|
class ArchRequirement < Requirement
|
|
fatal true
|
|
|
|
def initialize(tags)
|
|
@arch = tags.shift
|
|
super(tags)
|
|
end
|
|
|
|
satisfy(build_env: false) do
|
|
case @arch
|
|
when :x86_64 then Hardware::CPU.is_64_bit?
|
|
when :intel, :ppc then Hardware::CPU.type == @arch
|
|
end
|
|
end
|
|
|
|
def message
|
|
"This formula requires an #{@arch} architecture."
|
|
end
|
|
|
|
def display_s
|
|
"#{@arch} architecture"
|
|
end
|
|
end
|