Add AIX support

Currently AIX isn't supported in nvm so I have made a few small changes
to make this work:
change tar to gtar for AIX
change make to gmake for AIX
Set ARCH as ppc64 for AIX
George Adams 2016-11-10 11:53:48 +00:00
parent 9c92b5a4ea
commit 8f82eab5db
1 changed files with 21 additions and 3 deletions

24
nvm.sh 100644 → 100755
View File

@ -1445,6 +1445,7 @@ nvm_get_os() {
Darwin\ *) NVM_OS=darwin ;; Darwin\ *) NVM_OS=darwin ;;
SunOS\ *) NVM_OS=sunos ;; SunOS\ *) NVM_OS=sunos ;;
FreeBSD\ *) NVM_OS=freebsd ;; FreeBSD\ *) NVM_OS=freebsd ;;
AIX\ *) NVM_OS=aix ;;
esac esac
nvm_echo "${NVM_OS-}" nvm_echo "${NVM_OS-}"
} }
@ -1467,6 +1468,8 @@ nvm_get_arch() {
else else
HOST_ARCH=$(echo "$HOST_ARCH" | command tail -1) HOST_ARCH=$(echo "$HOST_ARCH" | command tail -1)
fi fi
elif [ "_$NVM_OS" = "_aix" ]; then
HOST_ARCH=ppc64
else else
HOST_ARCH="$(command uname -m)" HOST_ARCH="$(command uname -m)"
fi fi
@ -1590,10 +1593,15 @@ nvm_install_binary() {
if [ -f "${TARBALL}" ]; then if [ -f "${TARBALL}" ]; then
TMPDIR="$(dirname "${TARBALL}")/files" TMPDIR="$(dirname "${TARBALL}")/files"
fi fi
local tar
tar='tar'
if [ "${NVM_OS}" = 'aix' ]; then
tar='gtar'
fi
if ( if (
[ -n "${TMPDIR-}" ] && \ [ -n "${TMPDIR-}" ] && \
command mkdir -p "${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}")" && \ VERSION_PATH="$(nvm_version_path "${PREFIXED_VERSION}")" && \
command mkdir -p "${VERSION_PATH}" && \ command mkdir -p "${VERSION_PATH}" && \
command mv "${TMPDIR}/"* "${VERSION_PATH}" && \ command mv "${TMPDIR}/"* "${VERSION_PATH}" && \
@ -1768,6 +1776,8 @@ nvm_get_make_jobs() {
NVM_CPU_THREADS="$(sysctl -n hw.ncpu)" NVM_CPU_THREADS="$(sysctl -n hw.ncpu)"
elif [ "_$NVM_OS" = "_sunos" ]; then elif [ "_$NVM_OS" = "_sunos" ]; then
NVM_CPU_THREADS="$(psrinfo | wc -l)" NVM_CPU_THREADS="$(psrinfo | wc -l)"
elif [ "_$NVM_OS" = "_aix" ]; then
NVM_CPU_THREADS="$(lsconf|grep 'Number Of Processors:'| awk '{print $4}')"
fi fi
if ! nvm_is_natural_num "$NVM_CPU_THREADS" ; then 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.' nvm_err 'Can not determine how many thread(s) we can use, set to only 1 now.'
@ -1832,7 +1842,9 @@ nvm_install_source() {
make='make' make='make'
if [ "${NVM_OS}" = 'freebsd' ]; then if [ "${NVM_OS}" = 'freebsd' ]; then
make='gmake' make='gmake'
MAKE_CXX='CXX=c++' MAKE_CXX='CXX=c++'
elif [ "${NVM_OS}" = 'aix' ]; then
make='gmake'
fi fi
local tar_compression_flag local tar_compression_flag
@ -1841,6 +1853,12 @@ nvm_install_source() {
tar_compression_flag='J' tar_compression_flag='J'
fi fi
local tar
tar='tar'
if [ "${NVM_OS}" = 'aix' ]; then
tar='gtar'
fi
local TARBALL local TARBALL
local TMPDIR local TMPDIR
local VERSION_PATH local VERSION_PATH
@ -1851,7 +1869,7 @@ nvm_install_source() {
[ -f "${TARBALL}" ] && \ [ -f "${TARBALL}" ] && \
TMPDIR="$(dirname "${TARBALL}")/files" && \ TMPDIR="$(dirname "${TARBALL}")/files" && \
command mkdir -p "${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}")" && \ VERSION_PATH="$(nvm_version_path "${PREFIXED_VERSION}")" && \
nvm_cd "${TMPDIR}" && \ nvm_cd "${TMPDIR}" && \
./configure --prefix="${VERSION_PATH}" $ADDITIONAL_PARAMETERS && \ ./configure --prefix="${VERSION_PATH}" $ADDITIONAL_PARAMETERS && \