blob: d8fddfa52045a55901406d399579a51fdabce51a [file] [log] [blame]
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00001require ruby.inc
2
3DEPENDS:append:libc-musl = " libucontext"
4
5SRC_URI += " \
6 file://remove_has_include_macros.patch \
7 file://run-ptest \
8 file://0001-template-Makefile.in-do-not-write-host-cross-cc-item.patch \
9 file://0002-template-Makefile.in-filter-out-f-prefix-map.patch \
10 file://0003-rdoc-build-reproducible-documentation.patch \
11 file://0004-lib-mkmf.rb-sort-list-of-object-files-in-generated-M.patch \
12 file://0005-Mark-Gemspec-reproducible-change-fixing-784225-too.patch \
13 file://0006-Make-gemspecs-reproducible.patch \
14 file://0001-vm_dump.c-Define-REG_S1-and-REG_S2-for-musl-riscv.patch \
15 "
16
17SRC_URI[sha256sum] = "fe6e4782de97443978ddba8ba4be38d222aa24dc3e3f02a6a8e7701c0eeb619d"
18
19PACKAGECONFIG ??= ""
20PACKAGECONFIG += "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}"
21
22PACKAGECONFIG[valgrind] = "--with-valgrind=yes, --with-valgrind=no, valgrind"
23PACKAGECONFIG[gmp] = "--with-gmp=yes, --with-gmp=no, gmp"
24PACKAGECONFIG[ipv6] = "--enable-ipv6, --disable-ipv6,"
25# rdoc is off by default due to non-reproducibility reported in
26# https://bugs.ruby-lang.org/issues/18456
27PACKAGECONFIG[rdoc] = "--enable-install-rdoc,--disable-install-rdoc,"
28
29EXTRA_OECONF = "\
30 --disable-versioned-paths \
31 --disable-rpath \
32 --disable-dtrace \
33 --enable-shared \
34 --enable-load-relative \
35 --with-pkg-config=pkg-config \
36 --with-static-linked-ext \
37"
38
39EXTRA_OECONF:append:libc-musl = "\
40 ac_cv_func_isnan=yes \
41 ac_cv_func_isinf=yes \
42"
43
44PARALLEL_MAKEINST = ""
45
46do_install:append:class-target () {
47 # Find out rbconfig.rb from .installed.list
48 rbconfig_rb=`grep rbconfig.rb ${B}/.installed.list`
49 # Remove build host directories
50 sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' \
51 -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \
52 -e 's|${DEBUG_PREFIX_MAP}||g' \
53 -e 's:${HOSTTOOLS_DIR}/::g' \
54 -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
55 -e 's:${RECIPE_SYSROOT}::g' \
56 -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
57 ${D}$rbconfig_rb
58
59 sed -i -e 's|${DEBUG_PREFIX_MAP}||g' \
60 ${D}${libdir}/pkgconfig/*.pc
61
62 # logs that may contain host-specific paths
63 find ${D} -name gem_make.out -delete
64}
65
66do_install_ptest () {
67 cp -rf ${S}/test ${D}${PTEST_PATH}/
68
69 install -D ${S}/tool/test/runner.rb ${D}${PTEST_PATH}/tool/test/runner.rb
70 cp -r ${S}/tool/lib ${D}${PTEST_PATH}/tool/
71 mkdir -p ${D}${PTEST_PATH}/lib
72 cp -r ${S}/lib/did_you_mean ${S}/lib/rdoc ${D}${PTEST_PATH}/lib
73
74 # install test-binaries
75 # These .so files have sporadic reproducibility fails as seen here:
76 # https://autobuilder.yocto.io/pub/repro-fail/oe-reproducible-20220107-rm1diuww/packages/diff-html/
77 # As they are needed only in ruby-ptest, and that is currently altogether disabled, let's take them out.
78 # If someone wants to look at where the non-determinism comes from, one possible reason is use of
79 # -rdynamic -Wl,-export-dynamic
80 #find $(find ./.ext -path '*/-test-') -name '*.so' -print0 \
81 # | tar --no-recursion --null -T - --no-same-owner --preserve-permissions -cf - \
82 # | tar -C ${D}${libdir}/ruby/${SHRT_VER}.0/ --no-same-owner --preserve-permissions --strip-components=2 -xf -
83 # adjust path to not assume build directory layout
84 sed -e 's|File.expand_path(.*\.\./bin/erb[^)]*|File.expand_path("${bindir}/erb"|g' \
85 -i ${D}${PTEST_PATH}/test/erb/test_erb_command.rb
86
87 cp -r ${S}/include ${D}/${libdir}/ruby/
88}
89
90PACKAGES =+ "${PN}-ri-docs ${PN}-rdoc"
91
92SUMMARY:${PN}-ri-docs = "ri (Ruby Interactive) documentation for the Ruby standard library"
93RDEPENDS:${PN}-ri-docs = "${PN}"
94FILES:${PN}-ri-docs += "${datadir}/ri"
95
96SUMMARY:${PN}-rdoc = "RDoc documentation generator from Ruby source"
97RDEPENDS:${PN}-rdoc = "${PN}"
98FILES:${PN}-rdoc += "${libdir}/ruby/*/rdoc ${bindir}/rdoc"
99
100FILES:${PN} += "${datadir}/rubygems"
101
102FILES:${PN}-ptest:append:class-target = "\
103 ${libdir}/ruby/include \
104 ${libdir}/ruby/${SHRT_VER}.0/*/-test- \
105"
106
107BBCLASSEXTEND = "native"