diff options
author | Marek Szuba <marecki@gentoo.org> | 2020-11-13 22:51:12 +0100 |
---|---|---|
committer | Marek Szuba <marecki@gentoo.org> | 2020-11-13 22:54:31 +0100 |
commit | b88f37ce277c6d9ea1d55296f723b882addd27ca (patch) | |
tree | 1e06ed10a63fac8679da4fcd03c3bc652179c6ee /dev-ruby/duktape-rb | |
parent | sys-apps/acl: Stabilize 2.2.53-r1 amd64, #753347 (diff) | |
download | gentoo-b88f37ce277c6d9ea1d55296f723b882addd27ca.tar.gz gentoo-b88f37ce277c6d9ea1d55296f723b882addd27ca.tar.bz2 gentoo-b88f37ce277c6d9ea1d55296f723b882addd27ca.zip |
dev-ruby/duktape-rb: use system dev-lang/duktape
Signed-off-by: Marek Szuba <marecki@gentoo.org>
Diffstat (limited to 'dev-ruby/duktape-rb')
-rw-r--r-- | dev-ruby/duktape-rb/duktape-rb-2.3.0.0-r2.ebuild (renamed from dev-ruby/duktape-rb/duktape-rb-2.3.0.0-r1.ebuild) | 22 | ||||
-rw-r--r-- | dev-ruby/duktape-rb/duktape-rb-2.3.0.0.ebuild | 37 | ||||
-rw-r--r-- | dev-ruby/duktape-rb/files/duktape-rb-2.3.0.0_duktape-2.5.0-tests.patch | 28 | ||||
-rw-r--r-- | dev-ruby/duktape-rb/files/duktape-rb-2.3.0.0_use-system-duktape.patch | 79 |
4 files changed, 124 insertions, 42 deletions
diff --git a/dev-ruby/duktape-rb/duktape-rb-2.3.0.0-r1.ebuild b/dev-ruby/duktape-rb/duktape-rb-2.3.0.0-r2.ebuild index f4d010d24aed..aaa03d4381f9 100644 --- a/dev-ruby/duktape-rb/duktape-rb-2.3.0.0-r1.ebuild +++ b/dev-ruby/duktape-rb/duktape-rb-2.3.0.0-r2.ebuild @@ -21,17 +21,29 @@ LICENSE="MIT" SLOT="0" KEYWORDS="~amd64" -# Upstream uses bundled single-source distributable Duktape. -#RDEPEND+="dev-lang/duktape" +RDEPEND+="dev-lang/duktape" ruby_add_bdepend " + dev-ruby/pkg-config dev-ruby/rake-compiler - test? ( - dev-ruby/sdoc - )" + dev-ruby/sdoc +" + +PATCHES=( + "${FILESDIR}"/${PN}-2.3.0.0_duktape-2.5.0-tests.patch + "${FILESDIR}"/${PN}-2.3.0.0_use-system-duktape.patch +) RUBY_S=${MY_P} +all_ruby_prepare() { + rm ext/duktape/duktape.{c,h} ext/duktape/duk_config.h || die "Failed to remove bundled duktape" +} + +each_ruby_configure() { + ${RUBY} -C ext/duktape extconf.rb || die "extconf.rb failed" +} + each_ruby_compile() { ${RUBY} -S rake compile } diff --git a/dev-ruby/duktape-rb/duktape-rb-2.3.0.0.ebuild b/dev-ruby/duktape-rb/duktape-rb-2.3.0.0.ebuild deleted file mode 100644 index ab08a2bf8a6b..000000000000 --- a/dev-ruby/duktape-rb/duktape-rb-2.3.0.0.ebuild +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 1999-2020 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -USE_RUBY="ruby25 ruby26" - -RUBY_FAKEGEM_GEMSPEC="duktape.gemspec" -RUBY_FAKEGEM_NAME="duktape" - -inherit ruby-fakegem - -MY_PN=${PN/-/\.} -MY_P=${MY_PN}-${PV} - -DESCRIPTION="Ruby bindings to the Duktape JavaScript interpeter" -HOMEPAGE="https://github.com/judofyr/duktape.rb" -SRC_URI="https://github.com/judofyr/${MY_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" - -LICENSE="MIT" -SLOT="0" -KEYWORDS="~amd64" - -# Tests require dev-ruby/sdoc, which is currently ~arch-only and fairly limited -# in the number of supported keywords. -RESTRICT="test" - -# Upstream uses bundled single-source distributable Duktape. -#RDEPEND+="dev-lang/duktape" - -ruby_add_bdepend "dev-ruby/rake-compiler" - -RUBY_S=${MY_P} - -each_ruby_compile() { - ${RUBY} -S rake compile -} diff --git a/dev-ruby/duktape-rb/files/duktape-rb-2.3.0.0_duktape-2.5.0-tests.patch b/dev-ruby/duktape-rb/files/duktape-rb-2.3.0.0_duktape-2.5.0-tests.patch new file mode 100644 index 000000000000..20228c480da8 --- /dev/null +++ b/dev-ruby/duktape-rb/files/duktape-rb-2.3.0.0_duktape-2.5.0-tests.patch @@ -0,0 +1,28 @@ +The parse-error message asserted by two of the tests has changed since +duktape-2.3.0, it is now + +# encoding: ASCII-8BIT +parse error (line 1, end of input) + +This should hopefully cover both cases. + +--- a/test/test_duktape.rb ++++ b/test/test_duktape.rb +@@ -102,7 +102,7 @@ + @ctx.eval_string('{') + end + +- assert_equal "parse error (line 1)", err.message ++ assert_match /parse error [(]line 1/, err.message + end + + def test_type_error +@@ -160,7 +160,7 @@ + @ctx.exec_string('{') + end + +- assert_equal "parse error (line 1)", err.message ++ assert_match /parse error [(]line 1/, err.message + end + + def test_type_error diff --git a/dev-ruby/duktape-rb/files/duktape-rb-2.3.0.0_use-system-duktape.patch b/dev-ruby/duktape-rb/files/duktape-rb-2.3.0.0_use-system-duktape.patch new file mode 100644 index 000000000000..9f35293c9e81 --- /dev/null +++ b/dev-ruby/duktape-rb/files/duktape-rb-2.3.0.0_use-system-duktape.patch @@ -0,0 +1,79 @@ +--- a/MANIFEST.txt ++++ b/MANIFEST.txt +@@ -1,9 +1,6 @@ + README.md + CHANGELOG.md +-ext/duktape/duktape.c +-ext/duktape/duktape.h + ext/duktape/duktape_ext.c +-ext/duktape/duk_config.h + ext/duktape/extconf.rb + lib/duktape/version.rb + lib/duktape.rb +--- a/ext/duktape/extconf.rb ++++ b/ext/duktape/extconf.rb +@@ -1,6 +1,64 @@ + require 'mkmf' + require 'zlib' + ++# ++# functions ++# ++ ++def package_config pkg, options={} ++ package = pkg_config(pkg) ++ return package if package ++ ++ begin ++ require 'rubygems' ++ gem 'pkg-config', (gem_ver='~> 1.1') ++ require 'pkg-config' and message("Using pkg-config gem version #{PKGConfig::VERSION}\n") ++ rescue LoadError ++ message "pkg-config could not be used to find #{pkg}\nPlease install either `pkg-config` or the pkg-config gem per\n\n gem install pkg-config -v #{gem_ver.inspect}\n\n" ++ else ++ return nil unless PKGConfig.have_package(pkg) ++ ++ cflags = PKGConfig.cflags(pkg) ++ ldflags = PKGConfig.libs_only_L(pkg) ++ libs = PKGConfig.libs_only_l(pkg) ++ ++ Logging::message "PKGConfig package configuration for %s\n", pkg ++ Logging::message "cflags: %s\nldflags: %s\nlibs: %s\n\n", cflags, ldflags, libs ++ ++ [cflags, ldflags, libs] ++ end ++end ++ ++def duktape_try_compile ++ try_compile "int main() {return 0;}", "", {werror: true} ++end ++ ++def add_cflags(flags) ++ print "checking if the C compiler accepts #{flags}... " ++ with_cflags("#{$CFLAGS} #{flags}") do ++ if duktape_try_compile ++ puts 'yes' ++ true ++ else ++ puts 'no' ++ false ++ end ++ end ++end ++ ++# ++# main ++# ++ ++if ENV['CC'] ++ RbConfig::CONFIG['CC'] = RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] ++end ++$LIBS << " #{ENV["LIBS"]}" ++$LDFLAGS << " #{ENV["LDFLAGS"]}" ++add_cflags(ENV["CFLAGS"]) ++ ++package_config('duktape') ++ + $CFLAGS += ' -std=c99' + have_func 'rb_sym2str' + create_makefile 'duktape_ext' |