Commit 819318c5 authored by Steve Wills's avatar Steve Wills
Browse files

Remove bundled msgpack, update for latest msgpack

parent 7500895a
*.gem
.bundle
ext/src/msgpack*
......@@ -11,50 +11,7 @@ end
require 'mkmf'
require 'fileutils'
libdir = File.basename RbConfig::CONFIG['libdir']
unless File.exists?("#{CWD}/dst/#{libdir}/libmsgpackc.a")
Logging.message "Building msgpack\n"
msgpack = File.basename('msgpack-0.5.7.tar.gz')
dir = File.basename(msgpack, '.tar.gz')
cflags, ldflags = ENV['CFLAGS'], ENV['LDFLAGS']
cc = ENV['CC']
# build fat binaries on osx
if RUBY_PLATFORM =~ /darwin/ and (archs = RbConfig::CONFIG['LDFLAGS'].scan(/(-arch\s+.+?)(?:\s|$)/).flatten).any?
ENV['CFLAGS'] = "#{cflags} #{archs.join(' ')}"
ENV['LDFLAGS'] = "#{ldflags} #{archs.join(' ')}"
end
Dir.chdir('src') do
FileUtils.rm_rf(dir) if File.exists?(dir)
sys("tar zxvf #{msgpack}")
Dir.chdir(dir) do
if RUBY_PLATFORM =~ /i686/ and gcc = `gcc -v 2>&1` and gcc =~ /gcc version (\d\.\d)/ and $1.to_f <= 4.1
ENV['CFLAGS'] = " #{ENV['CFLAGS']} -march=i686 "
end
if RUBY_PLATFORM =~ /darwin/ and File.exist?("/usr/bin/gcc-4.2")
ENV['CC'] = '/usr/bin/gcc-4.2'
end
sys("./configure --disable-dependency-tracking --disable-shared --with-pic --prefix=#{CWD}/dst/ --libdir=#{CWD}/dst/#{libdir}")
sys("make install")
end
end
if cflags or ldflags
ENV['CFLAGS'], ENV['LDFLAGS'] = cflags, ldflags
end
if cc
ENV['CC'] = cc
end
end
FileUtils.cp "#{CWD}/dst/#{libdir}/libmsgpackc.a", "#{CWD}/libmsgpackc_ext.a"
$INCFLAGS[0,0] = "-I#{CWD}/dst/include "
unless have_library('msgpackc_ext') and have_header('msgpack.h')
unless have_library('msgpackc') and have_header('msgpack.h')
raise 'msgpack build failed'
end
......
......@@ -184,8 +184,8 @@ rbtrace__send_event(int nargs, const char *name, ...)
msgpack_pack_array(pk, nargs+1);
msgpack_pack_raw(pk, strlen(name));
msgpack_pack_raw_body(pk, name, strlen(name));
msgpack_pack_bin(pk, strlen(name));
msgpack_pack_bin_body(pk, name, strlen(name));
if (nargs > 0) {
int type;
......@@ -238,8 +238,8 @@ rbtrace__send_event(int nargs, const char *name, ...)
if (!str)
str = (char *)"";
msgpack_pack_raw(pk, strlen(str));
msgpack_pack_raw_body(pk, str, strlen(str));
msgpack_pack_bin(pk, strlen(str));
msgpack_pack_bin_body(pk, str, strlen(str));
break;
default:
......@@ -877,7 +877,7 @@ rbtrace__process_event(msgpack_object cmd)
VALUE val = Qnil;
msgpack_object_array ary;
msgpack_object_raw str;
msgpack_object_bin str;
/* fprintf(stderr, "GOT: ");*/
/* msgpack_object_print(stderr, cmd);*/
......@@ -886,10 +886,10 @@ rbtrace__process_event(msgpack_object cmd)
ary = cmd.via.array;
if (ary.size < 1 ||
ary.ptr[0].type != MSGPACK_OBJECT_RAW)
ary.ptr[0].type != MSGPACK_OBJECT_BIN)
return;
str = ary.ptr[0].via.raw;
str = ary.ptr[0].via.bin;
if (0 == strncmp("attach", str.ptr, str.size)) {
if (ary.size != 2 ||
......@@ -930,11 +930,11 @@ rbtrace__process_event(msgpack_object cmd)
} else if (0 == strncmp("add", str.ptr, str.size)) {
if (ary.size != 3 ||
ary.ptr[1].type != MSGPACK_OBJECT_RAW ||
ary.ptr[1].type != MSGPACK_OBJECT_BIN ||
ary.ptr[2].type != MSGPACK_OBJECT_BOOLEAN)
return;
str = ary.ptr[1].via.raw;
str = ary.ptr[1].via.bin;
bool is_slow = ary.ptr[2].via.boolean;
strncpy(query, str.ptr, str.size);
......@@ -943,10 +943,10 @@ rbtrace__process_event(msgpack_object cmd)
} else if (0 == strncmp("addexpr", str.ptr, str.size)) {
if (ary.size != 2 ||
ary.ptr[1].type != MSGPACK_OBJECT_RAW)
ary.ptr[1].type != MSGPACK_OBJECT_BIN)
return;
str = ary.ptr[1].via.raw;
str = ary.ptr[1].via.bin;
strncpy(query, str.ptr, str.size);
query[str.size] = 0;
......@@ -1006,10 +1006,10 @@ rbtrace__process_event(msgpack_object cmd)
} else if (0 == strncmp("eval", str.ptr, str.size)) {
if (ary.size != 2 ||
ary.ptr[1].type != MSGPACK_OBJECT_RAW)
ary.ptr[1].type != MSGPACK_OBJECT_BIN)
return;
str = ary.ptr[1].via.raw;
str = ary.ptr[1].via.bin;
strncpy(query, str.ptr, str.size);
query[str.size] = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment