blob: 599f742b2f0523ddd5fba290dc34c5b4a80cc20a [file] [log] [blame]
Brad Bishope42b3e32020-01-15 22:08:42 -05001From 5bfeffdf4b5de1c60a2ff0d1ddf65db2bb9a1533 Mon Sep 17 00:00:00 2001
2From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
3Date: Tue, 19 Mar 2019 23:22:40 -0400
4Subject: [PATCH 3/3] Install both binaries and use libdir.
5
6This allows us to build with a shared library for other users while
7still providing the normal executable.
8
9Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
10
11Stolen from [1]
12
13[1] https://src.fedoraproject.org/rpms/nodejs/raw/master/f/0003-Install-both-binaries-and-use-libdir.patch
14
15Upstream-Status: Pending
16
17Signed-off-by: Andreas MΓΌller <schnitzeltony@gmail.com>
Brad Bishope42b3e32020-01-15 22:08:42 -050018---
19 configure.py | 7 +++++++
20 tools/install.py | 31 ++++++++++++++-----------------
21 2 files changed, 21 insertions(+), 17 deletions(-)
22
23diff --git a/configure.py b/configure.py
Andrew Geissler82c905d2020-04-13 13:39:40 -050024index 20cce214db..e2d78a2a51 100755
Brad Bishope42b3e32020-01-15 22:08:42 -050025--- a/configure.py
26+++ b/configure.py
Andrew Geissler82c905d2020-04-13 13:39:40 -050027@@ -559,6 +559,12 @@ parser.add_option('--shared',
Brad Bishope42b3e32020-01-15 22:08:42 -050028 help='compile shared library for embedding node in another project. ' +
29 '(This mode is not officially supported for regular applications)')
30
31+parser.add_option('--libdir',
32+ action='store',
33+ dest='libdir',
34+ default='lib',
35+ help='a directory to install the shared library into')
36+
37 parser.add_option('--without-v8-platform',
38 action='store_true',
39 dest='without_v8_platform',
Andrew Geissler82c905d2020-04-13 13:39:40 -050040@@ -1103,6 +1109,7 @@ def configure_node(o):
41 if o['variables']['want_separate_host_toolset'] == 0:
42 o['variables']['node_code_cache'] = 'yes' # For testing
Brad Bishope42b3e32020-01-15 22:08:42 -050043 o['variables']['node_shared'] = b(options.shared)
44+ o['variables']['libdir'] = options.libdir
45 node_module_version = getmoduleversion.get_version()
46
47 if sys.platform == 'darwin':
48diff --git a/tools/install.py b/tools/install.py
Andrew Geissler82c905d2020-04-13 13:39:40 -050049index 655802980a..fe4723bf15 100755
Brad Bishope42b3e32020-01-15 22:08:42 -050050--- a/tools/install.py
51+++ b/tools/install.py
Andrew Geissler82c905d2020-04-13 13:39:40 -050052@@ -121,26 +121,23 @@ def subdir_files(path, dest, action):
Brad Bishope42b3e32020-01-15 22:08:42 -050053
54 def files(action):
55 is_windows = sys.platform == 'win32'
56- output_file = 'node'
57 output_prefix = 'out/Release/'
58+ output_libprefix = output_prefix
59
60- if 'false' == variables.get('node_shared'):
61- if is_windows:
62- output_file += '.exe'
63+ if is_windows:
64+ output_bin = 'node.exe'
65+ output_lib = 'node.dll'
66 else:
67- if is_windows:
68- output_file += '.dll'
69- else:
70- output_file = 'lib' + output_file + '.' + variables.get('shlib_suffix')
71- # GYP will output to lib.target except on OS X, this is hardcoded
72- # in its source - see the _InstallableTargetInstallPath function.
73- if sys.platform != 'darwin':
74- output_prefix += 'lib.target/'
75-
76- if 'false' == variables.get('node_shared'):
77- action([output_prefix + output_file], 'bin/' + output_file)
78- else:
79- action([output_prefix + output_file], 'lib/' + output_file)
80+ output_bin = 'node'
81+ output_lib = 'libnode.' + variables.get('shlib_suffix')
82+ # GYP will output to lib.target except on OS X, this is hardcoded
83+ # in its source - see the _InstallableTargetInstallPath function.
84+ if sys.platform != 'darwin':
85+ output_libprefix += 'lib.target/'
86+
87+ action([output_prefix + output_bin], 'bin/' + output_bin)
88+ if 'true' == variables.get('node_shared'):
89+ action([output_libprefix + output_lib], variables.get('libdir') + '/' + output_lib)
90
91 if 'true' == variables.get('node_use_dtrace'):
92 action(['out/Release/node.d'], 'lib/dtrace/node.d')
93--
Andrew Geissler82c905d2020-04-13 13:39:40 -0500942.20.1
Brad Bishope42b3e32020-01-15 22:08:42 -050095