feat(licenses): meet the LGPL notice and source terms for libvips and node-webpmux

The notices now carry the LGPL-3.0 and GPL-3.0 texts from
scripts/license-texts (the LGPL text byte-identical to gnu.org's, the GPL
text as the Rust toolchain ships it), whatever the dependencies ship.
The LGPL section names each component with its exact version, says it
ships unmodified as a separate library, and gives the upstream source
release of that version: sharp-libvips v1.3.2 and libvips v8.18.3 for
the libvips packages, sharp v0.35.3 for @img/sharp-win32-x64, the npm
package of node-webpmux 3.2.1. The libraries built into libvips are
listed with their versions from versions.json. Versions and repository
URLs come from the lockfile and the installed packages.

The LGPL exceptions of the license gate are no longer pending: the
project owner left these items to us. A test checks the texts, the LGPL
rows and the Apache-2.0 files against the committed notices. UF-059 is
fixed.
This commit is contained in:
shumeiko.it
2026-11-04 10:34:32 +01:00
parent 58535a580f
commit 35bf8e26bd
8 changed files with 829 additions and 113 deletions

View File

@@ -265,9 +265,56 @@ for (const component of components) {
const group = classify(component);
if (group) groups[group].push(component);
}
const lgplText = findText(/GNU LESSER GENERAL PUBLIC LICENSE\s+Version 3/);
const gplText = texts.find((entry) => /\bGNU GENERAL PUBLIC LICENSE\s+Version 3, 29 June 2007/.test(entry.text));
const textRef = (entry, name) => (entry ? `[license text ${entry.number}](#license-text-${entry.number})` : `the ${name} text (not found in any shipped package; add it before distribution)`);
const textLink = (number) => `[license text ${number}](#license-text-${number})`;
const textRef = (entry, name) => (entry ? textLink(entry.number) : `the ${name} text (not found in any shipped package; add it before distribution)`);
// The LGPL-3.0 and the GPL-3.0 it incorporates live in scripts/license-texts,
// so the notices carry them whatever the dependencies happen to ship.
function canonicalText(file) {
const text = fs.readFileSync(path.join(ROOT, 'scripts', 'license-texts', file), 'utf8').replace(/\r\n?/g, '\n').trim();
return registerTexts([{ file: `scripts/license-texts/${file}`, text }], 'Waggle, for its LGPL-3.0 components')[0];
}
// Upstream repositories as the installed packages name them: sharp and its
// platform packages (package.json of sharp), the libvips packages (package.json
// of @img/sharp-libvips-*) and libvips itself (README of sharp).
const SHARP_REPOSITORY = 'https://github.com/lovell/sharp';
const SHARP_LIBVIPS_REPOSITORY = 'https://github.com/lovell/sharp-libvips';
const LIBVIPS_REPOSITORY = 'https://github.com/libvips/libvips';
const sharpManifest = readInstalledManifest(ROOT, 'node_modules/sharp') ?? {};
const libvipsDir = ['darwin-arm64', 'darwin-x64', 'linux-x64', 'linuxmusl-x64']
.map((suffix) => path.join(ROOT, 'node_modules', '@img', `sharp-libvips-${suffix}`))
.find((dir) => fs.existsSync(path.join(dir, 'versions.json')));
const libvipsVersions = libvipsDir ? JSON.parse(fs.readFileSync(path.join(libvipsDir, 'versions.json'), 'utf8')) : {};
const vipsVersion = libvipsVersions.vips ?? String(sharpManifest.config?.libvips ?? '').replace(/^>=/, '');
function repositoryUrl(manifest) {
const url = typeof manifest?.repository === 'string' ? manifest.repository : manifest?.repository?.url;
return url ? url.replace(/^git\+/, '').replace(/\.git$/, '') : null;
}
/** Where the corresponding source of an LGPL component of this exact version is published. */
function lgplSource(row) {
const sharpLibvipsRelease = (version) => `${SHARP_LIBVIPS_REPOSITORY}/releases/tag/v${version}`;
if (row.name.startsWith('@img/sharp-libvips-')) {
return `${sharpLibvipsRelease(row.version)} (build scripts and \`versions.json\`); libvips ${vipsVersion}: ${LIBVIPS_REPOSITORY}/releases/tag/v${vipsVersion}`;
}
if (row.name.startsWith('@img/sharp-')) {
const libvipsPackage = `@img/sharp-libvips-${row.name.slice('@img/sharp-'.length)}`;
const libvipsVersion = sharpManifest.devDependencies?.[libvipsPackage] ?? sharpManifest.optionalDependencies?.[libvipsPackage];
const dlls = libvipsVersion ? `; its libvips DLLs are ${libvipsPackage} ${libvipsVersion}: ${sharpLibvipsRelease(libvipsVersion)}` : '';
return `${SHARP_REPOSITORY}/releases/tag/v${row.version}${dlls}`;
}
const repository = repositoryUrl(readInstalledManifest(ROOT, row.key));
return `${row.resolved ?? npmSource(row)} (the published package of this version)${repository ? `; repository: ${repository}` : ''}`;
}
/** A version from versions.json of the libvips packages, by the library name their README uses. */
function bundledVersion(name) {
const version = libvipsVersions[name] ?? libvipsVersions[name.replace(/^lib/, '')] ?? libvipsVersions[{ libultrahdr: 'uhdr' }[name]];
if (!version) return 'not in `versions.json`';
return /^[0-9a-f]{7,40}$/.test(version) ? `commit ${version}` : version;
}
function componentTable(rows) {
line('| Component | Version | Artifact | License | Source |');
@@ -285,9 +332,8 @@ line('## LGPL, MPL and other licenses with conditions');
line();
line('Most components are under permissive licenses that only ask for their notice to be kept,');
line('which this file does. The components below carry further conditions. The summaries say what');
line('the licenses ask of whoever distributes Waggle; they are engineering notes, not legal advice,');
line('and the licensing review of the project owner (pending decision Q6) decides whether the');
line('measures are sufficient.');
line('the licenses ask of whoever distributes Waggle and how this distribution meets it; they are');
line('engineering notes, not legal advice.');
line();
line('### LGPL-3.0');
@@ -296,43 +342,73 @@ if (groups.lgpl.length === 0) {
line('No shipped component is under the LGPL.');
line();
} else {
componentTable(groups.lgpl.sort(byNameAndVersion));
const lgplRows = groups.lgpl.sort(byNameAndVersion);
const lgplNumber = canonicalText('LGPL-3.0.txt');
const gplNumber = canonicalText('GPL-3.0.txt');
line('Waggle uses the libraries below under the GNU Lesser General Public License, version 3 or');
line('(at your option) any later version. Each ships unmodified, as a separate library that Waggle');
line('loads at runtime.');
line();
line(`- LGPL-3.0: ${textLink(lgplNumber)}`);
line(`- GPL-3.0, which the LGPL-3.0 incorporates: ${textLink(gplNumber)}`);
line();
line('| Component | Version | Artifact | License | Corresponding source |');
line('|---|---|---|---|---|');
for (const row of lgplRows) {
line(`| ${cell(row.name)} | ${cell(row.version)} | ${row.artifact} | ${cell(row.declaredLicense ?? row.license)} | ${cell(lgplSource(row))} |`);
}
line();
line('How they ship: `build-sidecar.mjs` keeps `@huggingface/transformers`, `sharp` and');
line('`whatsapp-web.js` external to `service.js`, and `stage-sidecar-deps.mjs` copies these');
line('packages unmodified into `resources/node_modules` of the desktop app. The libvips packages');
line('(and, on Windows, `@img/sharp-win32-x64`) hold prebuilt shared libraries that sharp loads');
line('at runtime; node-webpmux is a JavaScript package that whatsapp-web.js loads at startup.');
line('None of them is compiled into Waggle code.');
line('packages as published into `resources/node_modules` of the desktop app; the server archive');
line('packs that folder as `node_modules`. The libvips packages (and, on Windows,');
line('`@img/sharp-win32-x64`) hold prebuilt shared libraries that sharp loads at runtime;');
line('node-webpmux is a JavaScript package that whatsapp-web.js loads at startup. None of them is');
line('compiled into Waggle code.');
if (lgplRows.some((row) => row.name === 'node-webpmux')) {
line('The npm package of node-webpmux holds its JavaScript source and `libwebp/binding.cpp`, the');
line('C++ binding compiled into its WebAssembly module.');
}
line();
line('What LGPL-3.0 asks when they are distributed with Waggle:');
line('What LGPL-3.0 asks, and how this distribution meets it:');
line();
line('1. Keep each library a separate file that the user can replace with a modified version');
line(' (section 4(d)). The packaged layout above does this; a signed macOS or Windows bundle');
line(' loses its signature when a file inside it is replaced, which the licensing review should');
line(' consider.');
line('2. Say prominently that the library is used and is covered by the LGPL, and ship the');
line(` LGPL-3.0 and GPL-3.0 texts with it (sections 4(a) and 4(b)). LGPL-3.0: ${textRef(lgplText, 'LGPL-3.0')}.`);
line(` GPL-3.0: ${textRef(gplText, 'GPL-3.0')}. The libvips packages contain no license file of their own.`);
line('3. Make the source of the exact library version available, or point to where it is');
line(' published (section 4(d)). The Source column links the npm tarballs; for the libvips');
line(' packages these contain only binaries, and the build scripts and the upstream versions');
line(' (`versions.json` in each package) are in the sharp-libvips repository of the same release.');
line('1. Say prominently that the libraries are used and are covered by the LGPL, and ship the');
line(' LGPL-3.0 and GPL-3.0 texts with them (sections 4(a) and 4(b)): this section and the two');
line(' texts. This file ships next to `service.js` in every desktop installer and in the server');
line(' archive, and Settings > General > Third-party licenses opens it.');
line('2. Keep each library a separate file that the user can replace with a modified,');
line(' interface-compatible version (section 4(d)(1)): the files above are separate and are');
line(' loaded at runtime. Replacing a file inside a signed macOS or Windows bundle breaks the');
line(' bundle signature; the server archive has no signature.');
line('3. Tell recipients where the corresponding source of each exact version is published');
line(' (section 4(d)(0) and section 6 of the GPL): the Corresponding source column above.');
line('4. Do not forbid users to modify the combined work or to reverse engineer it to debug such');
line(' modifications (section 4). MIT does not.');
line(' modifications (section 4). Waggle\'s licenses, MIT and Apache-2.0, do not.');
line();
const libvipsDir = ['darwin-arm64', 'darwin-x64', 'linux-x64', 'linuxmusl-x64', 'win32-x64']
.map((suffix) => path.join(ROOT, 'node_modules', '@img', `sharp-libvips-${suffix}`))
.find((dir) => fs.existsSync(path.join(dir, 'README.md')));
if (libvipsDir) {
const readme = fs.readFileSync(path.join(libvipsDir, 'README.md'), 'utf8');
const table = /## Licensing[\s\S]*?(\|[\s\S]*?\n)(?:\n[^|]|$)/.exec(readme);
if (table) {
line('The libvips packages bundle further libraries. Their README lists them as follows (for');
line('cairo under MPL-2.0, see below):');
line();
for (const row of table[1].trim().split('\n')) line(row);
line();
}
const readme = libvipsDir ? fs.readFileSync(path.join(libvipsDir, 'README.md'), 'utf8') : '';
const table = /## Licensing[\s\S]*?(\|[\s\S]*?\n)(?:\n[^|]|$)/.exec(readme);
if (table) {
const libraries = table[1].trim().split('\n').slice(2)
.map((row) => row.split('|').slice(1, -1).map((value) => value.trim()))
.map(([name, terms]) => ({ name, terms, version: bundledVersion(name) }));
const lgplLibraries = libraries.filter((library) => /LGPL/.test(library.terms));
line('The libvips packages bundle further libraries, which the sharp-libvips release above');
line('builds into the prebuilt libvips library at the versions in its `versions.json`. Their');
line('README lists their licenses as follows (for cairo under MPL-2.0, see below):');
line();
line('| Library | Version | Used under the terms of |');
line('|---|---|---|');
for (const library of libraries) line(`| ${library.name} | ${library.version} | ${library.terms} |`);
line();
line('The LGPLv3 libraries among them ship on the same terms as the libvips packages:');
line();
line(lgplLibraries.map((library) => `${library.name} ${library.version}`).join(', '));
line();
line('As the README notes, they are used under the LGPLv3 through the "any later version"');
line('clause of the LGPLv2 or LGPLv2.1. Each upstream project publishes its source at the');
line('version above; the build scripts of the sharp-libvips release download and build exactly');
line('those versions, so the release records which source went into the libvips packages.');
line();
}
}
@@ -370,8 +446,8 @@ if (groups.none.length > 0 || groups.other.length > 0) {
line('### No license or an unrecognised license');
line();
componentTable([...groups.none, ...groups.other].sort(byNameAndVersion));
line('Without a license grant the code cannot be redistributed. These need a decision of the');
line('licensing review or a dependency change before release.');
line('Without a license grant the code cannot be redistributed. These need a license from their');
line('authors or a dependency change before release.');
line();
}