Commit 9259e295 authored by Tony Arcieri's avatar Tony Arcieri

Merge pull request #8 from cryptosphere/windows-fixup

Support for loading libsodium.dll on Windows
parents 4e0e0373 c5f0d1c0
......@@ -23,10 +23,6 @@ Dir.chdir(LIBSODIUM_DIR) do
sys("sh -c \"./configure --prefix=#{LIBSODIUM_DIR}/dist\"")
sys(MAKE)
sys("#{MAKE} install")
if !Dir.glob('dist/bin/libsodium*.dll').empty?
# copy dll to make it loadable on Windows
sys("cp dist/bin/libsodium*.dll dist/lib/libsodium.so")
end
end
File.open("Makefile", "w") do |f|
......
......@@ -2,8 +2,14 @@ require "rbnacl/libsodium/version"
module RbNaCl
module Libsodium
sodiumlib_dir = File.expand_path(File.join(File.dirname(__FILE__), "../../vendor/libsodium/dist/lib/"))
sodiumlib_filename = RUBY_DESCRIPTION =~ /darwin/ ? "libsodium.dylib" : "libsodium.so"
sodiumlib_dir = File.expand_path("../../../vendor/libsodium/dist/lib/", __FILE__)
sodiumlib_filename = case RUBY_DESCRIPTION
when /darwin/ then "libsodium.dylib"
when /Windows|(win|mingw)32/ then "libsodium.dll"
else "libsodium.so"
end
::RBNACL_LIBSODIUM_GEM_LIB_PATH = File.join(sodiumlib_dir, sodiumlib_filename)
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment