Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
gyp: install node-gyp
* fixes #2480
  • Loading branch information
indutny committed Jan 16, 2012
1 parent d5047f5 commit 3d1476a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
17 changes: 11 additions & 6 deletions tools/addon.gypi
Expand Up @@ -3,15 +3,20 @@
'type': 'loadable_module',
'product_extension': 'node',
'product_prefix': '',
'include_dirs': [
'../src',
'../deps/uv/include',
'../deps/v8/include'
],

This comment has been minimized.

Copy link
@TooTallNate

TooTallNate Jan 16, 2012

Why not just leave these? That way node-gyp will still work when run relative to the source dir, as well as when installed. Or if there's some other way to distinguish that, idk.


'conditions': [
[ 'OS=="mac"', {
'libraries': [ '-undefined dynamic_lookup' ],
'libraries': [ '-undefined dynamic_lookup' ]
}],
[ 'OS=="win"', {
'include_dirs': [
'../src',
'../deps/uv/include',
'../deps/v8/include'
],
'libraries': [ '-l<(node_root_dir>/Debug/node.lib' ],
}, {
'include_dirs': ['../../../include/node']

This comment has been minimized.

Copy link
@TooTallNate

TooTallNate Jan 16, 2012

So this is the include path post-installation? Just clarifying...

}]
]
}
Expand Down
11 changes: 9 additions & 2 deletions tools/installer.js
Expand Up @@ -93,7 +93,13 @@ if (cmd === 'install') {
copy([
'deps/uv/include/ares.h',
'deps/uv/include/ares_version.h'
], 'include/node/c-ares/');
], 'include/node/');

// Copy node-gyp files
copy('common.gypi', 'lib/node/');
copy('tools/*', 'lib/node/tools/');
queue.push('ln -sf ../lib/node/tools/node-gyp ' +

This comment has been minimized.

Copy link
@TooTallNate

TooTallNate Jan 16, 2012

Does this file only get run on Unix? ln -s won't be on Windows, of course.

path.join(node_prefix, 'bin/node-gyp'));

// Copy binary file
copy('out/Release/node', 'bin/node');
Expand All @@ -106,7 +112,8 @@ if (cmd === 'install') {
}
} else {
remove([
'bin/node', 'bin/npm', 'include/node/*', 'lib/node_modules'
'bin/node', 'bin/npm', 'bin/node-gyp', 'include/node/*',
'lib/node', 'lib/node_modules'
]);
}

Expand Down
8 changes: 5 additions & 3 deletions tools/gyp_addon → tools/node-gyp
Expand Up @@ -4,18 +4,20 @@ import sys

script_dir = os.path.dirname(__file__)
node_root = os.path.normpath(os.path.join(script_dir, os.pardir))
node_tools = os.path.join(node_root, 'lib', 'node', 'tools')

This comment has been minimized.

Copy link
@TooTallNate

TooTallNate Jan 16, 2012

I don't think this one is right. node/lib/node/tools does not exist.

This comment has been minimized.

Copy link
@TooTallNate

TooTallNate Jan 16, 2012

Ok I understand now; this is a post-installation path?

This comment has been minimized.

Copy link
@bnoordhuis

bnoordhuis Jan 16, 2012

Member

It is.


sys.path.insert(0, os.path.join(node_root, 'tools', 'gyp', 'pylib'))
sys.path.insert(0, os.path.join(node_tools, 'gyp', 'pylib'))

This comment has been minimized.

Copy link
@TooTallNate

TooTallNate Jan 16, 2012

On OS X, this causes:

∞ ~/node-ffi (master) $ ../node/tools/node-gyp -f make
Traceback (most recent call last):
  File "../node/tools/node-gyp", line 10, in <module>
    import gyp
ImportError: No module named gyp

This comment has been minimized.

Copy link
@TooTallNate

TooTallNate Jan 16, 2012

That's when run relative to the source dir. I haven't yet tried after running make install, but I am kinda reluctant to since I'd rather not install dev versions.

import gyp

if __name__ == '__main__':
args = sys.argv[1:]
addon_gypi = os.path.join(node_root, 'tools', 'addon.gypi')
common_gypi = os.path.join(node_root, 'common.gypi')
addon_gypi = os.path.join(node_tools, 'addon.gypi')
common_gypi = os.path.join(node_root, 'lib', 'node', 'common.gypi')
args.extend(['-I', addon_gypi])
args.extend(['-I', common_gypi])
args.extend(['-Dlibrary=shared_library'])
args.extend(['-Dvisibility=default'])
args.extend(['-Dnode_root_dir=%s' % node_root])
args.extend(['--depth=.']);

gyp_args = list(args)
Expand Down

1 comment on commit 3d1476a

@ry
Copy link

@ry ry commented on 3d1476a Jan 17, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted in next commit. Addon building via GYP to depend on the node source tree. NPM will support binary uploads.

Please sign in to comment.