mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-10 14:21:50 +00:00
support build on OpenBSD with bash, gtar, gmake and libexecinfo
This commit is contained in:
parent
72a2ba90fd
commit
79e13d5bd8
39
nvm.sh
39
nvm.sh
@ -1763,7 +1763,7 @@ nvm_install_binary() {
|
||||
fi
|
||||
local tar
|
||||
tar='tar'
|
||||
if [ "${NVM_OS}" = 'aix' ]; then
|
||||
if [ "${NVM_OS}" = 'aix' ] || [ "${NVM_OS}" = 'openbsd' ]; then
|
||||
tar='gtar'
|
||||
fi
|
||||
if (
|
||||
@ -2013,7 +2013,7 @@ nvm_get_make_jobs() {
|
||||
"_linux")
|
||||
NVM_CPU_CORES="$(nvm_grep -c -E '^processor.+: [0-9]+' /proc/cpuinfo)"
|
||||
;;
|
||||
"_freebsd" | "_darwin")
|
||||
"_freebsd" | "_openbsd" | "_darwin")
|
||||
NVM_CPU_CORES="$(sysctl -n hw.ncpu)"
|
||||
;;
|
||||
"_sunos")
|
||||
@ -2090,7 +2090,7 @@ nvm_install_source() {
|
||||
make='make'
|
||||
local MAKE_CXX
|
||||
case "${NVM_OS}" in
|
||||
'freebsd')
|
||||
'freebsd' | 'openbsd')
|
||||
make='gmake'
|
||||
MAKE_CXX="CC=${CC:-cc} CXX=${CXX:-c++}"
|
||||
;;
|
||||
@ -2108,6 +2108,12 @@ nvm_install_source() {
|
||||
fi
|
||||
fi
|
||||
|
||||
local tar
|
||||
tar='tar'
|
||||
if [ "${NVM_OS}" = 'aix' ] || [ "${NVM_OS}" = 'openbsd' ]; then
|
||||
tar='gtar'
|
||||
fi
|
||||
|
||||
local TARBALL
|
||||
local TMPDIR
|
||||
local VERSION_PATH
|
||||
@ -2124,11 +2130,26 @@ nvm_install_source() {
|
||||
TARBALL="$(PROGRESS_BAR="${PROGRESS_BAR}" nvm_download_artifact "${FLAVOR}" source "${TYPE}" "${VERSION}" | command tail -1)" && \
|
||||
[ -f "${TARBALL}" ] && \
|
||||
TMPDIR="$(nvm_extract_tar_artifact "${TARBALL}" "${NVM_OS}" | command tail -1)" && \
|
||||
|
||||
local configure_env
|
||||
# Node's configure.py sets gcc and g++ by default except for darwin
|
||||
# OpenBSD needs to use cc and c++
|
||||
if [ "${NVM_OS}" = 'openbsd' ]; then
|
||||
configure_env="CC=cc CXX=c++"
|
||||
fi
|
||||
|
||||
if ! (
|
||||
VERSION_PATH="$(nvm_version_path "${PREFIXED_VERSION}")" && \
|
||||
nvm_cd "${TMPDIR}" && \
|
||||
nvm_echo '$>'./configure --prefix="${VERSION_PATH}" $ADDITIONAL_PARAMETERS'<' && \
|
||||
./configure --prefix="${VERSION_PATH}" $ADDITIONAL_PARAMETERS && \
|
||||
nvm_echo '$>'env ${configure_env} ./configure --prefix="${VERSION_PATH}" ${ADDITIONAL_PARAMETERS}'<' && \
|
||||
env ${configure_env} ./configure --prefix="${VERSION_PATH}" ${ADDITIONAL_PARAMETERS} && \
|
||||
|
||||
# Post-configure: OpenBSD needs to remove the ldl flag in the OpenSSL dep
|
||||
if [ "${NVM_OS}" = 'openbsd' ]; then
|
||||
sed -i 's/-ldl //' ${TMPDIR}/out/deps/openssl/openssl.target.mk
|
||||
sed -i 's/-ldl //' ${TMPDIR}/out/deps/openssl/openssl-cli.target.mk
|
||||
fi
|
||||
|
||||
$make -j "${NVM_MAKE_JOBS}" ${MAKE_CXX-} && \
|
||||
command rm -f "${VERSION_PATH}" 2>/dev/null && \
|
||||
$make -j "${NVM_MAKE_JOBS}" ${MAKE_CXX-} install
|
||||
@ -2533,7 +2554,7 @@ nvm() {
|
||||
local TEST_TOOLS ADD_TEST_TOOLS
|
||||
TEST_TOOLS="git grep awk"
|
||||
ADD_TEST_TOOLS="sed cut basename rm mkdir xargs"
|
||||
if [ "darwin" != "$(nvm_get_os)" ] && [ "freebsd" != "$(nvm_get_os)" ]; then
|
||||
if [ "darwin" != "$(nvm_get_os)" ] && [ "freebsd" != "$(nvm_get_os)" ] && [ "openbsd" != "$(nvm_get_os)" ]; then
|
||||
TEST_TOOLS="${TEST_TOOLS} ${ADD_TEST_TOOLS}"
|
||||
else
|
||||
for tool in ${ADD_TEST_TOOLS} ; do
|
||||
@ -2786,10 +2807,10 @@ nvm() {
|
||||
EXIT_CODE=0
|
||||
else
|
||||
|
||||
if [ "_${NVM_OS}" = "_freebsd" ]; then
|
||||
# node.js and io.js do not have a FreeBSD binary
|
||||
if [ "_${NVM_OS}" = "_freebsd" ] || [ "_${NVM_OS}" = "_openbsd" ]; then
|
||||
# node.js and io.js do not have a FreeBSD/OpenBSD binary
|
||||
nobinary=1
|
||||
nvm_err "Currently, there is no binary for FreeBSD"
|
||||
nvm_err "Currently, there is no binary for ${NVM_OS}"
|
||||
elif [ "_${NVM_OS}" = "_sunos" ]; then
|
||||
# Not all node/io.js versions have a Solaris binary
|
||||
if ! nvm_has_solaris_binary "${VERSION}"; then
|
||||
|
Loading…
Reference in New Issue
Block a user