diff options
| author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2024-10-11 19:44:36 +0000 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2024-10-11 20:14:43 +0000 |
| commit | dc37ea052ed74321c5244938f8d702372f663776 (patch) | |
| tree | 5b561ff383ef5c358a181e99788aef9acd00ef29 /classes/ruby.bbclass | |
| parent | 4f7788bbebe80f1c6b13bd3bc2db875e900bfa29 (diff) | |
| download | meta-cloud-services-dc37ea052ed74321c5244938f8d702372f663776.tar.gz | |
ruby/rubyv2: add new rubyv2 bbclass and support external extconf
When building/installing gems with native components, the target
OS and cross compile settings were not correctly being picked up.
Enhance the existing bbclass with the ability to copy a extconf.rb
from UNPACKDIR, so a recipe can specify fixes in it's own copy of
the file.
We also bring in a class from meta-rubygems which has more advanced
cross compile settings. There are a few minor modifications to
this class (copying of extconf.rb) and some spec generation. But
it is now available if the basic ruby class cannot compile and install
a gem.
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'classes/ruby.bbclass')
| -rw-r--r-- | classes/ruby.bbclass | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/classes/ruby.bbclass b/classes/ruby.bbclass index 384ece9..eb19e37 100644 --- a/classes/ruby.bbclass +++ b/classes/ruby.bbclass | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | # | 1 | # |
| 2 | # Copyright (C) 2014 Wind River Systems, Inc. | 2 | # Copyright (C) 2014 Wind River Systems, Inc. |
| 3 | # Copyright (c) 2024 Bruce Ashfield, Inc. | ||
| 3 | # | 4 | # |
| 4 | DEPENDS += " \ | 5 | DEPENDS += " \ |
| 5 | ruby-native \ | 6 | ruby-native \ |
| @@ -24,7 +25,7 @@ def get_rubyversion(p): | |||
| 24 | return found_version | 25 | return found_version |
| 25 | 26 | ||
| 26 | version = subprocess.Popen([cmd, "--version"], stdout=subprocess.PIPE).communicate()[0] | 27 | version = subprocess.Popen([cmd, "--version"], stdout=subprocess.PIPE).communicate()[0] |
| 27 | 28 | ||
| 28 | r = re.compile("ruby ([0-9]+\.[0-9]+\.[0-9]+)*") | 29 | r = re.compile("ruby ([0-9]+\.[0-9]+\.[0-9]+)*") |
| 29 | m = r.match(version) | 30 | m = r.match(version) |
| 30 | if m: | 31 | if m: |
| @@ -66,7 +67,7 @@ def get_rubygemsversion(p): | |||
| 66 | return found_version | 67 | return found_version |
| 67 | 68 | ||
| 68 | version = subprocess.Popen([cmd, "env", "gemdir"], stdout=subprocess.PIPE).communicate()[0] | 69 | version = subprocess.Popen([cmd, "env", "gemdir"], stdout=subprocess.PIPE).communicate()[0] |
| 69 | 70 | ||
| 70 | r = re.compile(".*([0-9]+\.[0-9]+\.[0-9]+)$") | 71 | r = re.compile(".*([0-9]+\.[0-9]+\.[0-9]+)$") |
| 71 | m = r.match(version.decode("utf-8")) | 72 | m = r.match(version.decode("utf-8")) |
| 72 | if m: | 73 | if m: |
| @@ -108,6 +109,11 @@ EOF | |||
| 108 | } | 109 | } |
| 109 | 110 | ||
| 110 | ruby_do_compile() { | 111 | ruby_do_compile() { |
| 112 | if [ -f ${UNPACKDIR}/extconf.rb ]; then | ||
| 113 | cp extconf.rb extconf.orig | ||
| 114 | cp ${UNPACKDIR}/extconf.rb extconf.rb | ||
| 115 | fi | ||
| 116 | |||
| 111 | if [ -f extconf.rb -a ! -f extconf.rb.orig ] ; then | 117 | if [ -f extconf.rb -a ! -f extconf.rb.orig ] ; then |
| 112 | grep create_makefile extconf.rb > append2 || (exit 0) | 118 | grep create_makefile extconf.rb > append2 || (exit 0) |
| 113 | ruby_gen_extconf_fix | 119 | ruby_gen_extconf_fix |
| @@ -164,3 +170,20 @@ FILES:${PN} += " \ | |||
| 164 | FILES:${PN}-doc += " \ | 170 | FILES:${PN}-doc += " \ |
| 165 | ${libdir}/ruby/gems/${RUBY_GEM_VERSION}/doc \ | 171 | ${libdir}/ruby/gems/${RUBY_GEM_VERSION}/doc \ |
| 166 | " | 172 | " |
| 173 | |||
| 174 | # copied from rubyv2.bbclass | ||
| 175 | |||
| 176 | # the ruby dynamic linker just uses plain .so files | ||
| 177 | # so we have to supply symlinks as part of the base package | ||
| 178 | INSANE_SKIP:${PN} += "dev-so" | ||
| 179 | # sadly the shared objects also contain some hard coded | ||
| 180 | # host paths, which are not easy to be removed | ||
| 181 | INSANE_SKIP:${PN} += "buildpaths" | ||
| 182 | # we don't care what is actually needed for the dev-package | ||
| 183 | INSANE_SKIP:${PN}-dev += "file-rdeps" | ||
| 184 | # same issue for the dev package with buildpaths | ||
| 185 | INSANE_SKIP:${PN}-dev += "buildpaths" | ||
| 186 | # some of the doc utils contain host specific full paths | ||
| 187 | # as they are mostly in binary format we are just going to | ||
| 188 | # ignore it here | ||
| 189 | INSANE_SKIP:${PN}-doc += "buildpaths" | ||
