diff options
Diffstat (limited to 'net-libs/nodejs/nodejs-99999999.ebuild')
-rw-r--r-- | net-libs/nodejs/nodejs-99999999.ebuild | 127 |
1 files changed, 78 insertions, 49 deletions
diff --git a/net-libs/nodejs/nodejs-99999999.ebuild b/net-libs/nodejs/nodejs-99999999.ebuild index d9745115c19f..8f647b977a19 100644 --- a/net-libs/nodejs/nodejs-99999999.ebuild +++ b/net-libs/nodejs/nodejs-99999999.ebuild @@ -1,12 +1,13 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=7 +EAPI=8 -PYTHON_COMPAT=( python3_{8..10} ) +CONFIG_CHECK="~ADVISE_SYSCALLS" +PYTHON_COMPAT=( python3_{9..11} ) PYTHON_REQ_USE="threads(+)" -inherit bash-completion-r1 flag-o-matic pax-utils python-any-r1 toolchain-funcs xdg-utils +inherit bash-completion-r1 check-reqs flag-o-matic linux-info pax-utils python-any-r1 toolchain-funcs xdg-utils DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine" HOMEPAGE="https://nodejs.org/" @@ -19,53 +20,61 @@ if [[ ${PV} == *9999 ]]; then else SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz" SLOT="0/$(ver_cut 1)" - KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~amd64-linux ~x64-macos" + KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86 ~amd64-linux ~x64-macos" S="${WORKDIR}/node-v${PV}" fi -IUSE="cpu_flags_x86_sse2 debug doc +icu inspector lto +npm pax-kernel +snapshot +ssl system-icu +system-ssl systemtap test" -REQUIRED_USE="inspector? ( icu ssl ) +IUSE="corepack cpu_flags_x86_sse2 debug doc +icu inspector lto +npm pax-kernel +snapshot +ssl +system-icu +system-ssl test" +REQUIRED_USE="corepack? ( !npm ) + inspector? ( icu ssl ) npm? ( ssl ) system-icu? ( icu ) - system-ssl? ( ssl )" + system-ssl? ( ssl ) + x86? ( cpu_flags_x86_sse2 )" RESTRICT="!test? ( test )" RDEPEND=">=app-arch/brotli-1.0.9:= - >=dev-libs/libuv-1.40.0:= - >=net-dns/c-ares-1.17.0:= + >=dev-libs/libuv-1.44.0:= + >=net-dns/c-ares-1.18.1:= >=net-libs/nghttp2-1.41.0:= sys-libs/zlib - system-icu? ( >=dev-libs/icu-67:= ) - system-ssl? ( >=dev-libs/openssl-1.1.1:0= )" + corepack? ( !sys-apps/yarn ) + system-icu? ( >=dev-libs/icu-73:= ) + system-ssl? ( >=dev-libs/openssl-1.1.1:0= ) + sys-devel/gcc:*" BDEPEND="${PYTHON_DEPS} + app-alternatives/ninja sys-apps/coreutils virtual/pkgconfig - systemtap? ( dev-util/systemtap ) test? ( net-misc/curl ) pax-kernel? ( sys-apps/elfix )" DEPEND="${RDEPEND}" -PATCHES=( - "${FILESDIR}"/${PN}-12.22.1-jinja_collections_abc.patch # still needed as of 2021-06-04 -) +# These are measured on a loong machine with -ggdb on, and only checked +# if debugging flags are present in CFLAGS. +# +# The final link consumed a little more than 7GiB alone, so 8GiB is the lower +# limit for memory usage. Disk usage was 19.1GiB for the build directory and +# 1.2GiB for the installed image, so we leave some room for architectures with +# fatter binaries and set the disk requirement to 22GiB. +CHECKREQS_MEMORY="8G" +CHECKREQS_DISK_BUILD="22G" pkg_pretend() { - (use x86 && ! use cpu_flags_x86_sse2) && \ - die "Your CPU doesn't support the required SSE2 instruction." - if [[ ${MERGE_TYPE} != "binary" ]]; then - if use lto; then - if tc-is-gcc; then - if [[ $(gcc-major-version) -ge 11 ]]; then - # Bug #787158 - die "LTO builds of ${PN} using gcc-11+ currently fail tests and produce runtime errors. Either switch to gcc-10 or unset USE=lto for this ebuild" - fi - fi + if is-flagq "-g*" && ! is-flagq "-g*0" ; then + einfo "Checking for sufficient disk space and memory to build ${PN} with debugging CFLAGS" + check-reqs_pkg_pretend fi fi } +pkg_setup() { + python-any-r1_pkg_setup + linux-info_pkg_setup +} + src_prepare() { tc-export AR CC CXX PKG_CONFIG export V=1 @@ -95,14 +104,7 @@ src_prepare() { fi # We need to disable mprotect on two files when it builds Bug 694100. - use pax-kernel && PATCHES+=( "${FILESDIR}"/${PN}-13.8.0-paxmarking.patch ) - - # All this test does is check if the npm CLI produces warnings of any sort, - # failing if it does. Overkill, much? Especially given one possible warning - # is that there is a newer version of npm available upstream (yes, it does - # use the network if available), thus making it a real possibility for this - # test to begin failing one day even though it was fine before. - rm -f test/parallel/test-release-npm.js + use pax-kernel && PATCHES+=( "${FILESDIR}"/${PN}-18.16.0-paxmarking.patch ) default } @@ -111,9 +113,16 @@ src_configure() { xdg_environment_reset # LTO compiler flags are handled by configure.py itself - filter-flags '-flto*' + filter-lto + # nodejs unconditionally links to libatomic #869992 + # specifically it requires __atomic_is_lock_free which + # is not yet implemented by sys-libs/compiler-rt (see + # https://reviews.llvm.org/D85044?id=287068), therefore + # we depend on gcc and force using libgcc as the support lib + tc-is-clang && append-ldflags "--rtlib=libgcc --unwindlib=libgcc" local myconf=( + --ninja --shared-brotli --shared-cares --shared-libuv @@ -129,6 +138,7 @@ src_configure() { else myconf+=( --with-intl=none ) fi + use corepack || myconf+=( --without-corepack ) use inspector || myconf+=( --without-inspector ) use npm || myconf+=( --without-npm ) use snapshot || myconf+=( --without-node-snapshot ) @@ -139,13 +149,15 @@ src_configure() { fi local myarch="" - case ${ABI} in - amd64) myarch="x64";; - arm) myarch="arm";; - arm64) myarch="arm64";; - ppc64) myarch="ppc64";; - x32) myarch="x32";; - x86) myarch="ia32";; + case "${ARCH}:${ABI}" in + *:amd64) myarch="x64";; + *:arm) myarch="arm";; + *:arm64) myarch="arm64";; + loong:lp64*) myarch="loong64";; + riscv:lp64*) myarch="riscv64";; + *:ppc64) myarch="ppc64";; + *:x32) myarch="x32";; + *:x86) myarch="ia32";; *) myarch="${ABI}";; esac @@ -155,12 +167,11 @@ src_configure() { "${EPYTHON}" configure.py \ --prefix="${EPREFIX}"/usr \ --dest-cpu=${myarch} \ - $(use_with systemtap dtrace) \ "${myconf[@]}" || die } src_compile() { - emake -C out + emake -Onone } src_install() { @@ -183,6 +194,8 @@ src_install() { if use npm; then keepdir /etc/npm + echo "NPM_CONFIG_GLOBALCONFIG=${EPREFIX}/etc/npm/npmrc" > "${T}"/50npm + doenvd "${T}"/50npm # Install bash completion for `npm` local tmp_npm_completion_file="$(TMPDIR="${T}" mktemp -t npm.XXXXXXXXXX)" @@ -213,16 +226,32 @@ src_install() { \) \) -exec rm -rf "{}" \; fi + use corepack && + "${D}"/usr/bin/corepack enable --install-directory "${D}"/usr/bin + mv "${ED}"/usr/share/doc/node "${ED}"/usr/share/doc/${PF} || die } src_test() { - # parallel/test-fs-mkdir is known to fail with FEATURES=usersandbox - if has usersandbox ${FEATURES}; then - ewarn "You are emerging ${P} with 'usersandbox' enabled." \ - "Expect some test failures or emerge with 'FEATURES=-usersandbox'!" - fi + local drop_tests=( + test/parallel/test-dns-setserver-when-querying.js + test/parallel/test-fs-mkdir.js + test/parallel/test-fs-utimes-y2K38.js + test/parallel/test-fs-watch-recursive-add-file.js + test/parallel/test-release-npm.js + test/parallel/test-socket-write-after-fin-error.js + test/parallel/test-strace-openat-openssl.js + test/sequential/test-util-debug.js + ) + rm -f "${drop_tests[@]}" || die "disabling tests failed" out/${BUILDTYPE}/cctest || die "${EPYTHON}" tools/test.py --mode=${BUILDTYPE,,} --flaky-tests=dontcare -J message parallel sequential || die } + +pkg_postinst() { + if use npm; then + ewarn "remember to run: source /etc/profile if you plan to use nodejs" + ewarn " in your current shell" + fi +} |