Commit 1862cf03 authored by Artiom Di's avatar Artiom Di

JRuby support

parent b3e3978b
require 'mkmf'
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
$CFLAGS << " #{ENV["CFLAGS"]}"
def sys(cmd)
puts " -- #{cmd}"
unless ret = xsystem(cmd)
unless ret = system(cmd)
raise "ERROR: '#{cmd}' failed"
end
ret
end
if !(MAKE = find_executable('gmake') || find_executable('make'))
abort "ERROR: GNU make is required to build libsodium."
end
mkfl = <<MAKEFILE
install:
\t@echo "Nothing to do"
clean:
\t@echo "Nothing to do"
MAKEFILE
CWD = File.expand_path(File.dirname(__FILE__))
LIBSODIUM_DIR = File.expand_path(File.join(CWD, '..', '..', 'vendor', 'libsodium'))
MAKE = ENV['MAKE'] || ENV['make'] || "make"
Dir.chdir(LIBSODIUM_DIR) do
sys("./autogen.sh")
......@@ -26,11 +25,6 @@ Dir.chdir(LIBSODIUM_DIR) do
sys("#{MAKE} install")
end
$DEFLIBPATH.unshift("#{LIBSODIUM_DIR}/dist")
dir_config('sodium', "#{LIBSODIUM_DIR}/dist/include", "#{LIBSODIUM_DIR}/dist/lib")
unless have_library 'sodium'
abort "ERROR: Failed to build libsodium"
File.open("Makefile", "w") do |f|
f.write(mkfl)
end
create_makefile("rbnacl-libsodium/rbnacl-libsodium")
......@@ -3,7 +3,7 @@ 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_PLATFORM =~ /darwin/ ? "libsodium.dylib" : "libsodium.so"
sodiumlib_filename = RUBY_DESCRIPTION =~ /darwin/ ? "libsodium.dylib" : "libsodium.so"
::RBNACL_LIBSODIUM_GEM_LIB_PATH = File.join(sodiumlib_dir, sodiumlib_filename)
end
end
......
module RbNaCl
module Libsodium
VERSION = "0.0.1"
VERSION = "0.0.2"
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