buildroot:npm
npm
A package manager for javascript
| runtime dependencies | python-semver (External python module) |
|---|---|
| libglvnd (Graphic libraries) | |
| nodejs (Interpreter languages and scripting) | |
| nodejs-nopt | |
| node-gyp | |
| make dependencies | libxi-dev |
| marked | |
| marked-man | |
| procps-ng (System tools) | |
| python | |
| libbz2-dev |
mkdir /data/buildroot/package/npm
cat > /data/buildroot/package/npm/Config.in<< 'EOF'
config BR2_PACKAGE_NPM
bool "npm"
depends on BR2_PACKAGE_NODE_GYP
depends on BR2_PACKAGE_NODEJS_NOPT
depends on BR2_PACKAGE_PYTHON_SEMVER
depends on BR2_PACKAGE_LIBGLVND
depends on BR2_PACKAGE_NODEJS
help
A package manager for javascript
EOF
cat > /data/buildroot/package/npm/npm.mk<< 'EOF'
#############################################################
#
# npm (https://archlinux.org/packages/community/any/npm/)
# https://github.com/npm/cli/archive/v$pkgver.tar.gz
# sha512sums= 19c92af65450c9b0534ad79b8c1f503594d6bed15bdb3f35fb82b64bce01b770f902a59b50ebe867497c81b173cde28eb818b8c2ef4bd35b308f19a33b3cdcbc
#############################################################
NPM_VERSION = 8.5.5
NPM_SOURCE = npm-$(NPM_VERSION).tar.gz
NPM_SITE = https://github.com/go-gitea/gitea/releases/download/$(NPM_VERSION)
NPM_DEPENDENCIES = node-gyp nodejs-nopt python-semver libglvnd nodejs
define NPM_CONFIGURE_CMDS
mkdir -p $(@D)/node_modules/.bin
ln -sf /usr/bin/marked{,-man} node_modules/.bin/
sed -i 's|node bin/npm-cli.js install marked|true |' $(@D)/Makefile
sed -i 's/install: all/install:/' $(@D)/Makefile
mkdir -p $(@D)/man/man1
endef
define NPM_BUILD_CMDS
cd $(@D)/ && \
NODE_PATH=/usr/lib/node_modules make
endef
define NPM_INSTALL_TARGET_CMDS
node "$(@D)"/bin/npm-cli.js install -g -f --prefix="$(TARGET_DIR)/usr" $(node "$(@D)"/bin/npm-cli.js pack | tail -1)
rm -r "$(TARGET_DIR)"/usr/lib/node_modules/npm/node_modules/{,.bin/}semver
rm -r "$(TARGET_DIR)"/usr/lib/node_modules/npm/node_modules/{,.bin/}node-gyp
rm -r "$(TARGET_DIR)"/usr/lib/node_modules/npm/node_modules/{,.bin/}nopt
sed -i 's|../../node_modules/node-gyp/bin/node-gyp.js|../../../node-gyp/bin/node-gyp.js|' \
"$(TARGET_DIR)"/usr/lib/node_modules/npmbin/node-gyp-bin/node-gyp
install -dm755 "$(TARGET_DIR)"/usr/share/bash-completion/completions
node "$(@D)"/cli-$pkgver/bin/npm-cli.js completion > "$(TARGET_DIR)"/usr/share/bash-completion/completions/npm
mv "$(TARGET_DIR)"/usr/lib/node_modules/npm/man "$(TARGET_DIR)"/usr/share/
install -Dm644 "$(@D)"/cli-$pkgver/LICENSE "$(TARGET_DIR)"/usr/share/licenses/$pkgname/LICENSE
endef
$(eval $(generic-package))
EOF
sed -i '/menu "Custom packages"/a source "package/npm/Config.in"' /data/buildroot/package/Config.in
buildroot/npm.txt · Last modified: 2025/02/19 10:59 by 127.0.0.1
