blob: 2abf504d91bc7274429a92a649890e0cbfe6d0e8 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001require ruby.inc
2
Patrick Williams213cb262021-08-07 19:21:33 -05003DEPENDS:append:libc-musl = " libucontext"
Andrew Geissler82c905d2020-04-13 13:39:40 -05004
5SRC_URI += " \
6 file://remove_has_include_macros.patch \
7 file://run-ptest \
Andrew Geissler09209ee2020-12-13 08:44:15 -06008 file://0001-template-Makefile.in-do-not-write-host-cross-cc-item.patch \
Patrick Williams0ca19cc2021-08-16 14:03:13 -05009 file://0002-template-Makefile.in-filter-out-f-prefix-map.patch \
Patrick Williams93c203f2021-10-06 16:15:23 -050010 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 \
Andrew Geissler82c905d2020-04-13 13:39:40 -050014 "
15
Andrew Geissler5f350902021-07-23 13:09:54 -040016SRC_URI[sha256sum] = "5085dee0ad9f06996a8acec7ebea4a8735e6fac22f22e2d98c3f2bc3bef7e6f1"
Andrew Geissler82c905d2020-04-13 13:39:40 -050017
18PACKAGECONFIG ??= ""
19PACKAGECONFIG += "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}"
20
21PACKAGECONFIG[valgrind] = "--with-valgrind=yes, --with-valgrind=no, valgrind"
22PACKAGECONFIG[gmp] = "--with-gmp=yes, --with-gmp=no, gmp"
23PACKAGECONFIG[ipv6] = "--enable-ipv6, --disable-ipv6,"
24
25EXTRA_OECONF = "\
26 --disable-versioned-paths \
27 --disable-rpath \
28 --disable-dtrace \
29 --enable-shared \
30 --enable-load-relative \
31 --with-pkg-config=pkg-config \
32"
33
Patrick Williams213cb262021-08-07 19:21:33 -050034EXTRA_OECONF:append:libc-musl = "\
Andrew Geissler82c905d2020-04-13 13:39:40 -050035 LIBS='-lucontext' \
36 ac_cv_func_isnan=yes \
37 ac_cv_func_isinf=yes \
38"
39
Patrick Williams213cb262021-08-07 19:21:33 -050040EXTRA_OECONF:append:libc-musl:riscv64 = "\
Andrew Geissler9b4d8b02021-02-19 12:26:16 -060041 --with-coroutine=copy \
42"
Patrick Williams213cb262021-08-07 19:21:33 -050043EXTRA_OECONF:append:libc-musl:riscv32 = "\
Andrew Geissler9b4d8b02021-02-19 12:26:16 -060044 --with-coroutine=copy \
45"
46
Andrew Geissler82c905d2020-04-13 13:39:40 -050047do_install() {
48 oe_runmake 'DESTDIR=${D}' install
49}
50
Patrick Williams213cb262021-08-07 19:21:33 -050051do_install:append:class-target () {
Andrew Geissler82c905d2020-04-13 13:39:40 -050052 # Find out rbconfig.rb from .installed.list
53 rbconfig_rb=`grep rbconfig.rb ${B}/.installed.list`
54 # Remove build host directories
55 sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' \
56 -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \
57 -e 's|${DEBUG_PREFIX_MAP}||g' \
58 -e 's:${HOSTTOOLS_DIR}/::g' \
59 -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
60 -e 's:${RECIPE_SYSROOT}::g' \
61 -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
62 ${D}$rbconfig_rb
Patrick Williams0ca19cc2021-08-16 14:03:13 -050063
64 sed -i -e 's|${DEBUG_PREFIX_MAP}||g' \
65 ${D}${libdir}/pkgconfig/*.pc
66
Andrew Geissler82c905d2020-04-13 13:39:40 -050067}
68
69do_install_ptest () {
70 cp -rf ${S}/test ${D}${PTEST_PATH}/
71
72 install -D ${S}/tool/test/runner.rb ${D}${PTEST_PATH}/tool/test/runner.rb
73 cp -r ${S}/tool/lib ${D}${PTEST_PATH}/tool/
74 mkdir -p ${D}${PTEST_PATH}/lib
75 cp -r ${S}/lib/did_you_mean ${S}/lib/rdoc ${D}${PTEST_PATH}/lib
76
77 # install test-binaries
78 find $(find ./.ext -path '*/-test-') -name '*.so' -print0 \
79 | tar --no-recursion --null -T - --no-same-owner --preserve-permissions -cf - \
80 | tar -C ${D}${libdir}/ruby/${SHRT_VER}.0/ --no-same-owner --preserve-permissions --strip-components=2 -xf -
81 # adjust path to not assume build directory layout
82 sed -e 's|File.expand_path(.*\.\./bin/erb[^)]*|File.expand_path("${bindir}/erb"|g' \
83 -i ${D}${PTEST_PATH}/test/erb/test_erb_command.rb
84
85 cp -r ${S}/include ${D}/${libdir}/ruby/
86 test_case_rb=`grep rubygems/test_case.rb ${B}/.installed.list`
87 sed -i -e 's:../../../test/:../../../ptest/test/:g' ${D}/$test_case_rb
88}
89
90PACKAGES =+ "${PN}-ri-docs ${PN}-rdoc"
91
Patrick Williams213cb262021-08-07 19:21:33 -050092SUMMARY:${PN}-ri-docs = "ri (Ruby Interactive) documentation for the Ruby standard library"
93RDEPENDS:${PN}-ri-docs = "${PN}"
94FILES:${PN}-ri-docs += "${datadir}/ri"
Andrew Geissler82c905d2020-04-13 13:39:40 -050095
Patrick Williams213cb262021-08-07 19:21:33 -050096SUMMARY:${PN}-rdoc = "RDoc documentation generator from Ruby source"
97RDEPENDS:${PN}-rdoc = "${PN}"
98FILES:${PN}-rdoc += "${libdir}/ruby/*/rdoc ${bindir}/rdoc"
Andrew Geissler82c905d2020-04-13 13:39:40 -050099
Patrick Williams213cb262021-08-07 19:21:33 -0500100FILES:${PN} += "${datadir}/rubygems"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500101
Patrick Williams213cb262021-08-07 19:21:33 -0500102FILES:${PN}-ptest:append:class-target = "\
Andrew Geissler82c905d2020-04-13 13:39:40 -0500103 ${libdir}/ruby/include \
104 ${libdir}/ruby/${SHRT_VER}.0/*/-test- \
105"
106
107BBCLASSEXTEND = "native"