diff --git a/Rakefile b/Rakefile index cd3b7fda..259ef07a 100644 --- a/Rakefile +++ b/Rakefile @@ -28,7 +28,6 @@ task :checkout do # Based on: https://chromiumcodereview.appspot.com/10079030/patch/1/2 sh "patch -N -p0 -d vendor/v8 < patches/add-freebsd9-and-freebsd10-to-gyp-GetFlavor.patch" sh "patch -N -p1 -d vendor/v8 < patches/fPIC-on-x64.patch" - sh "patch -N -p1 -d vendor/v8 < patches/gcc42-on-freebsd.patch" if RUBY_PLATFORM.include?("freebsd") && !system("pkg_info | grep gcc-4") end desc "compile v8 via the ruby extension mechanism" @@ -42,7 +41,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 GYPFLAGS="-Dhost_arch=#{libv8_arch}"} + sh %Q{#{make} -j2 #{libv8_arch}.release} end end diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 33ac22b7..3689c22f 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -1,3 +1,4 @@ +require 'mkmf' require File.expand_path '../compiler', __FILE__ require File.expand_path '../arch', __FILE__ require File.expand_path '../make', __FILE__ @@ -8,11 +9,20 @@ class Builder include Libv8::Compiler include Libv8::Make - def build_libv8! + def make_flags(*flags) profile = enable_config('debug') ? 'debug' : 'release' + # FreeBSD uses gcc 4.2 by default which leads to + # compilation failures due to warnings about aliasing. + # http://svnweb.freebsd.org/ports/head/lang/v8/Makefile?view=markup + flags << "strictaliasing=off" if RUBY_PLATFORM.include?("freebsd") and !check_gcc_compiler(compiler) + + "#{libv8_arch}.#{profile} #{flags.join ' '}" + end + + def build_libv8! Dir.chdir(File.expand_path '../../../vendor/v8', __FILE__) do - puts `env CXX=#{compiler} LINK=#{compiler} #{make} #{libv8_arch}.#{profile} GYPFLAGS="-Dhost_arch=#{libv8_arch}"` + puts `env CXX=#{compiler} LINK=#{compiler} #{make} #{make_flags}` end return $?.exitstatus end diff --git a/lib/libv8/fpic-on-freebsd-amd64.patch b/lib/libv8/fpic-on-freebsd-amd64.patch deleted file mode 100644 index b5a7c39b..00000000 --- a/lib/libv8/fpic-on-freebsd-amd64.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/SConstruct b/SConstruct -index 4a7e182..b462335 100644 ---- a/SConstruct -+++ b/SConstruct -@@ -124,6 +124,10 @@ LIBRARY_FLAGS = { - 'LIBPATH' : ['/usr/local/lib'], - 'CCFLAGS': ['-ansi'], -- 'LIBS': ['execinfo'] -+ 'LIBS': ['execinfo'], -+ 'arch:x64': { -+ 'CCFLAGS': ['-fPIC'], -+ 'CXXFLAGS': ['-fPIC'] -+ }, - }, - 'os:openbsd': { - 'CPPPATH' : ['/usr/local/include'], diff --git a/patches/gcc42-on-freebsd.patch b/patches/gcc42-on-freebsd.patch deleted file mode 100644 index c353c27d..00000000 --- a/patches/gcc42-on-freebsd.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/build/standalone.gypi b/build/standalone.gypi -index ebdf557..c7a59bc 100644 ---- a/build/standalone.gypi -+++ b/build/standalone.gypi -@@ -98,6 +98,9 @@ - [ 'OS=="linux"', { - 'cflags': [ '-ansi' ], - }], -+ [ 'OS=="freebsd"', { -+ 'cflags': [ '-fno-strict-aliasing', ], -+ }], - [ 'visibility=="hidden"', { - 'cflags': [ '-fvisibility=hidden' ], - }], diff --git a/patches/src_platform-freebsd.cc.patch b/patches/src_platform-freebsd.cc.patch deleted file mode 100644 index adc671eb..00000000 --- a/patches/src_platform-freebsd.cc.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- src/platform-freebsd.cc.orig 2012-05-12 16:47:50.556202492 +0100 -+++ src/platform-freebsd.cc 2012-05-12 16:37:59.924934272 +0100 -@@ -554,6 +554,7 @@ - ASSERT(result == 0); - result = pthread_mutex_init(&mutex_, &attrs); - ASSERT(result == 0); -+ USE(result); - } - - virtual ~FreeBSDMutex() { pthread_mutex_destroy(&mutex_); }