Skip to content

Commit 5a19293

Browse files
committed
build: Updates to enable AIX support
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]>
1 parent 847459c commit 5a19293

18 files changed

+1113
-21
lines changed

common.gypi

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@
6464
['target_arch=="x64"', {
6565
'msvs_configuration_platform': 'x64',
6666
}],
67+
['OS=="aix"', {
68+
'cflags': [ '-gxcoff' ],
69+
'ldflags': [ '-Wl,-bbigtoc' ],
70+
}],
6771
],
6872
'msvs_settings': {
6973
'VCCLCompilerTool': {
@@ -199,11 +203,11 @@
199203
'BUILDING_UV_SHARED=1',
200204
],
201205
}],
202-
[ 'OS in "linux freebsd openbsd solaris"', {
206+
[ 'OS in "linux freebsd openbsd solaris aix"', {
203207
'cflags': [ '-pthread', ],
204208
'ldflags': [ '-pthread' ],
205209
}],
206-
[ 'OS in "linux freebsd openbsd solaris android"', {
210+
[ 'OS in "linux freebsd openbsd solaris android aix"', {
207211
'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
208212
'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++0x' ],
209213
'ldflags': [ '-rdynamic' ],
@@ -225,11 +229,11 @@
225229
'cflags': [ '-m64' ],
226230
'ldflags': [ '-m64' ],
227231
}],
228-
[ 'target_arch=="ppc"', {
232+
[ 'target_arch=="ppc" and OS!="aix"', {
229233
'cflags': [ '-m32' ],
230234
'ldflags': [ '-m32' ],
231235
}],
232-
[ 'target_arch=="ppc64"', {
236+
[ 'target_arch=="ppc64" and OS!="aix"', {
233237
'cflags': [ '-m64', '-mminimal-toc' ],
234238
'ldflags': [ '-m64' ],
235239
}],
@@ -239,6 +243,18 @@
239243
'cflags!': [ '-pthread' ],
240244
'ldflags!': [ '-pthread' ],
241245
}],
246+
[ 'OS=="aix"', {
247+
'conditions': [
248+
[ 'target_arch=="ppc"', {
249+
'ldflags': [ '-Wl,-bmaxdata:0x60000000/dsa' ],
250+
}],
251+
[ 'target_arch=="ppc64"', {
252+
'cflags': [ '-maix64' ],
253+
'ldflags': [ '-maix64' ],
254+
}],
255+
],
256+
'ldflags!': [ '-rdynamic' ],
257+
}],
242258
],
243259
}],
244260
[ 'OS=="android"', {

configure

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ import nodedownload
2525
# parse our options
2626
parser = optparse.OptionParser()
2727

28-
valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux', 'android')
28+
valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux',
29+
'android', 'aix')
2930
valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 'x32',
3031
'x64', 'x86')
3132
valid_arm_float_abi = ('soft', 'softfp', 'hard')
@@ -480,11 +481,11 @@ def check_compiler(o):
480481
o['variables']['gas_version'] = get_gas_version(CC)
481482

482483

483-
def cc_macros():
484-
"""Checks predefined macros using the CC command."""
484+
def cc_macros(cc=None):
485+
"""Checks predefined macros using the C compiler command."""
485486

486487
try:
487-
p = subprocess.Popen(shlex.split(CC) + ['-dM', '-E', '-'],
488+
p = subprocess.Popen(shlex.split(cc or CC) + ['-dM', '-E', '-'],
488489
stdin=subprocess.PIPE,
489490
stdout=subprocess.PIPE,
490491
stderr=subprocess.PIPE)
@@ -542,7 +543,12 @@ def is_arm_hard_float_abi():
542543
def host_arch_cc():
543544
"""Host architecture check using the CC command."""
544545

545-
k = cc_macros()
546+
if sys.platform.startswith('aix'):
547+
# we only support gcc at this point and the default on AIX
548+
# would be xlc so hard code gcc
549+
k = cc_macros('gcc')
550+
else:
551+
k = cc_macros()
546552

547553
matchup = {
548554
'__aarch64__' : 'arm64',

deps/cares/cares.gyp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
'_GNU_SOURCE'
1010
]
1111
}],
12+
[ 'OS=="aix"', {
13+
'include_dirs': [ 'config/aix' ],
14+
'sources': [ 'config/aix/ares_config.h' ],
15+
}],
1216
['OS=="solaris"', {
1317
'defines': [
1418
'__EXTENSIONS__',

deps/cares/common.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
],
138138
}],
139139

140-
[ 'OS in "linux freebsd openbsd solaris android"', {
140+
[ 'OS in "linux freebsd openbsd solaris android aix"', {
141141
'variables': {
142142
'gcc_version%': '<!(python build/gcc_version.py)>)'
143143
},

0 commit comments

Comments
 (0)