Skip to content

Commit f20d164

Browse files
committed
Added arch check for binary installations on Linux - #54
1 parent 65039f7 commit f20d164

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

ext/or-tools/vendor.rb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66

77
version = "9.8.3296"
88

9+
arch = RbConfig::CONFIG["host_cpu"]
10+
arm = arch =~ /arm|aarch64/i
11+
912
if RbConfig::CONFIG["host_os"] =~ /darwin/i
10-
if RbConfig::CONFIG["host_cpu"] =~ /arm|aarch64/i
13+
if arm
1114
filename = "or-tools_arm64_macOS-14.1_cpp_v#{version}.tar.gz"
1215
checksum = "253efad127c55b78967e3e3a3b4a573f9da0a2562c4f33f14fbf462ca58448f7"
1316
else
@@ -25,24 +28,24 @@
2528
os = os_info["ID"]
2629
os_version = os_info["VERSION_ID"]
2730

28-
if os == "ubuntu" && os_version == "22.04"
31+
if os == "ubuntu" && os_version == "22.04" && x86_64
2932
filename = "or-tools_amd64_ubuntu-22.04_cpp_v#{version}.tar.gz"
3033
checksum = "2a332e95897ac6fc2cfd0122bcbc07cfd286d0f579111529cc99ac3076f5421a"
31-
elsif os == "ubuntu" && os_version == "20.04"
34+
elsif os == "ubuntu" && os_version == "20.04" && !arm
3235
filename = "or-tools_amd64_ubuntu-20.04_cpp_v#{version}.tar.gz"
3336
checksum = "95789f8d93dfb298efecd1c0b888f9a148c011e1a20505b00c38452d68b01644"
34-
elsif os == "debian" && os_version == "11"
37+
elsif os == "debian" && os_version == "11" && !arm
3538
filename = "or-tools_amd64_debian-11_cpp_v#{version}.tar.gz"
3639
checksum = "e7dd81b13c53c739447254b8836ece55f8b92a107688cc9f3511705c9962fa2d"
37-
elsif os == "centos" && os_version == "7"
40+
elsif os == "centos" && os_version == "7" && !arm
3841
filename = "or-tools_amd64_centos-7_cpp_v#{version}.tar.gz"
3942
checksum = "d9f193572d3a38b3062ae4cb89afc654e662eb734a9361b1575d649b9530cf60"
4043
else
4144
platform =
4245
if Gem.win_platform?
4346
"Windows"
4447
elsif os || os_version
45-
"#{os} #{os_version}"
48+
"#{os} #{os_version} (#{arch})"
4649
else
4750
"Unknown"
4851
end

0 commit comments

Comments
 (0)