def self.passenger_binary_compatibility_id
ruby_engine, ruby_ext_version, ruby_arch, os_name =
ruby_extension_binary_compatibility_ids
if os_name == "macosx"
os_version_string = `sw_vers -productVersion`.strip
components = os_version_string.split(".")
os_version = "#{components[0]}.#{components[1]}"
os_runtime = os_version
os_arch = cpu_architectures[0]
if os_version >= "10.5" && os_arch =~ /^i.86$/
os_arch = "x86_64"
end
else
os_arch = cpu_architectures[0]
cpp = find_command('cpp')
if cpp
macros = `#{cpp} -dM < /dev/null`
macros =~ /__VERSION__ "(.+)"/
compiler_version = $1
compiler_version.gsub!(/ .*/, '') if compiler_version
macros =~ /__GXX_ABI_VERSION (.+)$/
cxx_abi_version = $1
else
compiler_version = nil
cxx_abi_version = nil
end
if compiler_version && cxx_abi_version
os_runtime = "gcc#{compiler_version}-#{cxx_abi_version}"
else
os_runtime = [compiler_version, cxx_abi_version].compact.join("-")
if os_runtime.empty?
os_runtime = `uname -r`.strip
end
end
end
if ruby_engine == "jruby"
identifier = ""
else
identifier = "#{ruby_arch}-"
end
identifier << "#{ruby_engine}#{ruby_ext_version}-"
if ruby_arch != os_arch
identifier << "#{os_arch}-"
end
identifier << "#{os_name}-#{os_runtime}"
return identifier
end