Skip to content

Commit

Permalink
Merge pull request rubyjs#73 from cowboyd/thick-archives
Browse files Browse the repository at this point in the history
Linking against libv8 fails with a 'Malformed archive' error
  • Loading branch information
cowboyd committed Jan 9, 2013
2 parents 7503cda + 8550399 commit acdccee
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
6 changes: 5 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ task :checkout do
sh "git checkout #{V8_Version} -f"
sh "#{make} dependencies"
end

# The -fPIC flag is necessary when linking a shared library
# against the static libv8 on x86_64.
sh "patch -N -p1 -d vendor/v8 < patches/fPIC-on-x64.patch"
end

desc "compile v8 via the ruby extension mechanism"
Expand All @@ -36,7 +40,7 @@ task :manual_compile do
require File.expand_path '../ext/libv8/arch.rb', __FILE__
include Libv8::Arch
Dir.chdir(V8_Source) do
sh %Q{#{make} -j2 #{libv8_arch}.release}
sh %Q{#{make} -j2 #{libv8_arch}.release ARFLAGS.target=crs}
end
end

Expand Down
4 changes: 4 additions & 0 deletions ext/libv8/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ def make_flags(*flags)
# http://svnweb.freebsd.org/ports/head/lang/v8/Makefile?view=markup
flags << "strictaliasing=off" if RUBY_PLATFORM.include?("freebsd") and !check_gcc_compiler(compiler)

# Fix Malformed archive issue caused by GYP creating thin archives by
# default.
flags << "ARFLAGS.target=crs"

"#{libv8_arch}.#{profile} #{flags.join ' '}"
end

Expand Down
11 changes: 0 additions & 11 deletions patches/add-freebsd9-and-freebsd10-to-gyp-GetFlavor.patch

This file was deleted.

2 changes: 1 addition & 1 deletion vendor/v8
Submodule v8 updated 676 files

0 comments on commit acdccee

Please sign in to comment.