81 lines
2.6 KiB
Bash
81 lines
2.6 KiB
Bash
# Copyright 2026 Gentoo Authors
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
EAPI=8
|
|
|
|
CRATES="
|
|
"
|
|
|
|
NODE_SEMVER_COMMIT="3d74d6b7f4de1de2006cf2f7663aac09de65b1f6"
|
|
DASHMAP_COMMIT="4401b5c0b2626266dd5d5a9202677bca8b53e57a"
|
|
LIBSQL_COMMIT="ab8a7516c7d32d6fdd0f68d59956c6233f9f11d4"
|
|
declare -A GIT_CRATES=(
|
|
[node-semver]="https://github.com/pnpm/node-semver-rs;${NODE_SEMVER_COMMIT};node-semver-rs-%commit%"
|
|
[dashmap]="https://github.com/pnpm/dashmap;${DASHMAP_COMMIT};dashmap-%commit%"
|
|
[libsql]="https://github.com/pnpm/libsql;${LIBSQL_COMMIT};libsql-%commit%/libsql"
|
|
)
|
|
|
|
RUST_MIN_VER="1.98.0"
|
|
|
|
inherit cargo wrapper
|
|
|
|
DESCRIPTION="Fast, disk space efficient package manager"
|
|
HOMEPAGE="https://pnpm.io"
|
|
SRC_URI="
|
|
https://github.com/pnpm/pnpm/archive/v${PV}.tar.gz -> ${P}.tar.gz
|
|
https://github.com/gentoo-zh-drafts/pnpm/releases/download/v${PV}/${P}-crates.tar.xz
|
|
https://github.com/gentoo-zh-drafts/pnpm/releases/download/v${PV}/${P}-cas-loader.mjs.inc
|
|
${CARGO_CRATE_URIS}
|
|
"
|
|
|
|
LICENSE="MIT"
|
|
# Dependent crate licenses
|
|
LICENSE+="
|
|
0BSD Apache-2.0 Apache-2.0-with-LLVM-exceptions Boost-1.0 BSD-1 BSD-2 BSD
|
|
CC0-1.0 CDLA-Permissive-2.0 GPL-2 ISC LGPL-2.1+ MIT MIT-0 MPL-2.0
|
|
Unicode-3.0 Unlicense ZLIB
|
|
"
|
|
SLOT="0"
|
|
KEYWORDS="~amd64 ~arm64"
|
|
RESTRICT="test"
|
|
|
|
RDEPEND="net-libs/nodejs"
|
|
|
|
src_prepare() {
|
|
default
|
|
|
|
cp "${DISTDIR}/${P}-cas-loader.mjs.inc" pnpm/crates/deps-restorer/src/cas-loader.mjs.inc || die
|
|
|
|
# upstream's .cargo/config.toml redirects crates-io to a pnpm-managed
|
|
# vendor dir that only exists after "pnpm install"; it shadows the
|
|
# eclass registry in ${ECARGO_HOME}
|
|
rm .cargo/config.toml || die
|
|
|
|
# upstream overrides crates-io node-semver with its git fork; use the fetched tree
|
|
sed -i "s|^node-semver = { git = .*|node-semver = { path = \"${WORKDIR}/node-semver-rs-${NODE_SEMVER_COMMIT}\" }|" \
|
|
Cargo.toml || die
|
|
|
|
# upstream patches crates-io dashmap with its git fork; use the fetched tree
|
|
sed -i "s|^dashmap = { git = .*|dashmap = { path = \"${WORKDIR}/dashmap-${DASHMAP_COMMIT}\" }|" \
|
|
Cargo.toml || die
|
|
|
|
# upstream patches crates-io libsql with its git fork; use the fetched tree,
|
|
# whose sibling crates resolve through the fork's own workspace
|
|
sed -i "s|^libsql = { git = .*|libsql = { path = \"${WORKDIR}/libsql-${LIBSQL_COMMIT}/libsql\" }|" \
|
|
Cargo.toml || die
|
|
}
|
|
|
|
src_compile() {
|
|
cargo_src_compile -p pnpm-cli
|
|
}
|
|
|
|
src_install() {
|
|
# The workspace root is a virtual manifest and cargo install takes no -p.
|
|
cargo_src_install --path pnpm/crates/cli
|
|
|
|
# The executable resolves its own path, so an alias cannot be a symlink.
|
|
make_wrapper pn pnpm
|
|
make_wrapper pnpx "pnpm dlx"
|
|
make_wrapper pnx "pnpm dlx"
|
|
}
|