Browse Source

ruby: link ext/digest/* to openssl only when needed, fix rmd160 name

ext/digest/rmd160 was referencing a function that never existed in openssl.
The name was simply mistyped. Now it can use openssl.

openssl was always linked to ext/digest when library is avaiable,
even when it was disable by configure option and not used by code.

upstream refs: https://bugs.ruby-lang.org/issues/10252
upstream refs: https://bugs.ruby-lang.org/issues/10324

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Luiz Angelo Daros de Luca 10 years ago
parent
commit
cfcd564d9c

+ 1
- 1
lang/ruby/Makefile View File

@@ -16,7 +16,7 @@ include $(TOPDIR)/rules.mk
16 16
 
17 17
 PKG_NAME:=ruby
18 18
 PKG_VERSION:=2.1.2
19
-PKG_RELEASE:=6
19
+PKG_RELEASE:=7
20 20
 
21 21
 PKG_LIBVER:=2.1
22 22
 

+ 12
- 0
lang/ruby/patches/003-digest_rmd160_wrong_name_fix.patch View File

@@ -0,0 +1,12 @@
1
+diff -r -u ruby-2.1.2.old/ext/digest/rmd160/extconf.rb ruby-2.1.2/ext/digest/rmd160/extconf.rb
2
+--- ruby-2.1.2.old/ext/digest/rmd160/extconf.rb	2012-11-26 22:58:52.000000000 -0200
3
++++ ruby-2.1.2/ext/digest/rmd160/extconf.rb	2014-09-17 14:20:57.537367488 -0300
4
+@@ -14,7 +14,7 @@
5
+ require File.expand_path('../../../openssl/deprecation', __FILE__)
6
+ 
7
+ if !with_config("bundled-rmd160") &&
8
+-    have_library("crypto") && OpenSSL.check_func("RMD160_Transform", "openssl/ripemd.h")
9
++    have_library("crypto") && OpenSSL.check_func("RIPEMD160_Transform", "openssl/ripemd.h")
10
+   $objs << "rmd160ossl.#{$OBJEXT}"
11
+ else
12
+   $objs << "rmd160.#{$OBJEXT}"

+ 117
- 0
lang/ruby/patches/004-digest_dont-link-ssl-if-not-needed.patch View File

@@ -0,0 +1,117 @@
1
+--- ruby-2.1.2/ext/digest/md5/extconf.rb	2012-11-26 22:58:52.000000000 -0200
2
++++ ruby-2.1.2/ext/digest/md5/extconf.rb	2014-09-16 19:25:21.120457409 -0300
3
+@@ -9,14 +9,21 @@
4
+ 
5
+ $objs = [ "md5init.#{$OBJEXT}" ]
6
+ 
7
+-dir_config("openssl")
8
+-pkg_config("openssl")
9
+-require File.expand_path('../../../openssl/deprecation', __FILE__)
10
++if !with_config("bundled-md5")
11
++  dir_config("openssl")
12
++  pkg_config("openssl")
13
++  require File.expand_path('../../../openssl/deprecation', __FILE__)
14
++  if have_library("crypto") && OpenSSL.check_func("MD5_Transform", "openssl/md5.h")
15
++    $use_bundled=false
16
++  else
17
++    $use_bundled=true
18
++  end
19
++else
20
++  $use_bundled=true
21
++end
22
+ 
23
+-if !with_config("bundled-md5") &&
24
+-    have_library("crypto") && OpenSSL.check_func("MD5_Transform", "openssl/md5.h")
25
++if !$use_bundled
26
+   $objs << "md5ossl.#{$OBJEXT}"
27
+-
28
+ else
29
+   $objs << "md5.#{$OBJEXT}"
30
+ end
31
+--- ruby-2.1.2/ext/digest/rmd160/extconf.rb	2012-11-26 22:58:52.000000000 -0200
32
++++ ruby-2.1.2/ext/digest/rmd160/extconf.rb	2014-09-16 19:29:11.425628541 -0300
33
+@@ -9,12 +9,20 @@
34
+ 
35
+ $objs = [ "rmd160init.#{$OBJEXT}" ]
36
+ 
37
+-dir_config("openssl")
38
+-pkg_config("openssl")
39
+-require File.expand_path('../../../openssl/deprecation', __FILE__)
40
++if !with_config("bundled-rmd160")
41
++  dir_config("openssl")
42
++  pkg_config("openssl")
43
++  require File.expand_path('../../../openssl/deprecation', __FILE__)
44
++  if have_library("crypto") && OpenSSL.check_func("RIPEMD160_Transform", "openssl/ripemd.h")
45
++    $use_bundled=false
46
++  else
47
++    $use_bundled=true
48
++  end
49
++else
50
++  $use_bundled=true
51
++end
52
+ 
53
+-if !with_config("bundled-rmd160") &&
54
+-    have_library("crypto") && OpenSSL.check_func("RIPEMD160_Transform", "openssl/ripemd.h")
55
++if !$use_bundled
56
+   $objs << "rmd160ossl.#{$OBJEXT}"
57
+ else
58
+   $objs << "rmd160.#{$OBJEXT}"
59
+--- ruby-2.1.2/ext/digest/sha1/extconf.rb	2012-11-26 22:58:52.000000000 -0200
60
++++ ruby-2.1.2/ext/digest/sha1/extconf.rb	2014-09-16 19:30:09.359168494 -0300
61
+@@ -9,12 +9,20 @@
62
+ 
63
+ $objs = [ "sha1init.#{$OBJEXT}" ]
64
+ 
65
+-dir_config("openssl")
66
+-pkg_config("openssl")
67
+-require File.expand_path('../../../openssl/deprecation', __FILE__)
68
++if !with_config("bundled-sha1")
69
++  dir_config("openssl")
70
++  pkg_config("openssl")
71
++  require File.expand_path('../../../openssl/deprecation', __FILE__)
72
++  if have_library("crypto") && OpenSSL.check_func("SHA1_Transform", "openssl/sha.h")
73
++    $use_bundled=false
74
++  else
75
++    $use_bundled=true
76
++  end
77
++else
78
++  $use_bundled=true
79
++end
80
+ 
81
+-if !with_config("bundled-sha1") &&
82
+-    have_library("crypto") && OpenSSL.check_func("SHA1_Transform", "openssl/sha.h")
83
++if !$use_bundled
84
+   $objs << "sha1ossl.#{$OBJEXT}"
85
+ else
86
+   $objs << "sha1.#{$OBJEXT}"
87
+--- ruby-2.1.2/ext/digest/sha2/extconf.rb	2012-11-26 22:58:52.000000000 -0200
88
++++ ruby-2.1.2/ext/digest/sha2/extconf.rb	2014-09-16 19:31:31.833513570 -0300
89
+@@ -9,14 +9,22 @@
90
+ 
91
+ $objs = [ "sha2init.#{$OBJEXT}" ]
92
+ 
93
+-dir_config("openssl")
94
+-pkg_config("openssl")
95
+-require File.expand_path('../../../openssl/deprecation', __FILE__)
96
+-
97
+-if !with_config("bundled-sha2") &&
98
+-    have_library("crypto") &&
99
++if !with_config("bundled-sha2")
100
++  dir_config("openssl")
101
++  pkg_config("openssl")
102
++  require File.expand_path('../../../openssl/deprecation', __FILE__)
103
++  if have_library("crypto") &&
104
+     %w[SHA256 SHA512].all? {|d| OpenSSL.check_func("#{d}_Transform", "openssl/sha.h")} &&
105
+     %w[SHA256 SHA512].all? {|d| have_type("#{d}_CTX", "openssl/sha.h")}
106
++    $use_bundled=false
107
++  else
108
++    $use_bundled=true
109
++  end
110
++else
111
++  $use_bundled=true
112
++end
113
++
114
++if !$use_bundled
115
+   $objs << "sha2ossl.#{$OBJEXT}"
116
+   $defs << "-DSHA2_USE_OPENSSL"
117
+ else