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