diff --git a/Rakefile b/Rakefile index 6fcdef43..9c41bff6 100644 --- a/Rakefile +++ b/Rakefile @@ -27,7 +27,8 @@ task :checkout do # Fix gyp trying to build platform-linux on FreeBSD 9 and FreeBSD 10. # 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-linux-x64.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/patches/fPIC-on-x64.patch b/patches/fPIC-on-x64.patch new file mode 100644 index 00000000..975314b5 --- /dev/null +++ b/patches/fPIC-on-x64.patch @@ -0,0 +1,14 @@ +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=="linux" or OS=="freebsd") and v8_target_arch=="x64" and component=="static_library"', { ++ 'cflags': [ '-fPIC' ], ++ }], + [ 'visibility=="hidden"', { + 'cflags': [ '-fvisibility=hidden' ], + }], diff --git a/patches/fPIC-on-linux-x64.patch b/patches/gcc42-on-freebsd.patch similarity index 74% rename from patches/fPIC-on-linux-x64.patch rename to patches/gcc42-on-freebsd.patch index 44d82e0e..c353c27d 100644 --- a/patches/fPIC-on-linux-x64.patch +++ b/patches/gcc42-on-freebsd.patch @@ -6,8 +6,8 @@ index ebdf557..c7a59bc 100644 [ 'OS=="linux"', { 'cflags': [ '-ansi' ], }], -+ [ 'OS=="linux" and v8_target_arch=="x64" and component=="static_library"', { -+ 'cflags': [ '-fPIC', ], ++ [ 'OS=="freebsd"', { ++ 'cflags': [ '-fno-strict-aliasing', ], + }], [ 'visibility=="hidden"', { 'cflags': [ '-fvisibility=hidden' ],