blob: 92386fa7792ab408ab43e3f96496d8026d1b950f [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
Brad Bishope42b3e32020-01-15 22:08:42 -050023--- a/configure.py
24+++ b/configure.py
Andrew Geisslerbffdb3e2020-08-21 16:13:29 -050025@@ -602,6 +602,12 @@ parser.add_option('--shared',
Brad Bishope42b3e32020-01-15 22:08:42 -050026 help='compile shared library for embedding node in another project. ' +
27 '(This mode is not officially supported for regular applications)')
28
29+parser.add_option('--libdir',
30+ action='store',
31+ dest='libdir',
32+ default='lib',
33+ help='a directory to install the shared library into')
34+
35 parser.add_option('--without-v8-platform',
36 action='store_true',
37 dest='without_v8_platform',
Andrew Geisslerbffdb3e2020-08-21 16:13:29 -050038@@ -1168,6 +1174,7 @@ def configure_node(o):
39 o['variables']['node_no_browser_globals'] = b(options.no_browser_globals)
40
Brad Bishope42b3e32020-01-15 22:08:42 -050041 o['variables']['node_shared'] = b(options.shared)
42+ o['variables']['libdir'] = options.libdir
43 node_module_version = getmoduleversion.get_version()
44
Andrew Geisslerbffdb3e2020-08-21 16:13:29 -050045 if options.dest_os == 'android':
Brad Bishope42b3e32020-01-15 22:08:42 -050046--- a/tools/install.py
47+++ b/tools/install.py
Andrew Geissler82c905d2020-04-13 13:39:40 -050048@@ -121,26 +121,23 @@ def subdir_files(path, dest, action):
Brad Bishope42b3e32020-01-15 22:08:42 -050049
50 def files(action):
51 is_windows = sys.platform == 'win32'
52- output_file = 'node'
53 output_prefix = 'out/Release/'
54+ output_libprefix = output_prefix
55
56- if 'false' == variables.get('node_shared'):
57- if is_windows:
58- output_file += '.exe'
59+ if is_windows:
60+ output_bin = 'node.exe'
61+ output_lib = 'node.dll'
62 else:
63- if is_windows:
64- output_file += '.dll'
65- else:
66- output_file = 'lib' + output_file + '.' + variables.get('shlib_suffix')
67- # GYP will output to lib.target except on OS X, this is hardcoded
68- # in its source - see the _InstallableTargetInstallPath function.
69- if sys.platform != 'darwin':
70- output_prefix += 'lib.target/'
Brad Bishope42b3e32020-01-15 22:08:42 -050071+ output_bin = 'node'
72+ output_lib = 'libnode.' + variables.get('shlib_suffix')
73+ # GYP will output to lib.target except on OS X, this is hardcoded
74+ # in its source - see the _InstallableTargetInstallPath function.
75+ if sys.platform != 'darwin':
76+ output_libprefix += 'lib.target/'
Andrew Geisslerbffdb3e2020-08-21 16:13:29 -050077
78- if 'false' == variables.get('node_shared'):
79- action([output_prefix + output_file], 'bin/' + output_file)
80- else:
81- action([output_prefix + output_file], 'lib/' + output_file)
Brad Bishope42b3e32020-01-15 22:08:42 -050082+ action([output_prefix + output_bin], 'bin/' + output_bin)
83+ if 'true' == variables.get('node_shared'):
84+ action([output_libprefix + output_lib], variables.get('libdir') + '/' + output_lib)
85
86 if 'true' == variables.get('node_use_dtrace'):
87 action(['out/Release/node.d'], 'lib/dtrace/node.d')