Created
May 18, 2015 16:03
-
-
Save aharpervc/e2675cc13ef000d8c791 to your computer and use it in GitHub Desktop.
patch for ruby 2.2 securerandom.rb to get rake-compiler to cross build ruby 2.2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- /home/vagrant/.rake-compiler/sources/ruby-2.2.1/lib/securerandom.rb.original 2015-05-18 08:49:56.007018200 -0700 | |
+++ /home/vagrant/.rake-compiler/sources/ruby-2.2.1/lib/securerandom.rb 2015-05-18 08:58:42.187018200 -0700 | |
@@ -45,9 +45,14 @@ | |
module AdvApi32 # :nodoc: | |
extend Fiddle::Importer | |
- dlload "advapi32" | |
- extern "int CryptAcquireContext(void*, void*, void*, unsigned long, unsigned long)" | |
- extern "int CryptGenRandom(void*, unsigned long, void*)" | |
+ | |
+ begin | |
+ dlload "advapi32" | |
+ extern "int CryptAcquireContext(void*, void*, void*, unsigned long, unsigned long)" | |
+ extern "int CryptGenRandom(void*, unsigned long, void*)" | |
+ rescue Fiddle::DLError => e | |
+ STDERR.puts "(Ignore this error if cross compiling) #{e}" | |
+ end | |
def self.get_provider | |
hProvStr = " " * Fiddle::SIZEOF_VOIDP | |
@@ -74,9 +79,14 @@ | |
module Kernel32 # :nodoc: | |
extend Fiddle::Importer | |
- dlload "kernel32" | |
- extern "unsigned long GetLastError()" | |
- extern "unsigned long FormatMessageA(unsigned long, void*, unsigned long, unsigned long, void*, unsigned long, void*)" | |
+ | |
+ begin | |
+ dlload "kernel32" | |
+ extern "unsigned long GetLastError()" | |
+ extern "unsigned long FormatMessageA(unsigned long, void*, unsigned long, unsigned long, void*, unsigned long, void*)" | |
+ rescue Fiddle::DLError => e | |
+ STDERR.puts "(Ignore this error if cross compiling) #{e}" | |
+ end | |
# Following code is based on David Garamond's GUID library for Ruby. | |
def self.last_error_message |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment