Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

varnam: Detect the architecture at runtime #28

Merged
merged 1 commit into from
Dec 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion varnam.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ def gem_available?(name)
false
end

require 'rbconfig'

if not gem_available?('ffi')
puts "Can't find gem - ffi. To install run '[sudo] gem install ffi'"
exit(1)
Expand All @@ -17,7 +19,12 @@ def find_govarnam

# Trying to find out govarnam in the predefined locations if
# absolute path to the library is not specified
govarnam_search_paths = ['.', File.dirname(File.expand_path(__FILE__)), '/usr/local/lib', '/usr/local/lib/i386-linux-gnu', '/usr/local/lib/x86_64-linux-gnu', '/usr/lib/i386-linux-gnu', '/usr/lib/x86_64-linux-gnu', '/usr/lib']
arch = RbConfig::CONFIG['arch']
govarnam_search_paths = ['.', File.dirname(File.expand_path(__FILE__)),
'/usr/local/lib',
"/usr/local/lib/#{arch}",
"/usr/lib/#{arch}",
'/usr/lib']
govarnam_names = ['libgovarnam.so', "libgovarnam.so.#{$govarnam_major_version}", 'libgovarnam.dylib', 'varnam.dll']
govarnam_search_paths.each do |path|
govarnam_names.each do |fname|
Expand Down