## START: Set by rpmautospec ## (rpmautospec version 0.6.0) ## RPMAUTOSPEC: autorelease, autochangelog %define autorelease(e:s:pb:n) %{?-p:0.}%{lua: release_number = 5; base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); print(release_number + base_release_number - 1); }%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} ## END: Set by rpmautospec %global npm_name cjs-module-lexer %global prebuilt_blobs lib/lexer.wasm %bcond wasm_opt %{undefined rhel} Name: nodejs-%{npm_name} Summary: A very fast lexer used to detect the named exports of a CommonJS module Version: 1.4.1 Release: %autorelease License: MIT URL: https://www.npmjs.com/package/cjs-module-lexer # The npmjs.org archive does not contain sources, only built artifacts Source: https://github.com/nodejs/%{npm_name}/archive/%{version}/%{npm_name}-%{version}.tar.gz # Production archive is not needed Source2: %{npm_name}-%{version}-nm-dev.tgz Source3: %{npm_name}-%{version}-bundled-licenses.txt # Binary files in this package are aimed at the wasm32-wasi "architecture". %global _binaries_in_noarch_packages_terminate_build 0 BuildArch: noarch ExclusiveArch: %{lua: -- Start from the full set of %nodejs_arches + noarch, -- then remove the unsupported ones. local valid_arches = {noarch = true} for arch in macros.nodejs_arches:gmatch("[^%s]+") do valid_arches[arch] = true end -- Need llvm >= 19 to support s390x if (macros.fedora and tonumber(macros.fedora) < 41) or (macros.rhel and tonumber(macros.rhel) < 11) then valid_arches["s390x"] = nil end -- Need binaryen for optimization, not built everywhere if macros.with("wasm_opt") ~= "0" then valid_arches["ppc64"] = nil valid_arches["s390x"] = nil end for arch in pairs(valid_arches) do print(arch .. " ") end } BuildRequires: clang lld make wasi-libc-devel BuildRequires: nodejs-devel npm %if %{with wasm_opt} BuildRequires: binaryen %endif # for autosetup -S git_am BuildRequires: git-core %description A very fast JS CommonJS module syntax lexer used to detect the most likely list of named exports of a CommonJS module. This project is used in Node.js core for detecting the named exports available when importing a CJS module into ESM, and is maintained for this purpose. %prep %autosetup -n %{npm_name}-%{version} -S git_am cp -p %{S:3} . %build rm -rf %{prebuilt_blobs} tar -xzf %{S:2} && ln -rsf node_modules_dev node_modules %make_build -j1 \ WASM_CC=clang \ WASM_CFLAGS='--target=wasm32-wasi --sysroot=/usr/wasm32-wasi' \ WASM_LDFLAGS='-nostartfiles -nodefaultlibs -lc' \ %{?with_wasm_opt:WASM_OPT=/usr/bin/wasm-opt} \ clean lib/lexer.wasm %{?with_wasm_opt:optimize} npm --offline run build npm --offline pack %install mkdir -p %{buildroot}%{nodejs_sitelib}/%{npm_name} tar --strip-components=1 -xzf %{npm_name}-%{version}.tgz -C %{buildroot}%{nodejs_sitelib}/%{npm_name} %check %{__nodejs} -e 'require("./")' %nodejs_symlink_deps --check npm --offline run test %files %license LICENSE %{npm_name}-%{version}-bundled-licenses.txt %doc README.md %dir %{nodejs_sitelib} %{nodejs_sitelib}/%{npm_name}/ %changelog ## START: Generated by rpmautospec * Thu Oct 24 2024 Jan Staněk - 1.4.1-5 - fixup(lua): macros.with returns string values * Thu Oct 24 2024 Jan Staněk - 1.4.1-4 - React to binaryen not being available on several architectures * Thu Oct 24 2024 Jan Staněk - 1.4.1-3 - Use lua to handle ExclusiveArch specification * Wed Oct 23 2024 Yaakov Selkowitz - 1.4.1-2 - Update RHEL conditionals * Thu Oct 10 2024 Jan Staněk - 1.4.1-1 - Update to version 1.4.1 (rhbz#2308079) * Tue Aug 13 2024 Jan Staněk - 1.3.1-2 - enable binaryen optimization * Tue Aug 13 2024 Jan Staněk - 1.3.1-1 - Update to version 1.3.1 (rhbz#2277570) * Thu Jul 18 2024 Fedora Release Engineering - 1.2.3-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild * Thu Apr 04 2024 Jan Staněk - 1.2.3-6 - Enable gating * Thu Jan 25 2024 Fedora Release Engineering - 1.2.3-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild * Mon Jan 22 2024 Yaakov Selkowitz - 1.2.3-4 - Do not attempt to build on s390x * Sun Jan 21 2024 Fedora Release Engineering - 1.2.3-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild * Tue Nov 14 2023 Jan Staněk - 1.2.3-2 - own %%{nodejs_sitelib} directory * Mon Oct 23 2023 Jan Staněk - 1.2.3-1 - initial import (rhbz#2245271) ## END: Generated by rpmautospec