]> rtime.felk.cvut.cz Git - coffee/buildroot.git/commitdiff
package/nodejs: symlink /usr/lib/node_modules/.bin/* to /usr/bin
authorMartin Bark <martin@barkynet.com>
Thu, 2 Jul 2015 09:43:25 +0000 (10:43 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sat, 4 Jul 2015 12:38:13 +0000 (14:38 +0200)
This patch symlinks all executables in /usr/lib/node_modules/.bin
to /usr/bin so that node.js modules installed using
BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL are accessible from the command line.

Signed-off-by: Martin Bark <martin@barkynet.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/nodejs/nodejs.mk

index 59e03b0095f6352b9a388041fc5f00858b6580fa..0b3f8a51c248a8bddc8327c4a3876e1726ca7048 100644 (file)
@@ -111,6 +111,14 @@ define NODEJS_INSTALL_MODULES
                $(HOST_DIR)/usr/bin/npm install \
                $(NODEJS_MODULES_LIST) \
        )
+
+       # Symlink all executables in $(TARGET_DIR)/usr/lib/node_modules/.bin to
+       # $(TARGET_DIR)/usr/bin so they are accessible from the command line
+       cd $(TARGET_DIR)/usr/bin; \
+       for f in ../../usr/lib/node_modules/.bin/*; do \
+               [ -f "$${f}" -a -x "$${f}" ] || continue; \
+               ln -sf "$${f}" "$${f##*/}" || exit 1; \
+       done
 endef
 endif