libv8: fix compilation bug, paths, unmask

This commit is contained in:
blshkv 2018-07-22 15:00:43 +08:00
parent 0cf421b7b2
commit bb7595ae33
No known key found for this signature in database
GPG key ID: 273E3E90D1A6294F
3 changed files with 71 additions and 13 deletions

View file

@ -0,0 +1,35 @@
--- ext/libv8/builder.rb.orig 2018-07-22 08:46:32.555026647 +0800
+++ ext/libv8/builder.rb 2018-07-22 08:47:19.588029204 +0800
@@ -22,6 +22,9 @@
end
def make_flags(*flags)
+
+ flags << "snapshot=off"
+
# 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
--- ext/libv8/paths.rb.orig 2018-07-22 09:16:24.477124058 +0800
+++ ext/libv8/paths.rb 2018-07-22 09:24:22.528150045 +0800
@@ -11,7 +11,7 @@
end
def object_paths
- [libv8_object(:base), libv8_object(:snapshot)].map do |path|
+ [libv8_object(:base), libv8_object(:nosnapshot)].map do |path|
Shellwords.escape path
end
end
--- spec/location_spec.rb.orig 2018-07-22 08:46:32.558026647 +0800
+++ spec/location_spec.rb 2018-07-22 09:01:37.475075840 +0800
@@ -64,7 +64,7 @@
end
it "prepends the locations of any libv8 objects on the the ldflags" do
- @context.ldflags.should eql "/foo\\ bar/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a /foo\\ bar/v8/out/x64.release/obj.target/tools/gyp/libv8_snapshot.a -lobjc -lpthread"
+ @context.ldflags.should eql "/foo\\ bar/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a /foo\\ bar/v8/out/x64.release/obj.target/tools/gyp/libv8_nosnapshot.a -lobjc -lpthread"
end
end
end

View file

@ -5,26 +5,39 @@ EAPI=6
USE_RUBY="ruby23 ruby24 ruby25"
RUBY_FAKEGEM_GEMSPEC="libv8.gemspec"
inherit ruby-fakegem
DESCRIPTION="Distributes the V8 JavaScript engine in binary and source forms"
HOMEPAGE="http://github.com/cowboyd/libv8"
HOMEPAGE="https://github.com/cowboyd/libv8"
SRC_URI="mirror://rubygems/${P}.gem"
LICENSE="MIT"
SLOT="0"
#fails to compile: segmentation fault, gcc bug?
#KEYWORDS="~amd64 ~x86"
KEYWORDS="~amd64 ~x86"
IUSE=""
all_ruby_prepare() {
#fix mksnapshot segmentation fault
epatch "${FILESDIR}/libv8-nosnapshot.patch"
}
each_ruby_configure() {
#dev-lang/v8 can by used here potentially
# ${RUBY} -C ext/libv8 extconf.rb --with-system-v8 || die "extconf failed"
${RUBY} -C ext/libv8 extconf.rb || die "extconf failed"
}
each_ruby_compile() {
emake V=1 -C ext/libv8
# cp ext/libv8/libv8$(get_modname) lib/libv8 || die "cp failed"
each_ruby_install() {
each_fakegem_install
insinto $(ruby_fakegem_gemsdir)/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/ext/libv8/
doins ext/libv8/{.location.yml,arch.rb,location.rb,paths.rb}
insinto $(ruby_fakegem_gemsdir)/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/vendor/v8/out/x64.release/obj.target/tools/gyp/
doins vendor/v8/out/x64.release/obj.target/tools/gyp/*.a
insinto $(ruby_fakegem_gemsdir)/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/vendor/v8/
doins -r vendor/v8/include/
}

View file

@ -5,10 +5,12 @@ EAPI=6
USE_RUBY="ruby23 ruby24 ruby25"
RUBY_FAKEGEM_GEMSPEC="libv8.gemspec"
inherit ruby-fakegem
DESCRIPTION="Distributes the V8 JavaScript engine in binary and source forms"
HOMEPAGE="http://github.com/cowboyd/libv8"
HOMEPAGE="http2://github.com/cowboyd/libv8"
SRC_URI="mirror://rubygems/${P}.gem"
LICENSE="MIT"
@ -22,8 +24,16 @@ each_ruby_configure() {
${RUBY} -C ext/libv8 extconf.rb || die "extconf failed"
}
each_ruby_compile() {
einfo "COMPILING"
emake V=1 -C ext/libv8
# cp ext/libv8/libv8$(get_modname) lib/libv8 || die "cp failed"
each_ruby_install() {
each_fakegem_install
insinto $(ruby_fakegem_gemsdir)/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/ext/libv8/
doins ext/libv8/{.location.yml,location.rb,paths.rb}
insinto $(ruby_fakegem_gemsdir)/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/vendor/v8/out.gn/libv8/obj/
doins vendor/v8/out.gn/libv8/obj/*.a
insinto $(ruby_fakegem_gemsdir)/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/vendor/v8/
doins -r vendor/v8/include/
}