Commit b3e3978b authored by Tony Arcieri's avatar Tony Arcieri

Merge pull request #1 from kron4eg/initial

Initial Import
parents 77060137 5dcd32ad
...@@ -26,9 +26,10 @@ build/ ...@@ -26,9 +26,10 @@ build/
# for a library or gem, you might want to ignore these files since the code is # for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in: # intended to run in multiple environments; otherwise, check them in:
# Gemfile.lock Gemfile.lock
# .ruby-version # .ruby-version
# .ruby-gemset # .ruby-gemset
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc .rvmrc
/vendor/gems
[submodule "vendor/libsodium"]
path = vendor/libsodium
url = git://github.com/jedisct1/libsodium.git
source 'https://rubygems.org'
gem "rbnacl", github: 'cryptosphere/rbnacl'
# Specify your gem's dependencies in rbnacl-libsodium.gemspec
gemspec
rbnacl-libsodium # RbNaCl::Libsodium
================
RbNaCl + libsodium packaged as a gem RbNaCl + libsodium packaged as a gem
## Installation
Add this line to your application's Gemfile:
gem 'rbnacl-libsodium'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rbnacl-libsodium
## Usage
require 'rbnacl/libsodium'
will tweak search path allowing `rbnacl` to find bundled `libsodium`
require "bundler/gem_tasks"
require 'mkmf'
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
$CFLAGS << " #{ENV["CFLAGS"]}"
def sys(cmd)
puts " -- #{cmd}"
unless ret = xsystem(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
CWD = File.expand_path(File.dirname(__FILE__))
LIBSODIUM_DIR = File.expand_path(File.join(CWD, '..', '..', 'vendor', 'libsodium'))
Dir.chdir(LIBSODIUM_DIR) do
sys("./autogen.sh")
sys("./configure --prefix=#{LIBSODIUM_DIR}/dist")
sys(MAKE)
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"
end
create_makefile("rbnacl-libsodium/rbnacl-libsodium")
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"
::RBNACL_LIBSODIUM_GEM_LIB_PATH = File.join(sodiumlib_dir, sodiumlib_filename)
end
end
require "rbnacl"
module RbNaCl
module Libsodium
VERSION = "0.0.1"
end
end
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'rbnacl/libsodium/version'
Gem::Specification.new do |spec|
spec.name = "rbnacl-libsodium"
spec.version = RbNaCl::Libsodium::VERSION
spec.authors = ["Artiom Di"]
spec.date = Time.now.strftime('%Y-%m-%d')
spec.email = ["kron82@gmail.com"]
spec.summary = %q{rbnacl with bundled libsodium}
spec.homepage = "https://github.com/cryptosphere/rbnacl-libsodium"
spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0")
spec.files += Dir.glob("vendor/libsodium/**/*")
spec.require_paths = ["lib"]
spec.extensions = ['ext/rbnacl/extconf.rb']
spec.add_runtime_dependency "rbnacl", "~> 3.0", ">= 3.0.1"
spec.add_development_dependency "bundler", "~> 1.5"
spec.add_development_dependency "rake"
end
Subproject commit 5f8800bfa076e6d9556bd5a4e4bdb2a7047876d2
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