Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AIX support #1295

Merged
merged 1 commit into from
Nov 10, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions nvm.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -1445,6 +1445,7 @@ nvm_get_os() {
Darwin\ *) NVM_OS=darwin ;;
SunOS\ *) NVM_OS=sunos ;;
FreeBSD\ *) NVM_OS=freebsd ;;
AIX\ *) NVM_OS=aix ;;
esac
nvm_echo "${NVM_OS-}"
}
Expand All @@ -1467,6 +1468,8 @@ nvm_get_arch() {
else
HOST_ARCH=$(echo "$HOST_ARCH" | command tail -1)
fi
elif [ "_$NVM_OS" = "_aix" ]; then
HOST_ARCH=ppc64
else
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please leave these blank lines

HOST_ARCH="$(command uname -m)"
fi
Expand Down Expand Up @@ -1590,10 +1593,15 @@ nvm_install_binary() {
if [ -f "${TARBALL}" ]; then
TMPDIR="$(dirname "${TARBALL}")/files"
fi
local tar
tar='tar'
if [ "${NVM_OS}" = 'aix' ]; then
tar='gtar'
fi
if (
[ -n "${TMPDIR-}" ] && \
command mkdir -p "${TMPDIR}" && \
command tar -x${tar_compression_flag}f "${TARBALL}" -C "${TMPDIR}" --strip-components 1 && \
command "${tar}" -x${tar_compression_flag}f "${TARBALL}" -C "${TMPDIR}" --strip-components 1 && \
VERSION_PATH="$(nvm_version_path "${PREFIXED_VERSION}")" && \
command mkdir -p "${VERSION_PATH}" && \
command mv "${TMPDIR}/"* "${VERSION_PATH}" && \
Expand Down Expand Up @@ -1768,6 +1776,8 @@ nvm_get_make_jobs() {
NVM_CPU_THREADS="$(sysctl -n hw.ncpu)"
elif [ "_$NVM_OS" = "_sunos" ]; then
NVM_CPU_THREADS="$(psrinfo | wc -l)"
elif [ "_$NVM_OS" = "_aix" ]; then
NVM_CPU_THREADS="$(lsconf|grep 'Number Of Processors:'| awk '{print $4}')"
fi
if ! nvm_is_natural_num "$NVM_CPU_THREADS" ; then
nvm_err 'Can not determine how many thread(s) we can use, set to only 1 now.'
Expand Down Expand Up @@ -1832,7 +1842,9 @@ nvm_install_source() {
make='make'
if [ "${NVM_OS}" = 'freebsd' ]; then
make='gmake'
MAKE_CXX='CXX=c++'
MAKE_CXX='CXX=c++'
elif [ "${NVM_OS}" = 'aix' ]; then
make='gmake'
fi

local tar_compression_flag
Expand All @@ -1841,6 +1853,12 @@ nvm_install_source() {
tar_compression_flag='J'
fi

local tar
tar='tar'
if [ "${NVM_OS}" = 'aix' ]; then
tar='gtar'
fi

local TARBALL
local TMPDIR
local VERSION_PATH
Expand All @@ -1851,7 +1869,7 @@ nvm_install_source() {
[ -f "${TARBALL}" ] && \
TMPDIR="$(dirname "${TARBALL}")/files" && \
command mkdir -p "${TMPDIR}" && \
command tar -x${tar_compression_flag}f "${TARBALL}" -C "${TMPDIR}" --strip-components 1 && \
command "${tar}" -x${tar_compression_flag}f "${TARBALL}" -C "${TMPDIR}" --strip-components 1 && \
VERSION_PATH="$(nvm_version_path "${PREFIXED_VERSION}")" && \
nvm_cd "${TMPDIR}" && \
./configure --prefix="${VERSION_PATH}" $ADDITIONAL_PARAMETERS && \
Expand Down