A package manager for javascript
| runtime dependencies | python-semver (Interpreter languages and scripting) |
|---|---|
| libglvnd (Graphic libraries) | |
| nodejs-git | |
| nodejs-nopt | |
| make dependencies | npm |
mkdir /data/buildroot/package/node-gyp
cat > /data/buildroot/package/node-gyp/Config.in<< 'EOF'
config BR2_PACKAGE_NODE_GYP
bool "node-gyp"
depends on BR2_PACKAGE_NODEJS_NOPT
depends on BR2_PACKAGE_PYTHON_SEMVER
depends on BR2_PACKAGE_LIBGLVND
depends on BR2_PACKAGE_NODEJS_GIT
help
A package manager for javascript
EOF
cat > /data/buildroot/package/node-gyp/node-gyp.mk<< 'EOF'
#############################################################
#
# node-gyp
# https://github.com/nodejs/node-gyp/archive/refs/tags/v9.0.0.tar.gz
#
#############################################################
NODE_GYP_VERSION = 9.0.0
NODE_GYP_SOURCE = v$(NODE_GYP_VERSION).tar.gz
NODE_GYP_SITE = https://github.com/nodejs/node-gyp/archive/refs/tags
NODE_GYP_DEPENDENCIES = nodejs-nopt nodejs python-semver libglvnd
define NODE_GYP_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 NODE_GYP_BUILD_CMDS
cd $(@D)/ && \
NODE_PATH=/usr/lib/node_modules make
endef
define NODE_GYP_INSTALL_TARGET_CMDS
npm install -g --prefix "$(@D)"/usr "$(TARGET_DIR)"/node-gyp-$(NODE_GYP_VERSION).tgz
rm -r "$(@D)"/usr/lib/node_modules/node-gyp/node_modules/{,.bin/}nopt
rm -r "$(@D)"/usr/lib/node_modules/node-gyp/node_modules/{,.bin/}semver
install -d "$(@D)"/usr/share/licenses/node-gyp
ln -s ../../../lib/node_modules/node-gyp/LICENSE "$(TARGET_DIR)"/usr/share/licenses/node-gyp/LICENSE
endef
$(eval $(generic-package))
EOF
sed -i '/menu "Custom packages"/a source "package/node-gyp/Config.in"' /data/buildroot/package/Config.in