Allow overriding libicu on MacOS with FFI_ICU_LIB

This commit is contained in:
KJ Tsanaktsidis 2022-04-01 16:03:08 +11:00
parent a3d2a14dcf
commit e8b6b6bfdf
No known key found for this signature in database
GPG Key ID: 27CD40EB9B81C726
1 changed files with 6 additions and 2 deletions

View File

@ -37,8 +37,12 @@ module ICU
[find_lib("libicui18n.#{FFI::Platform::LIBSUFFIX}.??"),
find_lib("libicutu.#{FFI::Platform::LIBSUFFIX}.??")]
when :osx
if ENV.key?('FFI_ICU_LIB')
# Ensure we look in the user-supplied override dir for a user-compiled libicu
[find_lib("libicui18n.??.#{FFI::Platform::LIBSUFFIX}"),
find_lib("libicutu.??.#{FFI::Platform::LIBSUFFIX}")]
elsif Gem::Version.new(`sw_vers -productVersion`) >= Gem::Version.new('11')
# See https://developer.apple.com/documentation/macos-release-notes/macos-big-sur-11_0_1-release-notes (62986286)
if Gem::Version.new(`sw_vers -productVersion`) >= Gem::Version.new('11')
["libicucore.#{FFI::Platform::LIBSUFFIX}"]
else
[find_lib("libicucore.#{FFI::Platform::LIBSUFFIX}")]