Skip to content

Commit edea788

Browse files
committed
tools: allow separate component install w/ env var
Primary use cases are: headers tarball (previously using `HEADERS_ONLY`) and OS X installer so it has npm files separate from core node + header files. * set `NODE_INSTALL_NODE_ONLY` for core node executable and associated extras (dtrace, systemtap, gdbinit, man page). * set `NODE_INSTALL_HEADERS_ONLY` for header files as required for compiling native addons, previously `HEADERS_ONLY`, used for creating the headers tarball for distribution. * set `NODE_INSTALL_NPM_ONLY` to install npm only, including executable symlink. If none of these are set, install everything. Options are mutually exclusive, run install.py multiple times to install multiple components.
1 parent ba16a12 commit edea788

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ $(TARBALL)-headers: config.gypi release-only
468468
--tag=$(TAG) \
469469
--release-urlbase=$(RELEASE_URLBASE) \
470470
$(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS)
471-
HEADERS_ONLY=1 $(PYTHON) tools/install.py install '$(TARNAME)' '/'
471+
NODE_INSTALL_HEADERS_ONLY=1 $(PYTHON) tools/install.py install '$(TARNAME)' '/'
472472
find $(TARNAME)/ -type l | xargs rm # annoying on windows
473473
tar -cf $(TARNAME)-headers.tar $(TARNAME)
474474
rm -rf $(TARNAME)

tools/install.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def try_unlink(path):
3737

3838
def try_symlink(source_path, link_path):
3939
print 'symlinking %s -> %s' % (source_path, link_path)
40+
try_mkdir_r(os.path.dirname(link_path))
4041
try_unlink(link_path)
4142
os.symlink(source_path, link_path)
4243

@@ -128,6 +129,18 @@ def subdir_files(path, dest, action):
128129
action(files, subdir + '/')
129130

130131
def files(action):
132+
if os.environ.get('NODE_INSTALL_HEADERS_ONLY'):
133+
header_files(action)
134+
elif os.environ.get('NODE_INSTALL_NODE_ONLY'):
135+
node_files(action)
136+
elif os.environ.get('NODE_INSTALL_NPM_ONLY'):
137+
npm_files(action)
138+
else:
139+
node_files(action)
140+
header_files(action)
141+
if 'true' == variables.get('node_install_npm'): npm_files(action)
142+
143+
def node_files(action):
131144
is_windows = sys.platform == 'win32'
132145

133146
exeext = '.exe' if is_windows else ''
@@ -146,11 +159,7 @@ def files(action):
146159
else:
147160
action(['doc/node.1'], 'share/man/man1/')
148161

149-
if 'true' == variables.get('node_install_npm'): npm_files(action)
150-
151-
headers(action)
152-
153-
def headers(action):
162+
def header_files(action):
154163
action([
155164
'common.gypi',
156165
'config.gypi',
@@ -205,12 +214,8 @@ def run(args):
205214

206215
cmd = args[1] if len(args) > 1 else 'install'
207216

208-
if os.environ.get('HEADERS_ONLY'):
209-
if cmd == 'install': return headers(install)
210-
if cmd == 'uninstall': return headers(uninstall)
211-
else:
212-
if cmd == 'install': return files(install)
213-
if cmd == 'uninstall': return files(uninstall)
217+
if cmd == 'install': return files(install)
218+
if cmd == 'uninstall': return files(uninstall)
214219

215220
raise RuntimeError('Bad command: %s\n' % cmd)
216221

0 commit comments

Comments
 (0)