Skip to content

Commit

Permalink
build: Updates to enable AIX support
Browse files Browse the repository at this point in the history
These are the core changes that allow AIX to compile.  There
are still some test failures as there are some patches needed for
libuv and npm that we'll need to contribute through those
communities but this set allows node to be built on AIX and
pass most of the core tests

The change in js2c is because AIX does not support $ in
identifier names.  See the discussion/agreement in
#2272

PR-URL: #2364
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Rod Vagg <[email protected]>
  • Loading branch information
mhdawson committed Sep 15, 2015
1 parent 704dcce commit 2a17c7f
Show file tree
Hide file tree
Showing 18 changed files with 1,113 additions and 21 deletions.
24 changes: 20 additions & 4 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
['target_arch=="x64"', {
'msvs_configuration_platform': 'x64',
}],
['OS=="aix"', {
'cflags': [ '-gxcoff' ],
'ldflags': [ '-Wl,-bbigtoc' ],
}],
],
'msvs_settings': {
'VCCLCompilerTool': {
Expand Down Expand Up @@ -217,11 +221,11 @@
'BUILDING_UV_SHARED=1',
],
}],
[ 'OS in "linux freebsd openbsd solaris"', {
[ 'OS in "linux freebsd openbsd solaris aix"', {
'cflags': [ '-pthread', ],
'ldflags': [ '-pthread' ],
}],
[ 'OS in "linux freebsd openbsd solaris android"', {
[ 'OS in "linux freebsd openbsd solaris android aix"', {
'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++0x' ],
'ldflags': [ '-rdynamic' ],
Expand All @@ -243,11 +247,11 @@
'cflags': [ '-m64' ],
'ldflags': [ '-m64' ],
}],
[ 'target_arch=="ppc"', {
[ 'target_arch=="ppc" and OS!="aix"', {
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ],
}],
[ 'target_arch=="ppc64"', {
[ 'target_arch=="ppc64" and OS!="aix"', {
'cflags': [ '-m64', '-mminimal-toc' ],
'ldflags': [ '-m64' ],
}],
Expand All @@ -257,6 +261,18 @@
'cflags!': [ '-pthread' ],
'ldflags!': [ '-pthread' ],
}],
[ 'OS=="aix"', {
'conditions': [
[ 'target_arch=="ppc"', {
'ldflags': [ '-Wl,-bmaxdata:0x60000000/dsa' ],
}],
[ 'target_arch=="ppc64"', {
'cflags': [ '-maix64' ],
'ldflags': [ '-maix64' ],
}],
],
'ldflags!': [ '-rdynamic' ],
}],
],
}],
[ 'OS=="android"', {
Expand Down
16 changes: 11 additions & 5 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import nodedownload
# parse our options
parser = optparse.OptionParser()

valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux', 'android')
valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux',
'android', 'aix')
valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 'x32',
'x64', 'x86')
valid_arm_float_abi = ('soft', 'softfp', 'hard')
Expand Down Expand Up @@ -492,11 +493,11 @@ def check_compiler(o):
o['variables']['gas_version'] = get_gas_version(CC)


def cc_macros():
"""Checks predefined macros using the CC command."""
def cc_macros(cc=None):
"""Checks predefined macros using the C compiler command."""

try:
p = subprocess.Popen(shlex.split(CC) + ['-dM', '-E', '-'],
p = subprocess.Popen(shlex.split(cc or CC) + ['-dM', '-E', '-'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
Expand Down Expand Up @@ -554,7 +555,12 @@ def is_arm_hard_float_abi():
def host_arch_cc():
"""Host architecture check using the CC command."""

k = cc_macros()
if sys.platform.startswith('aix'):
# we only support gcc at this point and the default on AIX
# would be xlc so hard code gcc
k = cc_macros('gcc')
else:
k = cc_macros()

matchup = {
'__aarch64__' : 'arm64',
Expand Down
4 changes: 4 additions & 0 deletions deps/cares/cares.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
'_GNU_SOURCE'
]
}],
[ 'OS=="aix"', {
'include_dirs': [ 'config/aix' ],
'sources': [ 'config/aix/ares_config.h' ],
}],
['OS=="solaris"', {
'defines': [
'__EXTENSIONS__',
Expand Down
2 changes: 1 addition & 1 deletion deps/cares/common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
],
}],

[ 'OS in "linux freebsd openbsd solaris android"', {
[ 'OS in "linux freebsd openbsd solaris android aix"', {
'variables': {
'gcc_version%': '<!(python build/gcc_version.py)>)'
},
Expand Down
Loading

0 comments on commit 2a17c7f

Please sign in to comment.