Skip to content

Commit

Permalink
Patch RbNaCl to find system libsodium
Browse files Browse the repository at this point in the history
The patch is taken from this PR
RubyCrypto/rbnacl#186.
  • Loading branch information
adamruzicka committed Jul 27, 2021
1 parent b2cc92c commit 7079b58
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
From 38c1bcd2fe7a3735c52fdd9dd9127814cbcc44e6 Mon Sep 17 00:00:00 2001
From: Andrew Kane <[email protected]>
Date: Sat, 1 Dec 2018 15:03:36 -0800
Subject: [PATCH] Added support for Heroku

---
lib/rbnacl/init.rb | 2 +-
lib/rbnacl/sodium.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/rbnacl/init.rb b/lib/rbnacl/init.rb
index cd0168b..a3cc12b 100644
--- a/lib/rbnacl/init.rb
+++ b/lib/rbnacl/init.rb
@@ -5,7 +5,7 @@ module RbNaCl
# Defines the libsodium init function
module Init
extend FFI::Library
- ffi_lib "sodium"
+ ffi_lib ["sodium", "libsodium.so.18", "libsodium.so.23"]

attach_function :sodium_init, [], :int
end
diff --git a/lib/rbnacl/sodium.rb b/lib/rbnacl/sodium.rb
index c72b000..f12ac45 100644
--- a/lib/rbnacl/sodium.rb
+++ b/lib/rbnacl/sodium.rb
@@ -8,7 +8,7 @@ module RbNaCl
module Sodium
def self.extended(klass)
klass.extend FFI::Library
- klass.ffi_lib "sodium"
+ klass.ffi_lib ["sodium", "libsodium.so.18", "libsodium.so.23"]
end

def sodium_type(type = nil)
7 changes: 6 additions & 1 deletion packages/plugins/rubygem-rbnacl/rubygem-rbnacl.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@

Name: %{?scl_prefix}rubygem-%{gem_name}
Version: 4.0.2
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Ruby binding to the Networking and Cryptography (NaCl) library
Group: Development/Languages
License: MIT
URL: https://github.com/cryptosphere/rbnacl
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
Patch0: 0001-Added-support-for-Heroku.patch

# start specfile generated dependencies
Requires: %{?scl_prefix_ruby}ruby(release)
Expand Down Expand Up @@ -46,6 +47,7 @@ gem unpack %{SOURCE0}
%{?scl:EOF}
%setup -q -D -T -n %{gem_name}-%{version}
%patch0 -p1
%{?scl:scl enable %{scl} - << \EOF}
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
Expand Down Expand Up @@ -95,5 +97,8 @@ cp -a .%{gem_dir}/* \
%{gem_instdir}/spec
%changelog
* Tue Jul 27 2021 Adam Ruzicka <[email protected]> 4.0.2-2
- Add patch to find system libsodium
* Tue Jul 20 2021 Adam Ruzicka <[email protected]> 4.0.2-1
- Add rubygem-rbnacl generated by gem2rpm using the scl template

0 comments on commit 7079b58

Please sign in to comment.