blob: 481fe7c23d8b317d4ad5fb3c75d08bd0c81a91d2 [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001SUMMARY = "An interpreter of object-oriented scripting language"
2DESCRIPTION = "Ruby is an interpreted scripting language for quick \
3and easy object-oriented programming. It has many features to process \
4text files and to do system management tasks (as in Perl). \
5It is simple, straight-forward, and extensible. \
6"
7HOMEPAGE = "http://www.ruby-lang.org/"
8SECTION = "devel/ruby"
9LICENSE = "Ruby | BSD-2-Clause | BSD-3-Clause | GPL-2.0-only | ISC | MIT"
10LIC_FILES_CHKSUM = "file://COPYING;md5=5b8c87559868796979806100db3f3805 \
11 file://BSDL;md5=8b50bc6de8f586dc66790ba11d064d75 \
12 file://GPL;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060013 file://LEGAL;md5=bcd74b47bbaf2051c5e49811a5faa97a \
Andrew Geissler517393d2023-01-13 08:55:19 -060014 "
15
16DEPENDS = "zlib openssl libyaml gdbm readline libffi"
17DEPENDS:append:class-target = " ruby-native"
18DEPENDS:append:class-nativesdk = " ruby-native"
19
20SHRT_VER = "${@oe.utils.trim_version("${PV}", 2)}"
21SRC_URI = "http://cache.ruby-lang.org/pub/ruby/${SHRT_VER}/ruby-${PV}.tar.gz \
22 file://0001-extmk-fix-cross-compilation-of-external-gems.patch \
23 file://0002-Obey-LDFLAGS-for-the-link-of-libruby.patch \
24 file://remove_has_include_macros.patch \
25 file://run-ptest \
26 file://0001-template-Makefile.in-do-not-write-host-cross-cc-item.patch \
27 file://0002-template-Makefile.in-filter-out-f-prefix-map.patch \
28 file://0003-rdoc-build-reproducible-documentation.patch \
29 file://0004-lib-mkmf.rb-sort-list-of-object-files-in-generated-M.patch \
30 file://0005-Mark-Gemspec-reproducible-change-fixing-784225-too.patch \
31 file://0006-Make-gemspecs-reproducible.patch \
32 file://0001-vm_dump.c-Define-REG_S1-and-REG_S2-for-musl-riscv.patch \
Andrew Geisslerc5535c92023-01-27 16:10:19 -060033 file://0001-fiddle-Use-C11-_Alignof-to-define-ALIGN_OF-when-poss.patch \
Andrew Geissler517393d2023-01-13 08:55:19 -060034 "
35UPSTREAM_CHECK_URI = "https://www.ruby-lang.org/en/downloads/"
36
37inherit autotools ptest pkgconfig
38
39
40# This snippet lets compiled extensions which rely on external libraries,
41# such as zlib, compile properly. If we don't do this, then when extmk.rb
42# runs, it uses the native libraries instead of the target libraries, and so
43# none of the linking operations succeed -- which makes extconf.rb think
44# that the libraries aren't available and hence that the extension can't be
45# built.
46
47do_configure:prepend() {
48 sed -i "s#%%TARGET_CFLAGS%%#$CFLAGS#; s#%%TARGET_LDFLAGS%%#$LDFLAGS#" ${S}/common.mk
49 rm -rf ${S}/ruby/
50}
51
52DEPENDS:append:libc-musl = " libucontext"
53
Patrick Williams8e7b46e2023-05-01 14:19:06 -050054SRC_URI[sha256sum] = "96c57558871a6748de5bc9f274e93f4b5aad06cd8f37befa0e8d94e7b8a423bc"
Andrew Geissler517393d2023-01-13 08:55:19 -060055
56PACKAGECONFIG ??= ""
57PACKAGECONFIG += "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}"
58
59PACKAGECONFIG[valgrind] = "--with-valgrind=yes, --with-valgrind=no, valgrind"
60PACKAGECONFIG[gmp] = "--with-gmp=yes, --with-gmp=no, gmp"
61PACKAGECONFIG[ipv6] = "--enable-ipv6, --disable-ipv6,"
62# rdoc is off by default due to non-reproducibility reported in
63# https://bugs.ruby-lang.org/issues/18456
64PACKAGECONFIG[rdoc] = "--enable-install-rdoc,--disable-install-rdoc,"
65
66EXTRA_OECONF = "\
67 --disable-versioned-paths \
68 --disable-rpath \
69 --disable-dtrace \
70 --enable-shared \
71 --enable-load-relative \
72 --with-pkg-config=pkg-config \
73 --with-static-linked-ext \
74"
75
76EXTRA_OECONF:append:libc-musl = "\
77 ac_cv_func_isnan=yes \
78 ac_cv_func_isinf=yes \
79"
80
81PARALLEL_MAKEINST = ""
82
83do_install:append:class-target () {
84 # Find out rbconfig.rb from .installed.list
85 rbconfig_rb=`grep rbconfig.rb ${B}/.installed.list`
86 # Remove build host directories
87 sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' \
88 -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \
89 -e 's|${DEBUG_PREFIX_MAP}||g' \
90 -e 's:${HOSTTOOLS_DIR}/::g' \
91 -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
92 -e 's:${RECIPE_SYSROOT}::g' \
93 -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
94 ${D}$rbconfig_rb
95
96 sed -i -e 's|${DEBUG_PREFIX_MAP}||g' \
97 ${D}${libdir}/pkgconfig/*.pc
98
99 # logs that may contain host-specific paths
100 find ${D} -name gem_make.out -delete
101}
102
103do_install_ptest () {
104 cp -rf ${S}/test ${D}${PTEST_PATH}/
105
106 install -D ${S}/tool/test/runner.rb ${D}${PTEST_PATH}/tool/test/runner.rb
107 cp -r ${S}/tool/lib ${D}${PTEST_PATH}/tool/
108 mkdir -p ${D}${PTEST_PATH}/lib
109 cp -r ${S}/lib/did_you_mean ${S}/lib/rdoc ${D}${PTEST_PATH}/lib
110
111 # install test-binaries
112 # These .so files have sporadic reproducibility fails as seen here:
113 # https://autobuilder.yocto.io/pub/repro-fail/oe-reproducible-20220107-rm1diuww/packages/diff-html/
114 # As they are needed only in ruby-ptest, and that is currently altogether disabled, let's take them out.
115 # If someone wants to look at where the non-determinism comes from, one possible reason is use of
116 # -rdynamic -Wl,-export-dynamic
117 #find $(find ./.ext -path '*/-test-') -name '*.so' -print0 \
118 # | tar --no-recursion --null -T - --no-same-owner --preserve-permissions -cf - \
119 # | tar -C ${D}${libdir}/ruby/${SHRT_VER}.0/ --no-same-owner --preserve-permissions --strip-components=2 -xf -
120 # adjust path to not assume build directory layout
121 sed -e 's|File.expand_path(.*\.\./bin/erb[^)]*|File.expand_path("${bindir}/erb"|g' \
122 -i ${D}${PTEST_PATH}/test/erb/test_erb_command.rb
123
124 cp -r ${S}/include ${D}/${libdir}/ruby/
125}
126
127PACKAGES =+ "${PN}-ri-docs ${PN}-rdoc"
128
129SUMMARY:${PN}-ri-docs = "ri (Ruby Interactive) documentation for the Ruby standard library"
130RDEPENDS:${PN}-ri-docs = "${PN}"
131FILES:${PN}-ri-docs += "${datadir}/ri"
132
133SUMMARY:${PN}-rdoc = "RDoc documentation generator from Ruby source"
134RDEPENDS:${PN}-rdoc = "${PN}"
135FILES:${PN}-rdoc += "${libdir}/ruby/*/rdoc ${bindir}/rdoc"
136
137FILES:${PN} += "${datadir}/rubygems"
138
139FILES:${PN}-ptest:append:class-target = "\
140 ${libdir}/ruby/include \
141 ${libdir}/ruby/${SHRT_VER}.0/*/-test- \
142"
143
144BBCLASSEXTEND = "native nativesdk"