Browse Source

ruby: spin-off ruby-digest from ruby-openssl

Digest can use OpenSSL or ruby internal implementation of hash functions. The first
uses less disk space but requires openssl, that is relatively big. As internal hash
implementations are not too much bigger than openssl version, it is compiled by
default. A new config option can change it to use OpenSSL instead.

As digest is independent from openssl, ruby-digest was created as a new pkgs.

Adds pkgs:
- ruby-digest (from ruby-openssl)

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Luiz Angelo Daros de Luca 10 years ago
parent
commit
c755b298c3
1 changed files with 39 additions and 4 deletions
  1. 39
    4
      lang/ruby/Makefile

+ 39
- 4
lang/ruby/Makefile View File

@@ -91,6 +91,26 @@ $(call Package/ruby/Default)
91 91
   DEPENDS:=ruby
92 92
 endef
93 93
 
94
+define Package/ruby-digest
95
+$(call Package/ruby/Default)
96
+  TITLE:=Ruby Digest Library
97
+  DEPENDS:=ruby +RUBY_DIGEST_USE_OPENSSL:libopenssl
98
+endef
99
+
100
+define Package/ruby-digest/config
101
+
102
+  config RUBY_DIGEST_USE_OPENSSL
103
+		bool "Use OpenSSL functions for ruby digest hash functions"
104
+        depends on PACKAGE_ruby-digest
105
+		help
106
+			Ruby can use OpenSSL hash functions or compile alternative implementations. Using
107
+			OpenSSL saves about 30KBytes (less when compressed) but requires OpenSSL (that
108
+			is way bigger than that). However, if OpenSSL is already needed by another usage,
109
+			as ruby-openssl or any other non ruby package, it is better to mark this option.
110
+		default n
111
+
112
+endef
113
+
94 114
 define Package/ruby-dl
95 115
 $(call Package/ruby/Default)
96 116
   TITLE+= (dynamic linker support) (adds 5MB+)
@@ -239,6 +259,15 @@ CONFIGURE_ARGS += \
239 259
 	--with-ruby-version=minor \
240 260
 	--with-iconv-dir=$(ICONV_PREFIX) \
241 261
 
262
+ifndef CONFIG_RUBY_DIGEST_USE_OPENSSL
263
+CONFIGURE_ARGS += \
264
+	--with-bundled-sha1\
265
+	--with-bundled-md5\
266
+	--with-bundled-rmd160\
267
+	--with-bundled-sha2 \
268
+
269
+endif
270
+
242 271
 TARGET_LDFLAGS += -L$(PKG_BUILD_DIR)
243 272
 
244 273
 MAKE_FLAGS += \
@@ -360,6 +389,15 @@ define Package/ruby-cgi/install
360 389
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/cgi.rb $(1)/usr/lib/ruby/$(PKG_LIBVER)/
361 390
 endef
362 391
 
392
+define Package/ruby-digest/install
393
+	( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
394
+		usr/lib/ruby/$(PKG_LIBVER)/digest \
395
+		usr/lib/ruby/$(PKG_LIBVER)/digest.rb \
396
+		usr/lib/ruby/$(PKG_LIBVER)/*/digest.so \
397
+		usr/lib/ruby/$(PKG_LIBVER)/*/digest/* \
398
+	) | ( cd $(1); $(TAR) -xf - )
399
+endef
400
+
363 401
 define Package/ruby-dl/install
364 402
 	( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
365 403
 		usr/lib/ruby/$(PKG_LIBVER)/*/dl.so \
@@ -443,10 +481,6 @@ endef
443 481
 
444 482
 define Package/ruby-openssl/install
445 483
 	( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
446
-		usr/lib/ruby/$(PKG_LIBVER)/digest \
447
-		usr/lib/ruby/$(PKG_LIBVER)/digest.rb \
448
-		usr/lib/ruby/$(PKG_LIBVER)/*/digest.so \
449
-		usr/lib/ruby/$(PKG_LIBVER)/*/digest/*.so \
450 484
 		usr/lib/ruby/$(PKG_LIBVER)/openssl \
451 485
 		usr/lib/ruby/$(PKG_LIBVER)/openssl.rb \
452 486
 		usr/lib/ruby/$(PKG_LIBVER)/*/openssl.so \
@@ -556,6 +590,7 @@ $(eval $(call BuildPackage,libruby))
556 590
 $(eval $(call BuildPackage,ruby-core))
557 591
 $(eval $(call BuildPackage,ruby-bigdecimal))
558 592
 $(eval $(call BuildPackage,ruby-cgi))
593
+$(eval $(call BuildPackage,ruby-digest))
559 594
 $(eval $(call BuildPackage,ruby-dl))
560 595
 $(eval $(call BuildPackage,ruby-enc))
561 596
 $(eval $(call BuildPackage,ruby-erb))