This should fix lang/rubinius after the egd removal in openssl. It's
kind of ugly as you have unpack the openssl gem, patch the c file, and
then repack the gem.

My ports building machine hasn't been updated recently, so I'd like
an OK from someone who has tested this on a more current -current
before I commit it.

Thanks,
Jeremy

Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/rubinius/Makefile,v
retrieving revision 1.28
diff -u -p -r1.28 Makefile
--- Makefile    7 Jan 2014 22:45:05 -0000       1.28
+++ Makefile    20 Apr 2014 18:13:29 -0000
@@ -13,6 +13,7 @@ COMMENT =     Ruby virtual machine and core 
 V=             2.2.3
 EXTRACT_SUFX=  .tar.bz2
 DISTNAME =     rubinius-${V}
+REVISION =     0
 
 MASTER_SITES = http://releases.rubini.us/
 
@@ -56,7 +57,23 @@ SUBST_VARS=  RBX_ARCH
 # Otherwise
 LLVM_OPTION =  --disable-llvm
 
+OPENSSL_GEM_FILE = vendor/cache/rubysl-openssl-2.0.5.gem
+
 do-configure:
+       # Patch openssl library
+       cd ${WRKSRC} && tar xf ${OPENSSL_GEM_FILE} && \
+               mkdir data && \
+               cd data && \
+               tar ztf ../data.tar.gz > file_list && \
+               tar zxf ../data.tar.gz && \
+               rm -f ../data.tar.gz && \
+               patch --posix ext/rubysl/openssl/ossl_rand.c \
+                       ${PATCHDIR}/openssl_rand.diff && \
+               tar zcf ../data.tar.gz -I file_list  && \
+               cd .. && \
+               rm -f ${OPENSSL_GEM_FILE} && \
+               tar cf ${OPENSSL_GEM_FILE} metadata.gz data.tar.gz && \
+               rm -rf data metadata.gz data.tar.gz checksums.yaml.gz
        mkdir -p ${GEM_HOME}
        cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} bundle20 install \
                --local --path ${GEM_HOME}
Index: patches/openssl_rand.diff
===================================================================
RCS file: patches/openssl_rand.diff
diff -N patches/openssl_rand.diff
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/openssl_rand.diff   20 Apr 2014 17:12:13 -0000
@@ -0,0 +1,52 @@
+--- ext/rubysl/openssl/ossl_rand.c.orig        Sun Apr 20 10:11:14 2014
++++ ext/rubysl/openssl/ossl_rand.c     Sun Apr 20 10:11:29 2014
+@@ -127,40 +127,6 @@
+ 
+ /*
+  *  call-seq:
+- *     egd(filename) -> true
+- *
+- */
+-static VALUE
+-ossl_rand_egd(VALUE self, VALUE filename)
+-{
+-    SafeStringValue(filename);
+-
+-    if(!RAND_egd(RSTRING_PTR(filename))) {
+-      ossl_raise(eRandomError, NULL);
+-    }
+-    return Qtrue;
+-}
+-
+-/*
+- *  call-seq:
+- *     egd_bytes(filename, length) -> true
+- *
+- */
+-static VALUE
+-ossl_rand_egd_bytes(VALUE self, VALUE filename, VALUE len)
+-{
+-    int n = NUM2INT(len);
+-
+-    SafeStringValue(filename);
+-
+-    if (!RAND_egd_bytes(RSTRING_PTR(filename), n)) {
+-      ossl_raise(eRandomError, NULL);
+-    }
+-    return Qtrue;
+-}
+-
+-/*
+- *  call-seq:
+  *     status? => true | false
+  *
+  * Return true if the PRNG has been seeded with enough data, false otherwise.
+@@ -195,8 +161,6 @@
+     DEFMETH(mRandom, "write_random_file", ossl_rand_write_file, 1);
+     DEFMETH(mRandom, "random_bytes", ossl_rand_bytes, 1);
+     DEFMETH(mRandom, "pseudo_bytes", ossl_rand_pseudo_bytes, 1);
+-    DEFMETH(mRandom, "egd", ossl_rand_egd, 1);
+-    DEFMETH(mRandom, "egd_bytes", ossl_rand_egd_bytes, 2);
+     DEFMETH(mRandom, "status?", ossl_rand_status, 0)
+ }
+ 

Reply via email to