diff options
Diffstat (limited to 'meta-ruby/classes/ruby.bbclass')
-rw-r--r-- | meta-ruby/classes/ruby.bbclass | 131 |
1 files changed, 0 insertions, 131 deletions
diff --git a/meta-ruby/classes/ruby.bbclass b/meta-ruby/classes/ruby.bbclass deleted file mode 100644 index 1acf2e0bd2..0000000000 --- a/meta-ruby/classes/ruby.bbclass +++ /dev/null | |||
@@ -1,131 +0,0 @@ | |||
1 | BPV ?= "${PV}" | ||
2 | |||
3 | DEPENDS += " \ | ||
4 | ruby-native \ | ||
5 | " | ||
6 | RDEPENDS_${PN} += " \ | ||
7 | ruby \ | ||
8 | " | ||
9 | |||
10 | def get_rubyversion(p): | ||
11 | import re | ||
12 | from os.path import isfile | ||
13 | import subprocess | ||
14 | found_version = "SOMETHING FAILED!" | ||
15 | |||
16 | cmd = "%s/ruby" % p | ||
17 | |||
18 | if not isfile(cmd): | ||
19 | return found_version | ||
20 | |||
21 | version = subprocess.Popen([cmd, "--version"], stdout=subprocess.PIPE).communicate()[0].decode("utf-8") | ||
22 | |||
23 | r = re.compile("ruby ([0-9]+\.[0-9]+\.[0-9]+)*") | ||
24 | m = r.match(version) | ||
25 | if m: | ||
26 | found_version = m.group(1) | ||
27 | |||
28 | return found_version | ||
29 | |||
30 | def get_rubygemslocation(p): | ||
31 | import re | ||
32 | from os.path import isfile | ||
33 | import subprocess | ||
34 | found_loc = "SOMETHING FAILED!" | ||
35 | |||
36 | cmd = "%s/gem" % p | ||
37 | |||
38 | if not isfile(cmd): | ||
39 | return found_loc | ||
40 | |||
41 | loc = subprocess.Popen([cmd, "env"], stdout=subprocess.PIPE).communicate()[0].decode("utf-8") | ||
42 | |||
43 | r = re.compile(".*\- (/usr.*/ruby/gems/.*)") | ||
44 | for line in loc.split('\n'): | ||
45 | m = r.match(line) | ||
46 | if m: | ||
47 | found_loc = m.group(1) | ||
48 | break | ||
49 | |||
50 | return found_loc | ||
51 | |||
52 | def get_rubygemsversion(p): | ||
53 | import re | ||
54 | from os.path import isfile | ||
55 | import subprocess | ||
56 | found_version = "SOMETHING FAILED!" | ||
57 | |||
58 | cmd = "%s/gem" % p | ||
59 | |||
60 | if not isfile(cmd): | ||
61 | return found_version | ||
62 | |||
63 | version = subprocess.Popen([cmd, "env", "gemdir"], stdout=subprocess.PIPE).communicate()[0].decode("utf-8") | ||
64 | |||
65 | r = re.compile(".*([0-9]+\.[0-9]+\.[0-9]+)$") | ||
66 | m = r.match(version) | ||
67 | if m: | ||
68 | found_version = m.group(1) | ||
69 | |||
70 | return found_version | ||
71 | |||
72 | RUBY_VERSION ?= "${@get_rubyversion("${STAGING_BINDIR_NATIVE}")}" | ||
73 | RUBY_GEM_DIRECTORY ?= "${@get_rubygemslocation("${STAGING_BINDIR_NATIVE}")}" | ||
74 | RUBY_GEM_VERSION ?= "${@get_rubygemsversion("${STAGING_BINDIR_NATIVE}")}" | ||
75 | |||
76 | export GEM_HOME = "${STAGING_DIR_NATIVE}/usr/lib/ruby/gems/${RUBY_GEM_VERSION}" | ||
77 | |||
78 | RUBY_BUILD_GEMS ?= "${BPN}.gemspec" | ||
79 | RUBY_INSTALL_GEMS ?= "${BPN}-${BPV}.gem" | ||
80 | |||
81 | RUBY_COMPILE_FLAGS ?= 'LANG="en_US.UTF-8" LC_ALL="en_US.UTF-8"' | ||
82 | |||
83 | ruby_do_compile() { | ||
84 | for gem in ${RUBY_BUILD_GEMS}; do | ||
85 | ${RUBY_COMPILE_FLAGS} gem build $gem | ||
86 | done | ||
87 | } | ||
88 | |||
89 | |||
90 | ruby_do_install() { | ||
91 | for gem in ${RUBY_INSTALL_GEMS}; do | ||
92 | gem install --ignore-dependencies --local --env-shebang --install-dir ${D}/${libdir}/ruby/gems/${RUBY_GEM_VERSION}/ $gem | ||
93 | done | ||
94 | |||
95 | # create symlink from the gems bin directory to /usr/bin | ||
96 | for i in ${D}/${libdir}/ruby/gems/${RUBY_GEM_VERSION}/bin/*; do | ||
97 | if [ -e "$i" ]; then | ||
98 | if [ ! -d ${D}/${bindir} ]; then mkdir -p ${D}/${bindir}; fi | ||
99 | b=`basename $i` | ||
100 | ln -sf ${libdir}/ruby/gems/${RUBY_GEM_VERSION}/bin/$b ${D}/${bindir}/$b | ||
101 | fi | ||
102 | done | ||
103 | } | ||
104 | |||
105 | EXPORT_FUNCTIONS do_compile do_install | ||
106 | |||
107 | PACKAGES = "${PN}-dbg ${PN} ${PN}-doc ${PN}-dev" | ||
108 | |||
109 | FILES_${PN}-dbg += " \ | ||
110 | ${libdir}/ruby/gems/${RUBY_GEM_VERSION}/gems/*/*/.debug \ | ||
111 | ${libdir}/ruby/gems/${RUBY_GEM_VERSION}/gems/*/*/*/.debug \ | ||
112 | ${libdir}/ruby/gems/${RUBY_GEM_VERSION}/gems/*/*/*/*/.debug \ | ||
113 | ${libdir}/ruby/gems/${RUBY_GEM_VERSION}/gems/*/*/*/*/*/.debug \ | ||
114 | ${libdir}/ruby/gems/${RUBY_GEM_VERSION}/extensions/*/*/.debug \ | ||
115 | ${libdir}/ruby/gems/${RUBY_GEM_VERSION}/extensions/*/*/*/.debug \ | ||
116 | ${libdir}/ruby/gems/${RUBY_GEM_VERSION}/extensions/*/*/*/*/.debug \ | ||
117 | ${libdir}/ruby/gems/${RUBY_GEM_VERSION}/extensions/*/*/*/*/*/.debug \ | ||
118 | " | ||
119 | |||
120 | FILES_${PN} += " \ | ||
121 | ${libdir}/ruby/gems/${RUBY_GEM_VERSION}/gems \ | ||
122 | ${libdir}/ruby/gems/${RUBY_GEM_VERSION}/cache \ | ||
123 | ${libdir}/ruby/gems/${RUBY_GEM_VERSION}/bin \ | ||
124 | ${libdir}/ruby/gems/${RUBY_GEM_VERSION}/specifications \ | ||
125 | ${libdir}/ruby/gems/${RUBY_GEM_VERSION}/build_info \ | ||
126 | ${libdir}/ruby/gems/${RUBY_GEM_VERSION}/extensions \ | ||
127 | " | ||
128 | |||
129 | FILES_${PN}-doc += " \ | ||
130 | ${libdir}/ruby/gems/${RUBY_GEM_VERSION}/doc \ | ||
131 | " | ||