aboutsummaryrefslogtreecommitdiff
path: root/databases/ruby-bdb
diff options
context:
space:
mode:
authorSteve Wills <swills@FreeBSD.org>2015-03-30 13:16:20 +0000
committerSteve Wills <swills@FreeBSD.org>2015-03-30 13:16:20 +0000
commitb4b3c4d8ab8f99a5714554f47fb247bd9181e029 (patch)
treee98e3e8deb2d5f3f95f7a6302193eae727cf1466 /databases/ruby-bdb
parentd1691c0fc9aec0baba910a55def127c24af7c9c0 (diff)
downloadports-b4b3c4d8ab8f99a5714554f47fb247bd9181e029.tar.gz
ports-b4b3c4d8ab8f99a5714554f47fb247bd9181e029.zip
databases/ruby-bdb: fix build with ruby 2.1 and 2.2
With hat: ruby@
Notes
Notes: svn path=/head/; revision=382655
Diffstat (limited to 'databases/ruby-bdb')
-rw-r--r--databases/ruby-bdb/Makefile16
-rw-r--r--databases/ruby-bdb/files/extra-patch-bdbxml2-bdbxml.h11
-rw-r--r--databases/ruby-bdb/files/extra-patch-src-common.c-2172
-rw-r--r--databases/ruby-bdb/files/extra-patch-src-common.c-22137
-rw-r--r--databases/ruby-bdb/files/extra-patch-src-cursor.c-2213
-rw-r--r--databases/ruby-bdb/files/extra-patch-src-features.rb18
-rw-r--r--databases/ruby-bdb/files/extra-patch-src-recnum.c-2222
-rw-r--r--databases/ruby-bdb/files/patch-extconf.rb22
-rw-r--r--databases/ruby-bdb/files/patch-src-extconf.rb23
9 files changed, 329 insertions, 5 deletions
diff --git a/databases/ruby-bdb/Makefile b/databases/ruby-bdb/Makefile
index 4835b673d61b..8e8861f2d3b4 100644
--- a/databases/ruby-bdb/Makefile
+++ b/databases/ruby-bdb/Makefile
@@ -58,14 +58,24 @@ SHEBANG_FILES= examples/record.rb \
.include <bsd.port.pre.mk>
-post-patch:
.if ${RUBY_VER} >= 2.0
- @${REINPLACE_CMD} -e '/remove_const/d' ${WRKSRC}/src/features.rb
+EXTRA_PATCHES+= ${FILESDIR}/extra-patch-src-features.rb
.endif
.if ${RUBY_VER} >= 2.1
- @${REINPLACE_CMD} -e 's|RBASIC(obj)->klass = \(.*\);|RBASIC_SET_CLASS_RAW(obj, \1);|' -e 's|RCLASS(\([[:alnum:]_]*\))->m_tbl|RCLASS_M_TBL(\1)|g' ${WRKSRC}/bdbxml2/bdbxml.h ${WRKSRC}/src/common.c
+EXTRA_PATCHES+= ${FILESDIR}/extra-patch-bdbxml2-bdbxml.h
.endif
+
+.if ${RUBY_VER} == 2.1
+EXTRA_PATCHES+= ${FILESDIR}/extra-patch-src-common.c-21
+.endif
+
+.if ${RUBY_VER} == 2.2
+EXTRA_PATCHES+= ${FILESDIR}/extra-patch-src-common.c-22 \
+ ${FILESDIR}/extra-patch-src-recnum.c-22 \
+ ${FILESDIR}/extra-patch-src-cursor.c-22
+.endif
+
post-build:
(cd ${BUILD_WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} \
${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} rdoc)
diff --git a/databases/ruby-bdb/files/extra-patch-bdbxml2-bdbxml.h b/databases/ruby-bdb/files/extra-patch-bdbxml2-bdbxml.h
new file mode 100644
index 000000000000..e29227fac701
--- /dev/null
+++ b/databases/ruby-bdb/files/extra-patch-bdbxml2-bdbxml.h
@@ -0,0 +1,11 @@
+--- bdbxml2/bdbxml.h.orig 2011-04-06 19:35:39.000000000 +0000
++++ bdbxml2/bdbxml.h 2015-01-22 17:03:07.000000000 +0000
+@@ -377,7 +377,7 @@
+ static inline void
+ rset_obj(VALUE obj)
+ {
+- RBASIC(obj)->klass = rb_cData;
++ RBASIC_SET_CLASS_RAW(obj, rb_cData);
+ RDATA(obj)->dfree = (RDF)free;
+ RDATA(obj)->dmark = 0;
+ }
diff --git a/databases/ruby-bdb/files/extra-patch-src-common.c-21 b/databases/ruby-bdb/files/extra-patch-src-common.c-21
new file mode 100644
index 000000000000..4cc0727fd326
--- /dev/null
+++ b/databases/ruby-bdb/files/extra-patch-src-common.c-21
@@ -0,0 +1,72 @@
+--- src/common.c.orig 2011-04-06 19:35:39.000000000 +0000
++++ src/common.c 2015-01-22 17:06:38.000000000 +0000
+@@ -1570,10 +1570,10 @@
+ #endif
+ switch(dbst->type) {
+ case DB_BTREE:
+- RBASIC(obj)->klass = bdb_cBtree;
++ RBASIC_SET_CLASS_RAW(obj, bdb_cBtree);
+ break;
+ case DB_HASH:
+- RBASIC(obj)->klass = bdb_cHash;
++ RBASIC_SET_CLASS_RAW(obj, bdb_cHash);
+ break;
+ case DB_RECNO:
+ {
+@@ -1581,17 +1581,17 @@
+
+ rb_warning("It's hard to distinguish Recnum with Recno for all versions of Berkeley DB");
+ if ((count = bdb_is_recnum(dbst->dbp)) != -1) {
+- RBASIC(obj)->klass = bdb_cRecnum;
++ RBASIC_SET_CLASS_RAW(obj, bdb_cRecnum);
+ dbst->len = count;
+ }
+ else {
+- RBASIC(obj)->klass = bdb_cRecno;
++ RBASIC_SET_CLASS_RAW(obj, bdb_cRecno);
+ }
+ break;
+ }
+ #if HAVE_CONST_DB_QUEUE
+ case DB_QUEUE:
+- RBASIC(obj)->klass = bdb_cQueue;
++ RBASIC_SET_CLASS_RAW(obj, bdb_cQueue);
+ break;
+ #endif
+ default:
+@@ -1635,29 +1635,29 @@
+ dbst->options = BDB_NOT_OPEN;
+ cl = obj;
+ while (cl) {
+- if (cl == bdb_cBtree || RCLASS(cl)->m_tbl == RCLASS(bdb_cBtree)->m_tbl) {
++ if (cl == bdb_cBtree || RCLASS_M_TBL(cl) == RCLASS_M_TBL(bdb_cBtree)) {
+ dbst->type = DB_BTREE;
+ break;
+ }
+- if (cl == bdb_cRecnum || RCLASS(cl)->m_tbl == RCLASS(bdb_cRecnum)->m_tbl) {
++ if (cl == bdb_cRecnum || RCLASS_M_TBL(cl) == RCLASS_M_TBL(bdb_cRecnum)) {
+ dbst->type = DB_RECNO;
+ break;
+ }
+- else if (cl == bdb_cHash || RCLASS(cl)->m_tbl == RCLASS(bdb_cHash)->m_tbl) {
++ else if (cl == bdb_cHash || RCLASS_M_TBL(cl) == RCLASS_M_TBL(bdb_cHash)) {
+ dbst->type = DB_HASH;
+ break;
+ }
+- else if (cl == bdb_cRecno || RCLASS(cl)->m_tbl == RCLASS(bdb_cRecno)->m_tbl) {
++ else if (cl == bdb_cRecno || RCLASS_M_TBL(cl) == RCLASS_M_TBL(bdb_cRecno)) {
+ dbst->type = DB_RECNO;
+ break;
+ }
+ #if HAVE_CONST_DB_QUEUE
+- else if (cl == bdb_cQueue || RCLASS(cl)->m_tbl == RCLASS(bdb_cQueue)->m_tbl) {
++ else if (cl == bdb_cQueue || RCLASS_M_TBL(cl) == RCLASS_M_TBL(bdb_cQueue)) {
+ dbst->type = DB_QUEUE;
+ break;
+ }
+ #endif
+- else if (cl == bdb_cUnknown || RCLASS(cl)->m_tbl == RCLASS(bdb_cUnknown)->m_tbl) {
++ else if (cl == bdb_cUnknown || RCLASS_M_TBL(cl) == RCLASS_M_TBL(bdb_cUnknown)) {
+ dbst->type = DB_UNKNOWN;
+ break;
+ }
diff --git a/databases/ruby-bdb/files/extra-patch-src-common.c-22 b/databases/ruby-bdb/files/extra-patch-src-common.c-22
new file mode 100644
index 000000000000..ddb3c03827f8
--- /dev/null
+++ b/databases/ruby-bdb/files/extra-patch-src-common.c-22
@@ -0,0 +1,137 @@
+--- src/common.c.orig 2011-04-06 19:35:39.000000000 +0000
++++ src/common.c 2015-01-22 17:10:32.000000000 +0000
+@@ -1229,7 +1229,7 @@
+ if (argc && TYPE(argv[argc - 1]) == T_HASH) {
+ VALUE v, f = argv[argc - 1];
+
+- if ((v = rb_hash_aref(f, rb_str_new2("txn"))) != RHASH(f)->ifnone) {
++ if ((v = rb_hash_aref(f, rb_str_new2("txn"))) != rb_hash_ifnone(f)) {
+ if (!rb_obj_is_kind_of(v, bdb_cTxn)) {
+ rb_raise(bdb_eFatal, "argument of txn must be a transaction");
+ }
+@@ -1241,7 +1241,7 @@
+ dbst->options |= envst->options & BDB_NO_THREAD;
+ dbst->marshal = txnst->marshal;
+ }
+- else if ((v = rb_hash_aref(f, rb_str_new2("env"))) != RHASH(f)->ifnone) {
++ else if ((v = rb_hash_aref(f, rb_str_new2("env"))) != rb_hash_ifnone(f)) {
+ if (!rb_obj_is_kind_of(v, bdb_cEnv)) {
+ rb_raise(bdb_eFatal, "argument of env must be an environnement");
+ }
+@@ -1254,11 +1254,11 @@
+ #if HAVE_CONST_DB_ENCRYPT
+ if (envst && (envst->options & BDB_ENV_ENCRYPT)) {
+ VALUE tmp = rb_str_new2("set_flags");
+- if ((v = rb_hash_aref(f, rb_intern("set_flags"))) != RHASH(f)->ifnone) {
++ if ((v = rb_hash_aref(f, rb_intern("set_flags"))) != rb_hash_ifnone(f)) {
+ rb_hash_aset(f, rb_intern("set_flags"),
+ INT2NUM(NUM2INT(v) | DB_ENCRYPT));
+ }
+- else if ((v = rb_hash_aref(f, tmp)) != RHASH(f)->ifnone) {
++ else if ((v = rb_hash_aref(f, tmp)) != rb_hash_ifnone(f)) {
+ rb_hash_aset(f, tmp, INT2NUM(NUM2INT(v) | DB_ENCRYPT));
+ }
+ else {
+@@ -1570,10 +1570,10 @@
+ #endif
+ switch(dbst->type) {
+ case DB_BTREE:
+- RBASIC(obj)->klass = bdb_cBtree;
++ RBASIC_SET_CLASS_RAW(obj, bdb_cBtree);
+ break;
+ case DB_HASH:
+- RBASIC(obj)->klass = bdb_cHash;
++ RBASIC_SET_CLASS_RAW(obj, bdb_cHash);
+ break;
+ case DB_RECNO:
+ {
+@@ -1581,17 +1581,17 @@
+
+ rb_warning("It's hard to distinguish Recnum with Recno for all versions of Berkeley DB");
+ if ((count = bdb_is_recnum(dbst->dbp)) != -1) {
+- RBASIC(obj)->klass = bdb_cRecnum;
++ RBASIC_SET_CLASS_RAW(obj, bdb_cRecnum);
+ dbst->len = count;
+ }
+ else {
+- RBASIC(obj)->klass = bdb_cRecno;
++ RBASIC_SET_CLASS_RAW(obj, bdb_cRecno);
+ }
+ break;
+ }
+ #if HAVE_CONST_DB_QUEUE
+ case DB_QUEUE:
+- RBASIC(obj)->klass = bdb_cQueue;
++ RBASIC_SET_CLASS_RAW(obj, bdb_cQueue);
+ break;
+ #endif
+ default:
+@@ -1635,29 +1635,29 @@
+ dbst->options = BDB_NOT_OPEN;
+ cl = obj;
+ while (cl) {
+- if (cl == bdb_cBtree || RCLASS(cl)->m_tbl == RCLASS(bdb_cBtree)->m_tbl) {
++ if (cl == bdb_cBtree || RCLASS_M_TBL(cl) == RCLASS_M_TBL(bdb_cBtree)) {
+ dbst->type = DB_BTREE;
+ break;
+ }
+- if (cl == bdb_cRecnum || RCLASS(cl)->m_tbl == RCLASS(bdb_cRecnum)->m_tbl) {
++ if (cl == bdb_cRecnum || RCLASS_M_TBL(cl) == RCLASS_M_TBL(bdb_cRecnum)) {
+ dbst->type = DB_RECNO;
+ break;
+ }
+- else if (cl == bdb_cHash || RCLASS(cl)->m_tbl == RCLASS(bdb_cHash)->m_tbl) {
++ else if (cl == bdb_cHash || RCLASS_M_TBL(cl) == RCLASS_M_TBL(bdb_cHash)) {
+ dbst->type = DB_HASH;
+ break;
+ }
+- else if (cl == bdb_cRecno || RCLASS(cl)->m_tbl == RCLASS(bdb_cRecno)->m_tbl) {
++ else if (cl == bdb_cRecno || RCLASS_M_TBL(cl) == RCLASS_M_TBL(bdb_cRecno)) {
+ dbst->type = DB_RECNO;
+ break;
+ }
+ #if HAVE_CONST_DB_QUEUE
+- else if (cl == bdb_cQueue || RCLASS(cl)->m_tbl == RCLASS(bdb_cQueue)->m_tbl) {
++ else if (cl == bdb_cQueue || RCLASS_M_TBL(cl) == RCLASS_M_TBL(bdb_cQueue)) {
+ dbst->type = DB_QUEUE;
+ break;
+ }
+ #endif
+- else if (cl == bdb_cUnknown || RCLASS(cl)->m_tbl == RCLASS(bdb_cUnknown)->m_tbl) {
++ else if (cl == bdb_cUnknown || RCLASS_M_TBL(cl) == RCLASS_M_TBL(bdb_cUnknown)) {
+ dbst->type = DB_UNKNOWN;
+ break;
+ }
+@@ -3004,8 +3004,8 @@
+
+ if (argc && TYPE(argv[argc - 1]) == T_HASH) {
+ VALUE g, f = argv[argc - 1];
+- if ((g = rb_hash_aref(f, rb_intern("flags"))) != RHASH(f)->ifnone ||
+- (g = rb_hash_aref(f, rb_str_new2("flags"))) != RHASH(f)->ifnone) {
++ if ((g = rb_hash_aref(f, rb_intern("flags"))) != rb_hash_ifnone(f) ||
++ (g = rb_hash_aref(f, rb_str_new2("flags"))) != rb_hash_ifnone(f)) {
+ flags = NUM2INT(g);
+ }
+ argc--;
+@@ -3323,8 +3323,8 @@
+ flags = 0;
+ if (argc && TYPE(argv[argc - 1]) == T_HASH) {
+ VALUE g, f = argv[argc - 1];
+- if ((g = rb_hash_aref(f, rb_intern("flags"))) != RHASH(f)->ifnone ||
+- (g = rb_hash_aref(f, rb_str_new2("flags"))) != RHASH(f)->ifnone) {
++ if ((g = rb_hash_aref(f, rb_intern("flags"))) != rb_hash_ifnone(f) ||
++ (g = rb_hash_aref(f, rb_str_new2("flags"))) != rb_hash_ifnone(f)) {
+ flags = NUM2INT(g);
+ }
+ argc--;
+@@ -3348,8 +3348,8 @@
+ flags = 0;
+ if (TYPE(argv[argc - 1]) == T_HASH) {
+ VALUE f = argv[argc - 1];
+- if ((g = rb_hash_aref(f, rb_intern("flags"))) != RHASH(f)->ifnone ||
+- (g = rb_hash_aref(f, rb_str_new2("flags"))) != RHASH(f)->ifnone) {
++ if ((g = rb_hash_aref(f, rb_intern("flags"))) != rb_hash_ifnone(f) ||
++ (g = rb_hash_aref(f, rb_str_new2("flags"))) != rb_hash_ifnone(f)) {
+ flags = NUM2INT(g);
+ }
+ argc--;
diff --git a/databases/ruby-bdb/files/extra-patch-src-cursor.c-22 b/databases/ruby-bdb/files/extra-patch-src-cursor.c-22
new file mode 100644
index 000000000000..52253da25726
--- /dev/null
+++ b/databases/ruby-bdb/files/extra-patch-src-cursor.c-22
@@ -0,0 +1,13 @@
+--- src/cursor.c.orig 2015-01-22 17:37:51.000000000 +0000
++++ src/cursor.c 2015-01-22 17:38:17.000000000 +0000
+@@ -29,8 +29,8 @@
+ flags = 0;
+ if (argc && TYPE(argv[argc - 1]) == T_HASH) {
+ VALUE g, f = argv[argc - 1];
+- if ((g = rb_hash_aref(f, rb_intern("flags"))) != RHASH(f)->ifnone ||
+- (g = rb_hash_aref(f, rb_str_new2("flags"))) != RHASH(f)->ifnone) {
++ if ((g = rb_hash_aref(f, rb_intern("flags"))) != rb_hash_ifnone(f) ||
++ (g = rb_hash_aref(f, rb_str_new2("flags"))) != rb_hash_ifnone(f)) {
+ flags = NUM2INT(g);
+ }
+ argc--;
diff --git a/databases/ruby-bdb/files/extra-patch-src-features.rb b/databases/ruby-bdb/files/extra-patch-src-features.rb
new file mode 100644
index 000000000000..6d894c93f8a4
--- /dev/null
+++ b/databases/ruby-bdb/files/extra-patch-src-features.rb
@@ -0,0 +1,18 @@
+--- src/features.rb.orig 2011-04-06 19:35:39.000000000 +0000
++++ src/features.rb 2015-01-22 16:40:53.000000000 +0000
+@@ -813,7 +813,6 @@
+ begin
+ conftest = CONFTEST_C.dup
+ class Object
+- remove_const('CONFTEST_C')
+ end
+
+ CONFTEST_C = 'conftest.cxx'
+@@ -878,7 +877,6 @@
+
+ ensure
+ class Object
+- remove_const('CONFTEST_C')
+ end
+
+ CONFTEST_C = conftest
diff --git a/databases/ruby-bdb/files/extra-patch-src-recnum.c-22 b/databases/ruby-bdb/files/extra-patch-src-recnum.c-22
new file mode 100644
index 000000000000..ec7b9548f2c3
--- /dev/null
+++ b/databases/ruby-bdb/files/extra-patch-src-recnum.c-22
@@ -0,0 +1,22 @@
+--- src/recnum.c.orig 2011-04-06 19:35:39.000000000 +0000
++++ src/recnum.c 2015-01-22 17:16:32.000000000 +0000
+@@ -17,7 +17,7 @@
+ argc++;
+ }
+ rb_hash_aset(argv[argc - 1], array, INT2FIX(0));
+- if (rb_hash_aref(argv[argc - 1], sarray) != RHASH(argv[argc - 1])->ifnone) {
++ if (rb_hash_aref(argv[argc - 1], sarray) != rb_hash_ifnone(argv[argc - 1])) {
+ rb_hash_aset(argv[argc - 1], sarray, INT2FIX(0));
+ }
+ rb_hash_aset(argv[argc - 1], rb_str_new2("set_flags"), INT2FIX(DB_RENUMBER));
+@@ -697,8 +697,8 @@
+
+ if (argc && TYPE(argv[argc - 1]) == T_HASH) {
+ VALUE f = argv[argc - 1];
+- if ((g = rb_hash_aref(f, rb_intern("flags"))) != RHASH(f)->ifnone ||
+- (g = rb_hash_aref(f, rb_str_new2("flags"))) != RHASH(f)->ifnone) {
++ if ((g = rb_hash_aref(f, rb_intern("flags"))) != rb_hash_ifnone(f) ||
++ (g = rb_hash_aref(f, rb_str_new2("flags"))) != rb_hash_ifnone(f)) {
+ flags = NUM2INT(g);
+ }
+ argc--;
diff --git a/databases/ruby-bdb/files/patch-extconf.rb b/databases/ruby-bdb/files/patch-extconf.rb
index 3127fe0dbe46..c294839dbaed 100644
--- a/databases/ruby-bdb/files/patch-extconf.rb
+++ b/databases/ruby-bdb/files/patch-extconf.rb
@@ -1,5 +1,5 @@
---- ./extconf.rb.orig 2011-04-06 19:35:39.000000000 +0000
-+++ ./extconf.rb 2014-01-03 01:45:56.334209519 +0000
+--- extconf.rb.orig 2011-04-06 19:35:39.000000000 +0000
++++ extconf.rb 2015-01-22 14:56:21.000000000 +0000
@@ -50,7 +50,7 @@
rdoc: docs/doc/index.html
@@ -9,3 +9,21 @@
ri:
\t@-(rdoc -r docs/*rb)
+@@ -67,7 +67,7 @@
+ Dir.foreach('tests') do |x|
+ next if /^\./ =~ x || /(_\.rb|~)$/ =~ x
+ next if FileTest.directory?(x)
+- make.print "\t-#{CONFIG['RUBY_INSTALL_NAME']} tests/#{x}\n"
++ make.print "\t-#{RbConfig::CONFIG['ruby_install_name']} tests/#{x}\n"
+ end
+ ensure
+ make.close
+@@ -76,7 +76,7 @@
+ subdirs.each do |subdir|
+ STDERR.puts("#{$0}: Entering directory `#{subdir}'")
+ Dir.chdir(subdir)
+- system("#{CONFIG['RUBY_INSTALL_NAME']} extconf.rb " + ARGV.join(" "))
++ system("#{RbConfig::CONFIG['ruby_install_name']} extconf.rb " + ARGV.join(" "))
+ Dir.chdir("..")
+ STDERR.puts("#{$0}: Leaving directory `#{subdir}'")
+ end
diff --git a/databases/ruby-bdb/files/patch-src-extconf.rb b/databases/ruby-bdb/files/patch-src-extconf.rb
new file mode 100644
index 000000000000..edafdee39408
--- /dev/null
+++ b/databases/ruby-bdb/files/patch-src-extconf.rb
@@ -0,0 +1,23 @@
+--- src/extconf.rb.orig 2015-01-22 16:09:31.000000000 +0000
++++ src/extconf.rb 2015-01-22 16:09:34.000000000 +0000
+@@ -36,16 +36,16 @@
+
+ if unknown = enable_config("unknown")
+ libs = if CONFIG.key?("LIBRUBYARG_STATIC")
+- Config::expand(CONFIG["LIBRUBYARG_STATIC"].dup).sub(/^-l/, '')
++ RbConfig::expand(CONFIG["LIBRUBYARG_STATIC"].dup).sub(/^-l/, '')
+ else
+- Config::expand(CONFIG["LIBRUBYARG"].dup).sub(/lib([^.]*).*/, '\\1')
++ RbConfig::expand(CONFIG["LIBRUBYARG"].dup).sub(/lib([^.]*).*/, '\\1')
+ end
+ unknown = find_library(libs, "ruby_init",
+- Config::expand(CONFIG["archdir"].dup))
++ RbConfig::expand(CONFIG["archdir"].dup))
+ end
+
+ inc_dir, lib_dir = dir_config("db", "/usr/include", "/usr/lib")
+-case Config::CONFIG["arch"]
++case RbConfig::CONFIG["arch"]
+ when /solaris2/
+ $DLDFLAGS ||= ""
+ $DLDFLAGS += " -R#{lib_dir}"