From db7494494cd9952ee8aae2073140d15c012b204a Mon Sep 17 00:00:00 2001 From: jnlin Date: Wed, 24 Apr 2013 15:42:10 +0800 Subject: [PATCH] Add FreeBSD support --- nvm.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/nvm.sh b/nvm.sh index 10b153a..640e2cc 100755 --- a/nvm.sh +++ b/nvm.sh @@ -142,6 +142,7 @@ nvm() Linux\ *) os=linux ;; Darwin\ *) os=darwin ;; SunOS\ *) os=sunos ;; + FreeBSD\ *) os=freebsd ;; esac case "$uname" in *x86_64*) arch=x64 ;; @@ -211,6 +212,10 @@ nvm() shift fi + if [ "$os" = "freebsd" ]; then + nobinary=1 + fi + VERSION=`nvm_remote_version $1` ADDITIONAL_PARAMETERS='' @@ -263,6 +268,10 @@ nvm() tarball='' sum='' + make='make' + if [ "$os" = "freebsd" ]; then + make='gmake' + fi if [ "`curl -Is "http://nodejs.org/dist/$VERSION/node-$VERSION.tar.gz" | grep '200 OK'`" != '' ]; then tarball="http://nodejs.org/dist/$VERSION/node-$VERSION.tar.gz" sum=`curl -s http://nodejs.org/dist/$VERSION/SHASUMS.txt | grep node-$VERSION.tar.gz | awk '{print $1}'` @@ -278,9 +287,9 @@ nvm() tar -xzf "node-$VERSION.tar.gz" && \ cd "node-$VERSION" && \ ./configure --prefix="$NVM_DIR/$VERSION" $ADDITIONAL_PARAMETERS && \ - make && \ + $make && \ rm -f "$NVM_DIR/$VERSION" 2>/dev/null && \ - make install + $make install ) then nvm use $VERSION