From 35c198a3fb203eef3d7c89bf54667b5b2e0aef57 Mon Sep 17 00:00:00 2001 From: ignisf Date: Sun, 6 Jan 2013 11:58:14 +0200 Subject: [PATCH] Add no-strict-aliasing to FreeBSD/gcc42 builds Remove the patch that was not getting applied on rake build on a buildhost and add a conditional make flag in builder.rb. This commit fixes #68 --- Rakefile | 1 - ext/libv8/builder.rb | 5 ++++- patches/gcc42-on-freebsd.patch | 14 -------------- 3 files changed, 4 insertions(+), 16 deletions(-) delete mode 100644 patches/gcc42-on-freebsd.patch diff --git a/Rakefile b/Rakefile index ebd3641..052db0f 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" diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 33ac22b..a7671ee 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -11,8 +11,11 @@ module Libv8 def build_libv8! profile = enable_config('debug') ? 'debug' : 'release' + gypflags = ["-Dhost_arch=#{libv8_arch}"] + gypflags << "-Dv8_no_strict_aliasing=1" if RUBY_PLATFORM.include?("freebsd") && !check_gcc_compiler(compiler) + 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} #{libv8_arch}.#{profile} GYPFLAGS="#{gypflags.join ' '}"` end return $?.exitstatus end diff --git a/patches/gcc42-on-freebsd.patch b/patches/gcc42-on-freebsd.patch deleted file mode 100644 index c353c27..0000000 --- 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' ], - }],