Skip to content

Commit

Permalink
build,test: add proper support for IBM i
Browse files Browse the repository at this point in the history
Python 3.9 on IBM i now properly returns "os400" for sys.platform
instead of claiming to be AIX as it did previously. While the IBM i PASE
environment is compatible with AIX, it is a subset and has numerous
differences which makes it beneficial to distinguish, however this means
that it now needs explicit support here.

PR-URL: #46739
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
  • Loading branch information
dmabupt authored and danielleadams committed Apr 5, 2023
1 parent 44375c6 commit 4b25b98
Show file tree
Hide file tree
Showing 17 changed files with 59 additions and 36 deletions.
3 changes: 3 additions & 0 deletions Makefile
Expand Up @@ -368,6 +368,9 @@ DOCBUILDSTAMP_PREREQS = tools/doc/addon-verify.mjs doc/api/addons.md
ifeq ($(OSTYPE),aix)
DOCBUILDSTAMP_PREREQS := $(DOCBUILDSTAMP_PREREQS) out/$(BUILDTYPE)/node.exp
endif
ifeq ($(OSTYPE),os400)
DOCBUILDSTAMP_PREREQS := $(DOCBUILDSTAMP_PREREQS) out/$(BUILDTYPE)/node.exp
endif

node_use_openssl = $(call available-node,"-p" \
"process.versions.openssl != undefined")
Expand Down
12 changes: 6 additions & 6 deletions common.gypi
Expand Up @@ -137,7 +137,7 @@
'defines': [ 'DEBUG', '_DEBUG', 'V8_ENABLE_CHECKS' ],
'cflags': [ '-g', '-O0' ],
'conditions': [
['OS=="aix"', {
['OS in "aix os400"', {
'cflags': [ '-gxcoff' ],
'ldflags': [ '-Wl,-bbigtoc' ],
}],
Expand Down Expand Up @@ -393,11 +393,11 @@
'BUILDING_UV_SHARED=1',
],
}],
[ 'OS in "linux freebsd openbsd solaris aix"', {
[ 'OS in "linux freebsd openbsd solaris aix os400"', {
'cflags': [ '-pthread' ],
'ldflags': [ '-pthread' ],
}],
[ 'OS in "linux freebsd openbsd solaris android aix cloudabi"', {
[ 'OS in "linux freebsd openbsd solaris android aix os400 cloudabi"', {
'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++17' ],
'defines': [ '__STDC_FORMAT_MACROS' ],
Expand All @@ -421,11 +421,11 @@
'cflags': [ '-m64' ],
'ldflags': [ '-m64' ],
}],
[ 'target_arch=="ppc" and OS!="aix"', {
[ 'target_arch=="ppc" and OS not in "aix os400"', {
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ],
}],
[ 'target_arch=="ppc64" and OS!="aix"', {
[ 'target_arch=="ppc64" and OS not in "aix os400"', {
'cflags': [ '-m64', '-mminimal-toc' ],
'ldflags': [ '-m64' ],
}],
Expand All @@ -444,7 +444,7 @@
}],
],
}],
[ 'OS=="aix"', {
[ 'OS in "aix os400"', {
'variables': {
# Used to differentiate `AIX` and `OS400`(IBM i).
'aix_variant_name': '<!(uname -s)',
Expand Down
9 changes: 7 additions & 2 deletions configure.py
Expand Up @@ -45,7 +45,7 @@
parser = argparse.ArgumentParser()

valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux',
'android', 'aix', 'cloudabi', 'ios')
'android', 'aix', 'cloudabi', 'os400', 'ios')
valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'mips64el', 'ppc',
'ppc64', 'x64', 'x86', 'x86_64', 's390x', 'riscv64', 'loong64')
valid_arm_float_abi = ('soft', 'softfp', 'hard')
Expand Down Expand Up @@ -1325,7 +1325,7 @@ def configure_node(o):
elif sys.platform == 'zos':
configure_zos(o)

if flavor == 'aix':
if flavor in ('aix', 'os400'):
o['variables']['node_target_type'] = 'static_library'

if target_arch in ('x86', 'x64', 'ia32', 'x32'):
Expand Down Expand Up @@ -1446,6 +1446,8 @@ def configure_node(o):
shlib_suffix = '%s.dylib'
elif sys.platform.startswith('aix'):
shlib_suffix = '%s.a'
elif sys.platform == 'os400':
shlib_suffix = '%s.a'
elif sys.platform.startswith('zos'):
shlib_suffix = '%s.x'
else:
Expand Down Expand Up @@ -1959,6 +1961,9 @@ def icu_download(path):
elif flavor == 'mac':
icu_config['variables']['icu_asm_ext'] = 'S'
icu_config['variables']['icu_asm_opts'] = [ '-a', 'gcc-darwin' ]
elif sys.platform == 'os400':
icu_config['variables']['icu_asm_ext'] = 'S'
icu_config['variables']['icu_asm_opts'] = [ '-a', 'xlc' ]
elif sys.platform.startswith('aix'):
icu_config['variables']['icu_asm_ext'] = 'S'
icu_config['variables']['icu_asm_opts'] = [ '-a', 'xlc' ]
Expand Down
2 changes: 1 addition & 1 deletion deps/cares/cares.gyp
Expand Up @@ -9,7 +9,7 @@
'_GNU_SOURCE'
]
}],
[ 'OS=="aix"', {
[ 'OS in "aix os400"', {
'include_dirs': [ 'config/aix' ],
'sources': [ 'config/aix/ares_config.h' ],
'defines': [
Expand Down
2 changes: 1 addition & 1 deletion deps/uv/common.gypi
Expand Up @@ -135,7 +135,7 @@
}]
]
}],
['OS in "freebsd dragonflybsd linux openbsd solaris android aix"', {
['OS in "freebsd dragonflybsd linux openbsd solaris android aix os400"', {
'cflags': [ '-Wall' ],
'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
'target_conditions': [
Expand Down
15 changes: 15 additions & 0 deletions deps/uv/uv.gyp
Expand Up @@ -326,6 +326,21 @@
}],
]
}],
[ 'OS=="os400"', {
'sources': [
'src/unix/aix-common.c',
'src/unix/ibmi.c',
'src/unix/posix-poll.c',
'src/unix/no-fsevents.c',
'src/unix/no-proctitle.c',
],
'defines': [
'_ALL_SOURCE',
'_XOPEN_SOURCE=500',
'_LINUX_SOURCE_COMPAT',
'_THREAD_SAFE',
],
}],
[ 'OS=="freebsd" or OS=="dragonflybsd"', {
'sources': [ 'src/unix/freebsd.c' ],
}],
Expand Down
12 changes: 6 additions & 6 deletions node.gyp
Expand Up @@ -63,7 +63,7 @@
[ 'node_shared=="true"', {
'node_target_type%': 'shared_library',
'conditions': [
['OS=="aix"', {
['OS in "aix os400"', {
# For AIX, always generate static library first,
# It needs an extra step to generate exp and
# then use both static lib and exp to create
Expand Down Expand Up @@ -112,7 +112,7 @@
},

'conditions': [
['OS=="aix"', {
['OS in "aix os400"', {
'ldflags': [
'-Wl,-bnoerrmsg',
],
Expand Down Expand Up @@ -193,7 +193,7 @@
},
}],
[ 'node_intermediate_lib_type=="static_library" and '
'node_shared=="true" and OS=="aix"', {
'node_shared=="true" and OS in "aix os400"', {
# For AIX, shared lib is linked by static lib and .exp. In the
# case here, the executable needs to link to shared lib.
# Therefore, use 'node_aix_shared' target to generate the
Expand Down Expand Up @@ -228,7 +228,7 @@
},
},
'conditions': [
['OS != "aix" and OS != "mac" and OS != "ios"', {
['OS != "aix" and OS != "os400" and OS != "mac" and OS != "ios"', {
'ldflags': [
'-Wl,--whole-archive',
'<(obj_dir)/<(STATIC_LIB_PREFIX)<(node_core_target_name)<(STATIC_LIB_SUFFIX)',
Expand Down Expand Up @@ -742,7 +742,7 @@
'NODE_USE_NODE_CODE_CACHE=1',
],
}],
['node_shared=="true" and OS=="aix"', {
['node_shared=="true" and OS in "aix os400"', {
'product_name': 'node_base',
}],
[ 'v8_enable_inspector==1', {
Expand Down Expand Up @@ -1432,7 +1432,7 @@
], # end targets

'conditions': [
['OS=="aix" and node_shared=="true"', {
['OS in "aix os400" and node_shared=="true"', {
'targets': [
{
'target_name': 'node_aix_shared',
Expand Down
6 changes: 3 additions & 3 deletions node.gypi
Expand Up @@ -156,7 +156,7 @@
},
},
'conditions': [
['OS!="aix" and OS!="ios" and node_shared=="false"', {
['OS!="aix" and OS!="os400" and OS!="ios" and node_shared=="false"', {
'ldflags': [
'-Wl,--whole-archive',
'<(obj_dir)/deps/zlib/<(STATIC_LIB_PREFIX)zlib<(STATIC_LIB_SUFFIX)',
Expand Down Expand Up @@ -195,7 +195,7 @@
},
},
'conditions': [
['OS!="aix" and OS!="ios" and node_shared=="false"', {
['OS!="aix" and OS!="os400" and OS!="ios" and node_shared=="false"', {
'ldflags': [
'-Wl,--whole-archive',
'<(obj_dir)/deps/uv/<(STATIC_LIB_PREFIX)uv<(STATIC_LIB_SUFFIX)',
Expand Down Expand Up @@ -233,7 +233,7 @@
'-lkvm',
],
}],
[ 'OS=="aix"', {
[ 'OS in "aix os400"', {
'defines': [
'_LINUX_SOURCE_COMPAT',
'__STDC_FORMAT_MACROS',
Expand Down
2 changes: 1 addition & 1 deletion test/addons/common.gypi
@@ -1,7 +1,7 @@
{
'defines': [ 'V8_DEPRECATION_WARNINGS=1' ],
'conditions': [
[ 'OS in "linux freebsd openbsd solaris android aix cloudabi"', {
[ 'OS in "linux freebsd openbsd solaris android aix os400 cloudabi"', {
'cflags': ['-Wno-cast-function-type'],
}],
],
Expand Down
2 changes: 1 addition & 1 deletion test/addons/dlopen-ping-pong/binding.gyp
Expand Up @@ -11,7 +11,7 @@
'OTHER_LDFLAGS': [ '-Wl,-undefined', '-Wl,dynamic_lookup' ]
}}],
# Enable the shared object to be linked by runtime linker
['OS=="aix"', {
['OS in "aix os400"', {
'ldflags': [ '-Wl,-G' ]
}]],
},
Expand Down
2 changes: 1 addition & 1 deletion test/addons/openssl-binding/binding.gyp
Expand Up @@ -6,7 +6,7 @@
'conditions': [
['node_use_openssl=="true"', {
'conditions': [
['OS=="aix"', {
['OS in "aix os400"', {
'variables': {
# Used to differentiate `AIX` and `OS400`(IBM i).
'aix_variant_name': '<!(uname -s)',
Expand Down
2 changes: 1 addition & 1 deletion test/addons/openssl-providers/binding.gyp
Expand Up @@ -6,7 +6,7 @@
'conditions': [
['node_use_openssl=="true"', {
'conditions': [
['OS=="aix"', {
['OS in "aix os400"', {
'variables': {
# Used to differentiate `AIX` and `OS400`(IBM i).
'aix_variant_name': '<!(uname -s)',
Expand Down
2 changes: 1 addition & 1 deletion test/addons/zlib-binding/binding.gyp
Expand Up @@ -3,7 +3,7 @@
{
'target_name': 'binding',
'conditions': [
['OS=="aix"', {
['OS in "aix os400"', {
'variables': {
# Used to differentiate `AIX` and `OS400`(IBM i).
'aix_variant_name': '<!(uname -s)',
Expand Down
2 changes: 1 addition & 1 deletion tools/install.py
Expand Up @@ -279,7 +279,7 @@ def wanted_zoslib_headers(files_arg, dest):
], 'include/node/')

# Add the expfile that is created on AIX
if sys.platform.startswith('aix'):
if sys.platform.startswith('aix') or sys.platform == "os400":
action(['out/Release/node.exp'], 'include/node/')

subdir_files('deps/v8/include', 'include/node/', wanted_v8_headers)
Expand Down
2 changes: 1 addition & 1 deletion tools/v8_gypfiles/d8.gyp
Expand Up @@ -47,7 +47,7 @@
}],
['(OS=="linux" or OS=="mac" or OS=="freebsd" or OS=="netbsd" \
or OS=="openbsd" or OS=="solaris" or OS=="android" \
or OS=="qnx" or OS=="aix")', {
or OS=="qnx" or OS=="aix" or OS=="os400")', {
'sources': [ '<(V8_ROOT)/src/d8/d8-posix.cc', ]
}],
[ 'OS=="win"', {
Expand Down
16 changes: 8 additions & 8 deletions tools/v8_gypfiles/toolchain.gypi
Expand Up @@ -330,11 +330,11 @@
'V8_TARGET_ARCH_PPC_BE',
],
'conditions': [
['OS=="aix"', {
['OS=="aix" or OS=="os400"', {
# Work around AIX ceil, trunc and round oddities.
'cflags': [ '-mcpu=power5+ -mfprnd' ],
}],
['OS=="aix"', {
['OS=="aix" or OS=="os400"', {
# Work around AIX assembler popcntb bug.
'cflags': [ '-mno-popcntb' ],
}],
Expand Down Expand Up @@ -1098,7 +1098,7 @@
],
}],
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
or OS=="netbsd" or OS=="qnx" or OS=="aix"', {
or OS=="netbsd" or OS=="qnx" or OS=="aix" or OS=="os400"', {
'conditions': [
[ 'v8_no_strict_aliasing==1', {
'cflags': [ '-fno-strict-aliasing' ],
Expand All @@ -1114,7 +1114,7 @@
['OS=="netbsd"', {
'cflags': [ '-I/usr/pkg/include' ],
}],
['OS=="aix"', {
['OS=="aix" or OS=="os400"', {
'defines': [
# Support for malloc(0)
'_LINUX_SOURCE_COMPAT=1',
Expand Down Expand Up @@ -1147,7 +1147,7 @@
# Support for backtrace_symbols.
'ldflags': [ '-rdynamic' ],
}],
['OS=="aix"', {
['OS=="aix" or OS=="os400"', {
'ldflags': [ '-Wl,-bbigtoc' ],
'conditions': [
['v8_target_arch=="ppc64"', {
Expand Down Expand Up @@ -1191,7 +1191,7 @@
},
'conditions': [
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
OS=="qnx" or OS=="aix"', {
OS=="qnx" or OS=="aix" or OS=="os400"', {
'cflags!': [
'-O3',
'-O2',
Expand Down Expand Up @@ -1242,7 +1242,7 @@
},
'conditions': [
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
OS=="qnx" or OS=="aix"', {
OS=="qnx" or OS=="aix" or OS=="os400"', {
'cflags!': [
'-O0',
'-O1',
Expand Down Expand Up @@ -1292,7 +1292,7 @@
'defines!': ['ENABLE_HANDLE_ZAPPING',],
'conditions': [
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" \
or OS=="aix"', {
or OS=="aix" or OS=="os400"', {
'cflags!': [
'-Os',
],
Expand Down
4 changes: 2 additions & 2 deletions tools/v8_gypfiles/v8.gyp
Expand Up @@ -1068,7 +1068,7 @@
'<(V8_ROOT)/src/base/platform/platform-posix.h',
],
'conditions': [
['OS != "aix" and OS != "solaris"', {
['OS != "aix" and OS != "os400" and OS != "solaris"', {
'sources': [
'<(V8_ROOT)/src/base/platform/platform-posix-time.cc',
'<(V8_ROOT)/src/base/platform/platform-posix-time.h',
Expand All @@ -1088,7 +1088,7 @@
],
},
}],
['OS=="aix"', {
['OS in "aix os400"', {
'variables': {
# Used to differentiate `AIX` and `OS400`(IBM i).
'aix_variant_name': '<!(uname -s)',
Expand Down

0 comments on commit 4b25b98

Please sign in to comment.