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 d4ebaec
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
From c788aea2c6dcf6c24cd5e9af2d2ce3ee42714bcd 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

(cherry picked from commit 38c1bcd2fe7a3735c52fdd9dd9127814cbcc44e6)
---
lib/rbnacl/init.rb | 2 +-
lib/rbnacl/sodium.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git lib/rbnacl/init.rb lib/rbnacl/init.rb
index baa0f4d..9c07f49 100644
--- lib/rbnacl/init.rb
+++ lib/rbnacl/init.rb
@@ -8,7 +8,7 @@ module RbNaCl
if defined?(RBNACL_LIBSODIUM_GEM_LIB_PATH)
ffi_lib RBNACL_LIBSODIUM_GEM_LIB_PATH
else
- ffi_lib "sodium"
+ ffi_lib ["sodium", "libsodium.so.18", "libsodium.so.23"]
end

attach_function :sodium_init, [], :int
diff --git lib/rbnacl/sodium.rb lib/rbnacl/sodium.rb
index bafbda6..4b7988c 100644
--- lib/rbnacl/sodium.rb
+++ lib/rbnacl/sodium.rb
@@ -11,7 +11,7 @@ module RbNaCl
if defined?(RBNACL_LIBSODIUM_GEM_LIB_PATH)
klass.ffi_lib RBNACL_LIBSODIUM_GEM_LIB_PATH
else
- klass.ffi_lib "sodium"
+ klass.ffi_lib ["sodium", "libsodium.so.18", "libsodium.so.23"]
end
end

--
2.31.1

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 -p0
%{?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 d4ebaec

Please sign in to comment.