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

build,test: add proper support for IBM i #42689

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
60 changes: 27 additions & 33 deletions common.gypi
Expand Up @@ -137,7 +137,7 @@
'defines': [ 'DEBUG', '_DEBUG', 'V8_ENABLE_CHECKS' ],
'cflags': [ '-g', '-O0' ],
'conditions': [
['OS=="aix"', {
['OS=="aix" or OS=="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,39 +444,33 @@
}],
],
}],
[ 'OS=="os400"', {
'ldflags!': [ '-rdynamic', ],
'ldflags': [
'-Wl,-bbigtoc',
'-Wl,-blibpath:/QOpenSys/pkgs/lib:/QOpenSys/usr/lib',
],
}],
[ 'OS=="aix"', {
'variables': {
# Used to differentiate `AIX` and `OS400`(IBM i).
'aix_variant_name': '<!(uname -s)',
},
'cflags': [ '-maix64', ],
'cflags': [
'-maix64',
# Disable the following compiler warning:
#
# warning: visibility attribute not supported in this
# configuration; ignored [-Wattributes]
#
# This is gcc complaining about __attribute((visibility("default"))
# in static library builds. Legitimate but harmless and it drowns
# out more relevant warnings.
'-Wno-attributes'
],
'ldflags!': [ '-rdynamic', ],
'ldflags': [
'-Wl,-bbigtoc',
'-maix64',
],
'conditions': [
[ '"<(aix_variant_name)"=="OS400"', { # a.k.a. `IBM i`
'ldflags': [
'-Wl,-blibpath:/QOpenSys/pkgs/lib:/QOpenSys/usr/lib',
'-Wl,-brtl',
],
}, { # else it's `AIX`
# Disable the following compiler warning:
#
# warning: visibility attribute not supported in this
# configuration; ignored [-Wattributes]
#
# This is gcc complaining about __attribute((visibility("default"))
# in static library builds. Legitimate but harmless and it drowns
# out more relevant warnings.
'cflags': [ '-Wno-attributes' ],
'ldflags': [
'-Wl,-blibpath:/usr/lib:/lib:/opt/freeware/lib/pthread/ppc64',
],
}],
],
}],
'-Wl,-blibpath:/usr/lib:/lib:/opt/freeware/lib/pthread/ppc64',
],
}],
['OS=="android"', {
'target_conditions': [
['_toolset=="target"', {
Expand Down
9 changes: 7 additions & 2 deletions configure.py 100755 → 100644
Expand Up @@ -45,7 +45,7 @@
parser = argparse.ArgumentParser()

valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux',
'android', 'aix', 'cloudabi', 'ios')
'android', 'aix', 'os400', 'cloudabi', '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 @@ -1296,7 +1296,7 @@ def configure_node(o):
elif sys.platform == 'zos':
configure_zos(o)

if flavor == 'aix':
if flavor == 'aix' or flavor == 'os400':
o['variables']['node_target_type'] = 'static_library'

if target_arch in ('x86', 'x64', 'ia32', 'x32'):
Expand Down Expand Up @@ -1393,6 +1393,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 @@ -1903,6 +1905,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/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 @@ -61,7 +61,7 @@
[ 'node_shared=="true"', {
'node_target_type%': 'shared_library',
'conditions': [
['OS=="aix"', {
['OS=="aix" or OS=="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 @@ -110,7 +110,7 @@
},

'conditions': [
['OS=="aix"', {
['OS=="aix" or OS=="os400"', {
'ldflags': [
'-Wl,-bnoerrmsg',
],
Expand Down Expand Up @@ -191,7 +191,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 @@ -226,7 +226,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 @@ -734,7 +734,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 @@ -1191,7 +1191,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=="aix" or OS=="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/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 @@ -274,7 +274,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 @@ -651,7 +651,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 @@ -667,7 +667,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 @@ -700,7 +700,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 @@ -744,7 +744,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 @@ -795,7 +795,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 @@ -845,7 +845,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