## START: Set by rpmautospec ## (rpmautospec version 0.8.4) ## RPMAUTOSPEC: autorelease, autochangelog %define autorelease(e:s:pb:n) %{?-p:0.}%{lua: release_number = 3; 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 rollup %undefine _package_note_flags Name: nodejs-%{npm_name} Version: 4.62.4 Release: %autorelease Summary: Module bundler for JavaScript License: MIT AND ISC URL: https://rollupjs.org/ Source0: https://github.com/%{npm_name}/%{npm_name}/archive/refs/tags/v%{version}.tar.gz Source1: %{npm_name}-%{version}-nm-prod.tgz Source2: %{npm_name}-%{version}-nm-dev.tgz Source3: %{npm_name}-%{version}-bundled-licenses.txt # To create the vendor tarball: # tar xf v%%{version}.tar.gz ; pushd %%{npm_name}-%%{version}/rust ; \ # cargo vendor && tar Jcvf ../%%{npm_name}-%%{version}-vendor.tar.xz vendor/ ; popd Source4: %{npm_name}-%{version}-vendor.tar.xz ExclusiveArch: %{nodejs_arches} Requires: nodejs24 BuildRequires: nodejs24-npm BuildRequires: /usr/bin/npm BuildRequires: nodejs-shx BuildRequires: nodejs-concurrently BuildRequires: nodejs24 BuildRequires: nodejs24-devel BuildRequires: nodejs-husky BuildRequires: rustfmt BuildRequires: rust-napi-devel BuildRequires: cargo-rpm-macros >= 24 BuildRequires: cmake BuildRequires: gcc-c++ %description %{summary}. %prep %setup -q -n %{npm_name}-%{version} -a1 -a2 -a4 cp %{SOURCE3} . # Setup bundled runtime(prod) node modules # tar xfz %{SOURCE1} mkdir -p node_modules pushd node_modules ln -s ../node_modules_prod/* . ln -sf ../node_modules_dev/* . mkdir .bin pushd .bin # ln -s ../../node_modules_prod/.bin/* . ln -s ../../node_modules_dev/.bin/* . # Note: the npm wasm-pack package is stripped from devDependencies in # rollup-sources.sh, so no .bin/wasm-pack symlink exists here. This package # builds only the native (napi) binding and the Node.js JS, not the WASM/browser # flavor, so no wasm-pack is needed. See BROWSER-BUILD-NOTES.md. popd popd %cargo_prep -v vendor # Don't generate_buildrequires when using vendored crates #% generate_buildrequires #pushd rust &> /dev/null #% cargo_generate_buildrequires #popd &> /dev/null # rust/bindings_napi/.cargo/config.toml carries upstream's cross-compilation # settings: a nightly-only "-Z location-detail=none" rustflag and per-target # linker overrides naming Debian-style cross compilers (e.g. # aarch64-linux-gnu-gcc). Fedora builds each arch natively, where those cross # linkers are not installed (the aarch64 build fails on a missing # aarch64-linux-gnu-gcc) and the nightly flag is rejected on stable rustc. Remove # the file so cargo uses the default native linker; the vendor source redirect # written by %%cargo_prep lives in the top-level .cargo/config.toml and is # unaffected. rm -f rust/bindings_napi/.cargo/config.toml # The bundled dependencies live in node_modules_dev/ and node_modules_prod/, # symlinked into a node_modules/ farm in %%prep above. @rollup/plugin-commonjs is # configured with include:'node_modules/**', but nodeResolve follows the symlinks # to their real node_modules_dev/ paths, so CommonJS deps imported as a default # (e.g. "import picomatch from 'picomatch'") are never converted and fail to # build. Broaden the include glob to cover the real bundle directories. sed -i \ "s|include: 'node_modules/\*\*'|include: ['node_modules/**', 'node_modules_dev/**', 'node_modules_prod/**']|" \ rollup.config.ts %build # Build entirely offline. Use the node_modules bundle assembled in %%prep and # the vendored Rust crates configured by %%cargo_prep. Do NOT run "npm i": it # would reach the network and discard the bundled modules. export CARGO_NET_OFFLINE=true export npm_config_offline=true export npm_config_audit=false export npm_config_fund=false # Build only what the "rollup" package needs: the native napi binding and the # Node.js JS builds. We deliberately skip "npm run build", which also builds the # WASM/browser flavor (the separate @rollup/browser package). build:js:node # (--configIsBuildNode) emits just the CommonJS + ESM node builds, so no WASM # toolchain is required. See BROWSER-BUILD-NOTES.md to add the browser build. # Generate the AST-converter code (Rust + JS) first, then compile the native # (napi) binding from it. build:napi produces ./rollup..node and needs # no working rollup itself (it just drives cargo), so it can run before we have a # bootstrap binding. Order matters: napi must compile the freshly generated Rust # converters, matching the generated JS parser. npm run build:ast-converters npm run build:napi -- --release # Bootstrap: rollup is built by running rollup. Give the build-time rollup the # binding we just compiled so it self-hosts, instead of pulling a prebuilt # @rollup/rollup- package from the network. The build-time rollup in # node_modules_dev is pinned to this exact version in rollup-sources.sh, so its # JS parser and our binding share the same AST encoding. If they differ # (e.g. bootstrap rollup resolved to a newer 4.x), rollup.config.ts is misparsed. cp rollup.*.node node_modules_dev/rollup/dist/ npm run build:js:node npm run build:copy-native pushd rust %{cargo_license_summary} %{cargo_license} > LICENSE.dependencies popd %install mkdir -p %{buildroot}%{nodejs_sitelib}/%{npm_name} # Modules from "dependencies" in package.json. # The native binding is built from source into dist/*.node (see %%build) and is # preferred by native.js over the prebuilt @rollup/rollup- package, so # we do not ship that prebuilt package. for mod in "@types/estree" do mkdir -p %{buildroot}%{nodejs_sitelib}/%{npm_name}/node_modules/"$mod" cp -pr node_modules/"$mod"/. \ %{buildroot}%{nodejs_sitelib}/%{npm_name}/node_modules/"$mod" done # contents of the "files" section of package.json: # ["dist/*.node","dist/**/*.js","dist/*.d.ts","dist/bin/rollup","dist/es/package.json"] # "dist/**/*.js" must recurse the whole tree: besides dist/es/ and dist/shared/, # it includes the top-level dist/*.js entry points (native.js, rollup.js, # parseAst.js, ...). native.js in particular is imported by dist/es/parseAst.js, # so omitting it breaks any ESM consumer of rollup (e.g. vite). mkdir -p %{buildroot}%{nodejs_sitelib}/%{npm_name}/dist (find dist -name '*.node' find dist -name '*.js' find dist -maxdepth 1 -name '*.d.ts' find dist/bin/rollup find dist/es/package.json) | \ cpio -o | \ (cd %{buildroot}%{nodejs_sitelib}/%{npm_name} && cpio -ivd) cp -pr package.json \ %{buildroot}%{nodejs_sitelib}/%{npm_name} mkdir -p %{buildroot}%{_bindir} ln -sr %{nodejs_sitelib}/rollup/dist/bin/rollup %{buildroot}%{_bindir}/rollup %check %{__nodejs} -e 'require("./")' # Load the *installed* package (not just the build tree) via both CommonJS and # ESM. This exercises the shipped dist/*.js entry points and their transitive # imports (notably dist/native.js, pulled in by dist/es/parseAst.js), catching # packaging bugs where a required file is not installed. %{__nodejs} -e 'require("%{buildroot}%{nodejs_sitelib}/rollup/dist/rollup.js")' %{__nodejs} --input-type=module \ -e 'import("file://%{buildroot}%{nodejs_sitelib}/rollup/dist/es/rollup.js").then(m => { if (!m.rollup) throw new Error("rollup ESM export missing"); })' # Setup bundled dev node_modules for testing # Note: this cannot be in %%prep or the dev node_modules # can get pulled into the regular rpm tar xfz %{SOURCE2} #pushd node_modules #ln -s ../node_modules_dev/* . #popd #pushd node_modules/.bin #ln -s ../../node_modules_dev/.bin/* . #popd # Run tests #./node_modules/.bin/tap test/*.js %files %doc README.md %license LICENSE-CORE.md LICENSE.md %{npm_name}-%{version}-bundled-licenses.txt %{nodejs_sitelib}/rollup %{_bindir}/rollup %changelog ## START: Generated by rpmautospec * Wed Aug 19 2026 Gordon Messmer - 4.62.4-3 - Install all dist/*.js entry points (fixes missing native.js) * Wed Aug 19 2026 Gordon Messmer - 4.62.4-2 - Fix native (napi) build on aarch64 * Wed Aug 19 2026 Gordon Messmer - 4.62.4-1 - Update to 4.62.4 and build fully offline without WASM * Thu Mar 19 2026 Gordon Messmer - 4.57.1-1 - Update to 4.57.1 * Tue Feb 03 2026 Gordon Messmer - 4.52.5-1 - partial progress * Tue Oct 28 2025 Gordon Messmer - 3.29.5-1 - Import SUSE rollup package ## END: Generated by rpmautospec