Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Default jobs to number of CPUs

Close #35
  • Loading branch information...
commit 5bc6eac40beffef297584c759958766b39fe3e00 1 parent 7c353be
@isaacs authored
Showing with 11 additions and 3 deletions.
  1. +4 −0 README.md
  2. +7 −3 nave.sh
View
4 README.md
@@ -55,6 +55,10 @@ to where you were before using nave.
test npm, so installing it in the subshell doesn't help much.) This
can be set in the `~/.naverc` file, or in your normal
`~/.bash{rc,_profile}` files.
+* `$NAVE_JOBS` If set, this will be the number of jobs to run when
+ building node. If this isn't set, it'll use the `$JOBS` env, then try
+ to guess a reasonable value based on the number of CPUs, then fall
+ back on 2 if `sysctl -n hw.ncpu` fails.
## Compatibility
View
10 nave.sh
@@ -178,15 +178,19 @@ build () {
local version="$1"
nave_fetch "$version"
local src="$NAVE_SRC/$version"
+ local jobs=$NAVE_JOBS
+ jobs=${jobs:-$JOBS}
+ jobs=${jobs:-$(sysctl -n hw.ncpu)}
@Raynos
Raynos added a note

sysctl does not exist on joyent so this breaks of JOBS is not set

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ jobs=${jobs:-2}
( cd -- "$src"
[ -f ~/.naverc ] && . ~/.naverc || true
if [ "$NAVE_CONFIG" == "" ]; then
NAVE_CONFIG=("--debug")
fi
- JOBS=${JOBS:-2} ./configure "${NAVE_CONFIG[@]}" --prefix="$2" \
+ JOBS=$jobs ./configure "${NAVE_CONFIG[@]}" --prefix="$2" \
|| fail "Failed to configure $version"
- JOBS=${JOBS:-2} make \
+ JOBS=$jobs make -j$jobs \
|| fail "Failed to make $version"
make install || fail "Failed to install $version"
) || fail "fail"
@@ -340,7 +344,7 @@ organize_version_list () {
nave_has () {
local version=$(ver "$1")
- [ -d "$NAVE_SRC/$version" ] || return 1
+ [ -d "$NAVE_SRC/$version/configure" ] || return 1
}
nave_installed () {
Please sign in to comment.
Something went wrong with that request. Please try again.