Skip to content

Commit

Permalink
node no longer a submodule
Browse files Browse the repository at this point in the history
stack does a deep clone of all submodules when nodejs-exec is used as a dependency,
which takes a looong time.

now it isn't cloned if it is already installed, and when it is cloned it is only a shallow (must faster) clone.
  • Loading branch information
yairchu committed Sep 20, 2017
1 parent b8d49be commit d98aba5
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.stack-work
/dist
/dist
/bin
/node
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

2 changes: 1 addition & 1 deletion Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import System.Directory
import System.FilePath ((</>))

nodeRelPath :: FilePath
nodeRelPath = "node/node"
nodeRelPath = "bin/node"

buildNode :: Verbosity -> IO ()
buildNode verbosity =
Expand Down
8 changes: 6 additions & 2 deletions build_node.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
#!/bin/bash

mkdir -p bin

# adapted from https://apple.stackexchange.com/a/123408/11374
function version { echo "${@//v}" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }

NODE_VERSION=`node --version`

if [ $(version "$NODE_VERSION") -ge $(version "v6.2.1") ]; then
echo "Using existing system node $NODE_VERSION"
cp `which node` node/node
cp `which node` bin/node
else
echo "Building nodejs from source"
# node not available or too old. Build from source.
git submodule update --init --recursive
git clone --depth 1 -b v6.11.3 https://github.com/nodejs/node.git
cd node
./configure --prefix=/tmp
make -j4
cd ..
cp node/node bin/node
fi
1 change: 0 additions & 1 deletion node
Submodule node deleted from dbce2e
2 changes: 1 addition & 1 deletion nodejs-exec.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ copyright: 2016 Yair
category: Foreign
build-type: Custom
cabal-version: >=1.8
data-files: node/node
data-files: bin/node

library
hs-source-dirs: src
Expand Down

0 comments on commit d98aba5

Please sign in to comment.