blob: 6fc1f53b1885a41a6fba3efee2547b4e1fefbec9 [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
Patrick Williams03907ee2022-05-01 06:28:52 -050017SRC_URI[sha256sum] = "61843112389f02b735428b53bb64cf988ad9fb81858b8248e22e57336f24a83e"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000018
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,"
Andrew Geissler615f2f12022-07-15 14:00:58 -050028PACKAGECONFIG[capstone] = "--with-capstone=yes, --with-capstone=no"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000029
30EXTRA_OECONF = "\
31 --disable-versioned-paths \
32 --disable-rpath \
33 --disable-dtrace \
34 --enable-shared \
35 --enable-load-relative \
36 --with-pkg-config=pkg-config \
37 --with-static-linked-ext \
38"
39
40EXTRA_OECONF:append:libc-musl = "\
41 ac_cv_func_isnan=yes \
42 ac_cv_func_isinf=yes \
43"
44
45PARALLEL_MAKEINST = ""
46
47do_install:append:class-target () {
48 # Find out rbconfig.rb from .installed.list
49 rbconfig_rb=`grep rbconfig.rb ${B}/.installed.list`
50 # Remove build host directories
51 sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' \
52 -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \
53 -e 's|${DEBUG_PREFIX_MAP}||g' \
54 -e 's:${HOSTTOOLS_DIR}/::g' \
55 -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
56 -e 's:${RECIPE_SYSROOT}::g' \
57 -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
58 ${D}$rbconfig_rb
59
60 sed -i -e 's|${DEBUG_PREFIX_MAP}||g' \
61 ${D}${libdir}/pkgconfig/*.pc
62
63 # logs that may contain host-specific paths
64 find ${D} -name gem_make.out -delete
65}
66
67do_install_ptest () {
68 cp -rf ${S}/test ${D}${PTEST_PATH}/
69
70 install -D ${S}/tool/test/runner.rb ${D}${PTEST_PATH}/tool/test/runner.rb
71 cp -r ${S}/tool/lib ${D}${PTEST_PATH}/tool/
72 mkdir -p ${D}${PTEST_PATH}/lib
73 cp -r ${S}/lib/did_you_mean ${S}/lib/rdoc ${D}${PTEST_PATH}/lib
74
75 # install test-binaries
76 # These .so files have sporadic reproducibility fails as seen here:
77 # https://autobuilder.yocto.io/pub/repro-fail/oe-reproducible-20220107-rm1diuww/packages/diff-html/
78 # As they are needed only in ruby-ptest, and that is currently altogether disabled, let's take them out.
79 # If someone wants to look at where the non-determinism comes from, one possible reason is use of
80 # -rdynamic -Wl,-export-dynamic
81 #find $(find ./.ext -path '*/-test-') -name '*.so' -print0 \
82 # | tar --no-recursion --null -T - --no-same-owner --preserve-permissions -cf - \
83 # | tar -C ${D}${libdir}/ruby/${SHRT_VER}.0/ --no-same-owner --preserve-permissions --strip-components=2 -xf -
84 # adjust path to not assume build directory layout
85 sed -e 's|File.expand_path(.*\.\./bin/erb[^)]*|File.expand_path("${bindir}/erb"|g' \
86 -i ${D}${PTEST_PATH}/test/erb/test_erb_command.rb
87
88 cp -r ${S}/include ${D}/${libdir}/ruby/
89}
90
91PACKAGES =+ "${PN}-ri-docs ${PN}-rdoc"
92
93SUMMARY:${PN}-ri-docs = "ri (Ruby Interactive) documentation for the Ruby standard library"
94RDEPENDS:${PN}-ri-docs = "${PN}"
95FILES:${PN}-ri-docs += "${datadir}/ri"
96
97SUMMARY:${PN}-rdoc = "RDoc documentation generator from Ruby source"
98RDEPENDS:${PN}-rdoc = "${PN}"
99FILES:${PN}-rdoc += "${libdir}/ruby/*/rdoc ${bindir}/rdoc"
100
101FILES:${PN} += "${datadir}/rubygems"
102
103FILES:${PN}-ptest:append:class-target = "\
104 ${libdir}/ruby/include \
105 ${libdir}/ruby/${SHRT_VER}.0/*/-test- \
106"
107
108BBCLASSEXTEND = "native"