Fix ruby on gcc4 and enabled building of shared libruby

* Switch to gcc for linking modules in order to handle the rpath
   flags
 * Enable -export-dynamic flag so we can lookup symbols properly
 * Add soname flags so that haikuporter doesn't freak out when
   trying to package the devel libs
This commit is contained in:
Chris Roberts
2013-11-11 23:41:49 -07:00
parent 9e27639aac
commit c0ac90b86c
2 changed files with 144 additions and 70 deletions

View File

@@ -1,6 +1,13 @@
diff -up ruby-1.9.1-p243/configure.in.orig ruby-1.9.1-p243/configure.in
--- ruby-1.9.1-p243/configure.in.orig 2009-05-11 09:06:48.016515072 -0600
+++ ruby-1.9.1-p243/configure.in 2010-05-20 13:00:34.788529152 -0600
From 8905e56a8092d502b54c26a753bb7920eae149ba Mon Sep 17 00:00:00 2001
From: Chris Roberts <cpr420@gmail.com>
Date: Mon, 11 Nov 2013 19:00:01 -0700
Subject: applying patch ruby-1.9.1.patch
diff --git a/configure.in b/configure.in
index c98a024..113d4e5 100644
--- a/configure.in
+++ b/configure.in
@@ -1462,11 +1462,11 @@ if test "$with_dln_a_out" != yes; then
haiku*) case "$target_cpu" in
powerpc*)
@@ -15,30 +22,10 @@ diff -up ruby-1.9.1-p243/configure.in.orig ruby-1.9.1-p243/configure.in
;;
esac
: ${LIBPATHENV=LIBRARY_PATH}
diff -up ruby-1.9.1-p243/signal.c.orig ruby-1.9.1-p243/signal.c
--- ruby-1.9.1-p243/signal.c.orig 2009-02-22 02:48:12.048234496 -0700
+++ ruby-1.9.1-p243/signal.c 2010-05-20 13:00:34.792461312 -0600
@@ -34,7 +34,7 @@ typedef int rb_atomic_t;
# define ATOMIC_DEC(var) (--(var))
#endif
-#ifdef __BEOS__
+#if defined __BEOS__ || defined __HAIKU__
#undef SIGBUS
#endif
@@ -586,7 +586,7 @@ static int segv_received = 0;
static RETSIGTYPE
sigsegv(int sig SIGINFO_ARG)
{
-#ifdef USE_SIGALTSTACK
+#if defined USE_SIGALTSTACK && defined SA_SIGINFO
int ruby_stack_overflowed_p(const rb_thread_t *, const void *);
NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th));
rb_thread_t *th = GET_THREAD();
diff -up ruby-1.9.1-p243/ext/nkf/nkf-utf8/nkf.h.orig ruby-1.9.1-p243/ext/nkf/nkf-utf8/nkf.h
--- ruby-1.9.1-p243/ext/nkf/nkf-utf8/nkf.h.orig 2008-11-11 01:41:20.021757952 -0700
+++ ruby-1.9.1-p243/ext/nkf/nkf-utf8/nkf.h 2010-05-20 13:00:34.794820608 -0600
diff --git a/ext/nkf/nkf-utf8/nkf.h b/ext/nkf/nkf-utf8/nkf.h
index 0998837..814ceef 100644
--- a/ext/nkf/nkf-utf8/nkf.h
+++ b/ext/nkf/nkf-utf8/nkf.h
@@ -164,6 +164,11 @@ void setbinmode(FILE *fp)
# ifndef HAVE_LOCALE_H
# define HAVE_LOCALE_H
@@ -51,9 +38,10 @@ diff -up ruby-1.9.1-p243/ext/nkf/nkf-utf8/nkf.h.orig ruby-1.9.1-p243/ext/nkf/nkf
#else
# ifndef HAVE_LANGINFO_H
# define HAVE_LANGINFO_H
diff -up ruby-1.9.1-p243/ext/openssl/ossl.c.orig ruby-1.9.1-p243/ext/openssl/ossl.c
--- ruby-1.9.1-p243/ext/openssl/ossl.c.orig 2009-01-15 08:39:30.024641536 -0700
+++ ruby-1.9.1-p243/ext/openssl/ossl.c 2010-05-20 13:00:34.797966336 -0600
diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c
index a3b612b..d900ef3 100644
--- a/ext/openssl/ossl.c
+++ b/ext/openssl/ossl.c
@@ -92,7 +92,7 @@ ossl_x509_ary2sk(VALUE ary)
#define OSSL_IMPL_SK2ARY(name, type) \
@@ -81,9 +69,10 @@ diff -up ruby-1.9.1-p243/ext/openssl/ossl.c.orig ruby-1.9.1-p243/ext/openssl/oss
rb_ary_push(ary, ossl_##name##_new(t)); \
} \
return ary; \
diff -up ruby-1.9.1-p243/ext/openssl/ossl.h.orig ruby-1.9.1-p243/ext/openssl/ossl.h
--- ruby-1.9.1-p243/ext/openssl/ossl.h.orig 2008-09-25 21:05:47.024641536 -0600
+++ ruby-1.9.1-p243/ext/openssl/ossl.h 2010-05-20 13:00:34.801112064 -0600
diff --git a/ext/openssl/ossl.h b/ext/openssl/ossl.h
index ecddb80..fe24280 100644
--- a/ext/openssl/ossl.h
+++ b/ext/openssl/ossl.h
@@ -104,6 +104,13 @@ extern VALUE eOSSLError;
} while (0)
@@ -98,9 +87,10 @@ diff -up ruby-1.9.1-p243/ext/openssl/ossl.h.orig ruby-1.9.1-p243/ext/openssl/oss
* String to HEXString conversion
*/
int string2hex(const unsigned char *, int, char **, int *);
diff -up ruby-1.9.1-p243/ext/openssl/ossl_config.c.orig ruby-1.9.1-p243/ext/openssl/ossl_config.c
--- ruby-1.9.1-p243/ext/openssl/ossl_config.c.orig 2010-05-20 13:16:19.708837376 -0600
+++ ruby-1.9.1-p243/ext/openssl/ossl_config.c 2010-05-20 13:18:54.922746880 -0600
diff --git a/ext/openssl/ossl_config.c b/ext/openssl/ossl_config.c
index bc5067f..5ec5b06 100644
--- a/ext/openssl/ossl_config.c
+++ b/ext/openssl/ossl_config.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_config.c 18971 2008-08-31 03:36:09Z nobu $
@@ -119,7 +109,7 @@ diff -up ruby-1.9.1-p243/ext/openssl/ossl_config.c.orig ruby-1.9.1-p243/ext/open
*/
static CONF *parse_config(VALUE, CONF*);
@@ -154,7 +154,7 @@ ossl_config_initialize(int argc, VALUE *
@@ -154,7 +154,7 @@ ossl_config_initialize(int argc, VALUE *argv, VALUE self)
_CONF_new_data(conf);
}
#endif
@@ -128,7 +118,7 @@ diff -up ruby-1.9.1-p243/ext/openssl/ossl_config.c.orig ruby-1.9.1-p243/ext/open
return self;
}
@@ -187,11 +187,30 @@ ossl_config_add_value(VALUE self, VALUE
@@ -187,11 +187,30 @@ ossl_config_add_value(VALUE self, VALUE section, VALUE name, VALUE value)
OPENSSL_free(cv);
ossl_raise(eConfigError, "_CONF_add_string failure");
}
@@ -169,7 +159,7 @@ diff -up ruby-1.9.1-p243/ext/openssl/ossl_config.c.orig ruby-1.9.1-p243/ext/open
rb_scan_args(argc, argv, "11", &section, &name);
/* support conf.value(nil, "HOME") -> conf.get_value("", "HOME") */
@@ -247,6 +266,7 @@ ossl_config_set_section(VALUE self, VALU
@@ -247,6 +266,7 @@ ossl_config_set_section(VALUE self, VALUE section, VALUE hash)
{
VALUE arg[2];
@@ -177,7 +167,7 @@ diff -up ruby-1.9.1-p243/ext/openssl/ossl_config.c.orig ruby-1.9.1-p243/ext/open
arg[0] = self;
arg[1] = section;
rb_block_call(hash, rb_intern("each"), 0, 0, set_conf_section_i, (VALUE)arg);
@@ -278,7 +298,7 @@ ossl_config_get_section(VALUE self, VALU
@@ -278,7 +298,7 @@ ossl_config_get_section(VALUE self, VALUE section)
return hash;
}
for (i=0; i<entries; i++) {
@@ -186,7 +176,7 @@ diff -up ruby-1.9.1-p243/ext/openssl/ossl_config.c.orig ruby-1.9.1-p243/ext/open
rb_hash_aset(hash, rb_str_new2(entry->name), rb_str_new2(entry->value));
}
@@ -292,15 +312,16 @@ ossl_config_get_section_old(VALUE self,
@@ -292,15 +312,16 @@ ossl_config_get_section_old(VALUE self, VALUE section)
return ossl_config_get_section(self, section);
}
@@ -225,7 +215,7 @@ diff -up ruby-1.9.1-p243/ext/openssl/ossl_config.c.orig ruby-1.9.1-p243/ext/open
STACK_OF(CONF_VALUE) *sk;
CONF_VALUE *v;
int i, num;
@@ -338,7 +361,7 @@ dump_conf_value(CONF_VALUE *cv, VALUE st
@@ -338,7 +361,7 @@ dump_conf_value(CONF_VALUE *cv, VALUE str)
rb_str_cat2(str, "\n");
}
@@ -253,7 +243,7 @@ diff -up ruby-1.9.1-p243/ext/openssl/ossl_config.c.orig ruby-1.9.1-p243/ext/open
{
STACK_OF(CONF_VALUE) *sk;
CONF_VALUE *v;
@@ -382,7 +406,7 @@ each_conf_value(CONF_VALUE *cv, void* du
@@ -382,7 +406,7 @@ each_conf_value(CONF_VALUE *cv, void* dummy)
}
}
@@ -281,10 +271,11 @@ diff -up ruby-1.9.1-p243/ext/openssl/ossl_config.c.orig ruby-1.9.1-p243/ext/open
rb_define_method(cConfig, "[]", ossl_config_get_section, 1);
rb_define_method(cConfig, "section", ossl_config_get_section_old, 1);
rb_define_method(cConfig, "[]=", ossl_config_set_section, 2);
diff -up ruby-1.9.1-p243/ext/openssl/ossl_pkcs7.c.orig ruby-1.9.1-p243/ext/openssl/ossl_pkcs7.c
--- ruby-1.9.1-p243/ext/openssl/ossl_pkcs7.c.orig 2008-07-22 09:34:23.027262976 -0600
+++ ruby-1.9.1-p243/ext/openssl/ossl_pkcs7.c 2010-05-20 13:00:34.805044224 -0600
@@ -572,12 +572,11 @@ ossl_pkcs7_add_certificate(VALUE self, V
diff --git a/ext/openssl/ossl_pkcs7.c b/ext/openssl/ossl_pkcs7.c
index f7cd156..644e91a 100644
--- a/ext/openssl/ossl_pkcs7.c
+++ b/ext/openssl/ossl_pkcs7.c
@@ -572,12 +572,11 @@ ossl_pkcs7_add_certificate(VALUE self, VALUE cert)
return self;
}
@@ -299,7 +290,7 @@ diff -up ruby-1.9.1-p243/ext/openssl/ossl_pkcs7.c.orig ruby-1.9.1-p243/ext/opens
int i;
GetPKCS7(self, pkcs7);
@@ -585,17 +584,38 @@ pkcs7_get_certs_or_crls(VALUE self, int
@@ -585,17 +584,38 @@ pkcs7_get_certs_or_crls(VALUE self, int want_certs)
switch(i){
case NID_pkcs7_signed:
certs = pkcs7->d.sign->cert;
@@ -341,7 +332,7 @@ diff -up ruby-1.9.1-p243/ext/openssl/ossl_pkcs7.c.orig ruby-1.9.1-p243/ext/opens
}
static VALUE
@@ -610,7 +630,7 @@ ossl_pkcs7_set_certificates(VALUE self,
@@ -610,7 +630,7 @@ ossl_pkcs7_set_certificates(VALUE self, VALUE ary)
STACK_OF(X509) *certs;
X509 *cert;
@@ -350,7 +341,7 @@ diff -up ruby-1.9.1-p243/ext/openssl/ossl_pkcs7.c.orig ruby-1.9.1-p243/ext/opens
while((cert = sk_X509_pop(certs))) X509_free(cert);
rb_block_call(ary, rb_intern("each"), 0, 0, ossl_pkcs7_set_certs_i, self);
@@ -620,7 +640,7 @@ ossl_pkcs7_set_certificates(VALUE self,
@@ -620,7 +640,7 @@ ossl_pkcs7_set_certificates(VALUE self, VALUE ary)
static VALUE
ossl_pkcs7_get_certificates(VALUE self)
{
@@ -359,7 +350,7 @@ diff -up ruby-1.9.1-p243/ext/openssl/ossl_pkcs7.c.orig ruby-1.9.1-p243/ext/opens
}
static VALUE
@@ -650,7 +670,7 @@ ossl_pkcs7_set_crls(VALUE self, VALUE ar
@@ -650,7 +670,7 @@ ossl_pkcs7_set_crls(VALUE self, VALUE ary)
STACK_OF(X509_CRL) *crls;
X509_CRL *crl;
@@ -368,7 +359,7 @@ diff -up ruby-1.9.1-p243/ext/openssl/ossl_pkcs7.c.orig ruby-1.9.1-p243/ext/opens
while((crl = sk_X509_CRL_pop(crls))) X509_CRL_free(crl);
rb_block_call(ary, rb_intern("each"), 0, 0, ossl_pkcs7_set_crls_i, self);
@@ -660,7 +680,7 @@ ossl_pkcs7_set_crls(VALUE self, VALUE ar
@@ -660,7 +680,7 @@ ossl_pkcs7_set_crls(VALUE self, VALUE ary)
static VALUE
ossl_pkcs7_get_crls(VALUE self)
{
@@ -377,9 +368,10 @@ diff -up ruby-1.9.1-p243/ext/openssl/ossl_pkcs7.c.orig ruby-1.9.1-p243/ext/opens
}
static VALUE
diff -up ruby-1.9.1-p243/ext/openssl/ossl_ssl.c.orig ruby-1.9.1-p243/ext/openssl/ossl_ssl.c
--- ruby-1.9.1-p243/ext/openssl/ossl_ssl.c.orig 2009-04-19 07:32:18.028311552 -0600
+++ ruby-1.9.1-p243/ext/openssl/ossl_ssl.c 2010-05-20 13:00:34.808714240 -0600
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index c278edc..1167627 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -1195,10 +1195,10 @@ ossl_ssl_get_peer_cert_chain(VALUE self)
}
chain = SSL_get_peer_cert_chain(ssl);
@@ -393,10 +385,11 @@ diff -up ruby-1.9.1-p243/ext/openssl/ossl_ssl.c.orig ruby-1.9.1-p243/ext/openssl
rb_ary_push(ary, ossl_x509_new(cert));
}
diff -up ruby-1.9.1-p243/ext/openssl/ossl_ssl_session.c.orig ruby-1.9.1-p243/ext/openssl/ossl_ssl_session.c
--- ruby-1.9.1-p243/ext/openssl/ossl_ssl_session.c.orig 2008-07-22 09:34:23.028573696 -0600
+++ ruby-1.9.1-p243/ext/openssl/ossl_ssl_session.c 2010-05-20 13:00:34.813694976 -0600
@@ -72,6 +72,16 @@ static VALUE ossl_ssl_session_initialize
diff --git a/ext/openssl/ossl_ssl_session.c b/ext/openssl/ossl_ssl_session.c
index b236e4d..4d0848f 100644
--- a/ext/openssl/ossl_ssl_session.c
+++ b/ext/openssl/ossl_ssl_session.c
@@ -72,6 +72,16 @@ static VALUE ossl_ssl_session_initialize(VALUE self, VALUE arg1)
return self;
}
@@ -413,9 +406,10 @@ diff -up ruby-1.9.1-p243/ext/openssl/ossl_ssl_session.c.orig ruby-1.9.1-p243/ext
/*
* call-seq:
* session1 == session2 -> boolean
diff -up ruby-1.9.1-p243/ext/openssl/ossl_x509attr.c.orig ruby-1.9.1-p243/ext/openssl/ossl_x509attr.c
--- ruby-1.9.1-p243/ext/openssl/ossl_x509attr.c.orig 2008-08-28 21:19:15.029097984 -0600
+++ ruby-1.9.1-p243/ext/openssl/ossl_x509attr.c 2010-05-20 13:00:34.817102848 -0600
diff --git a/ext/openssl/ossl_x509attr.c b/ext/openssl/ossl_x509attr.c
index 248e02a..2634cd9 100644
--- a/ext/openssl/ossl_x509attr.c
+++ b/ext/openssl/ossl_x509attr.c
@@ -218,8 +218,9 @@ ossl_x509attr_get_value(VALUE self)
ossl_str_adjust(str, p);
}
@@ -428,9 +422,10 @@ diff -up ruby-1.9.1-p243/ext/openssl/ossl_x509attr.c.orig ruby-1.9.1-p243/ext/op
str = rb_str_new(0, length);
p = (unsigned char *)RSTRING_PTR(str);
i2d_ASN1_SET_OF_ASN1_TYPE(attr->value.set, &p,
diff -up ruby-1.9.1-p243/ext/openssl/ossl_x509crl.c.orig ruby-1.9.1-p243/ext/openssl/ossl_x509crl.c
--- ruby-1.9.1-p243/ext/openssl/ossl_x509crl.c.orig 2008-07-22 09:34:23.029360128 -0600
+++ ruby-1.9.1-p243/ext/openssl/ossl_x509crl.c 2010-05-20 13:00:34.821821440 -0600
diff --git a/ext/openssl/ossl_x509crl.c b/ext/openssl/ossl_x509crl.c
index 3896b6e..c5123ae 100644
--- a/ext/openssl/ossl_x509crl.c
+++ b/ext/openssl/ossl_x509crl.c
@@ -264,7 +264,7 @@ ossl_x509crl_get_revoked(VALUE self)
VALUE ary, revoked;
@@ -449,3 +444,79 @@ diff -up ruby-1.9.1-p243/ext/openssl/ossl_x509crl.c.orig ruby-1.9.1-p243/ext/ope
revoked = ossl_x509revoked_new(rev);
rb_ary_push(ary, revoked);
}
diff --git a/signal.c b/signal.c
index 5da1769..74072d2 100644
--- a/signal.c
+++ b/signal.c
@@ -34,7 +34,7 @@ typedef int rb_atomic_t;
# define ATOMIC_DEC(var) (--(var))
#endif
-#ifdef __BEOS__
+#if defined __BEOS__ || defined __HAIKU__
#undef SIGBUS
#endif
@@ -586,7 +586,7 @@ static int segv_received = 0;
static RETSIGTYPE
sigsegv(int sig SIGINFO_ARG)
{
-#ifdef USE_SIGALTSTACK
+#if defined USE_SIGALTSTACK && defined SA_SIGINFO
int ruby_stack_overflowed_p(const rb_thread_t *, const void *);
NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th));
rb_thread_t *th = GET_THREAD();
--
1.8.3.4
From 623782bf181c3f15a276316c69839bf774fe8658 Mon Sep 17 00:00:00 2001
From: Chris Roberts <cpr420@gmail.com>
Date: Mon, 11 Nov 2013 20:00:13 -0700
Subject: Use gcc for linking modules
diff --git a/configure.in b/configure.in
index 113d4e5..9bfbfb3 100644
--- a/configure.in
+++ b/configure.in
@@ -1465,7 +1465,10 @@ if test "$with_dln_a_out" != yes; then
DLDFLAGS="$DLDFLAGS "'-export Init_$(TARGET) -lroot glue-noinit.a init_term_dyn.o start_dyn.o'
;;
i586*)
- : ${LDSHARED="ld -shared"}
+ : ${LDSHARED="${CC} -shared"}
+ if test "$rb_cv_binary_elf" = yes; then
+ LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
+ fi
DLDFLAGS="$DLDFLAGS -L/boot/system/develop/lib -lroot -L/boot/home/config/develop/lib"
;;
esac
--
1.8.3.4
From cc3d90149f715a93b962b4eab1b186acae22c23c Mon Sep 17 00:00:00 2001
From: Chris Roberts <cpr420@gmail.com>
Date: Mon, 11 Nov 2013 23:13:59 -0700
Subject: Add soname flags for libruby.so
diff --git a/configure.in b/configure.in
index 9bfbfb3..611b586 100644
--- a/configure.in
+++ b/configure.in
@@ -1777,6 +1777,10 @@ if test "$enable_shared" = 'yes'; then
;;
esac
;;
+ haiku*)
+ LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR)'
+ LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
+ ;;
darwin*)
LIBRUBY_SO='lib$(RUBY_SO_NAME).$(MAJOR).$(MINOR).$(TEENY).dylib'
LIBRUBY_LDSHARED='cc -dynamiclib -undefined suppress -flat_namespace'
--
1.8.3.4

View File

@@ -20,9 +20,9 @@ LICENSE="Ruby
BSD (3-clause)"
COPYRIGHT="1993-2009 Yukihiro Matsumoto"
REVISION="1"
REVISION="2"
ARCHITECTURES="?x86_gcc2 !x86 !x86_64"
ARCHITECTURES="?x86_gcc2 ?x86 !x86_64"
PROVIDES="
ruby = $portVersion compat >= 1.9
@@ -34,6 +34,7 @@ PROVIDES="
cmd:rdoc = $portVersion compat >= 1.9
cmd:ri = $portVersion compat >= 1.9
cmd:testrb = $portVersion compat >= 1.9
lib:libruby = $portVersion compat >= 1.9
"
REQUIRES="
@@ -68,6 +69,7 @@ PROVIDES_devel="
ruby_devel = $portVersion
devel:libruby_static = $portVersion compat >= 1.9
lib:libruby_static = $portVersion compat >= 1.9
devel:libruby = $portVersion compat >= 1.9
"
REQUIRES_devel="
@@ -76,18 +78,19 @@ REQUIRES_devel="
SOURCE_DIR="ruby-1.9.1-p243"
PATCHES="ruby-1.9.1.patch"
PATCHES="ruby-1.9.1.patchset"
BUILD()
{
autoconf
runConfigure ./configure
runConfigure ./configure \
--enable-shared
make $jobArgs
}
INSTALL()
{
make install
prepareInstalledDevelLibs libruby-static
prepareInstalledDevelLibs libruby-static libruby
packageEntries devel $developDir
}