Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 1 | From 5bfeffdf4b5de1c60a2ff0d1ddf65db2bb9a1533 Mon Sep 17 00:00:00 2001 |
| 2 | From: Elliott Sales de Andrade <quantum.analyst@gmail.com> |
| 3 | Date: Tue, 19 Mar 2019 23:22:40 -0400 |
| 4 | Subject: [PATCH 3/3] Install both binaries and use libdir. |
| 5 | |
| 6 | This allows us to build with a shared library for other users while |
| 7 | still providing the normal executable. |
| 8 | |
| 9 | Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com> |
| 10 | |
| 11 | Stolen from [1] |
| 12 | |
| 13 | [1] https://src.fedoraproject.org/rpms/nodejs/raw/master/f/0003-Install-both-binaries-and-use-libdir.patch |
| 14 | |
| 15 | Upstream-Status: Pending |
| 16 | |
| 17 | Signed-off-by: Andreas MΓΌller <schnitzeltony@gmail.com> |
Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 18 | --- |
| 19 | configure.py | 7 +++++++ |
| 20 | tools/install.py | 31 ++++++++++++++----------------- |
| 21 | 2 files changed, 21 insertions(+), 17 deletions(-) |
| 22 | |
Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 23 | --- a/configure.py |
| 24 | +++ b/configure.py |
Andrew Geissler | bffdb3e | 2020-08-21 16:13:29 -0500 | [diff] [blame^] | 25 | @@ -602,6 +602,12 @@ parser.add_option('--shared', |
Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 26 | 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 Geissler | bffdb3e | 2020-08-21 16:13:29 -0500 | [diff] [blame^] | 38 | @@ -1168,6 +1174,7 @@ def configure_node(o): |
| 39 | o['variables']['node_no_browser_globals'] = b(options.no_browser_globals) |
| 40 | |
Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 41 | o['variables']['node_shared'] = b(options.shared) |
| 42 | + o['variables']['libdir'] = options.libdir |
| 43 | node_module_version = getmoduleversion.get_version() |
| 44 | |
Andrew Geissler | bffdb3e | 2020-08-21 16:13:29 -0500 | [diff] [blame^] | 45 | if options.dest_os == 'android': |
Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 46 | --- a/tools/install.py |
| 47 | +++ b/tools/install.py |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 48 | @@ -121,26 +121,23 @@ def subdir_files(path, dest, action): |
Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 49 | |
| 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 Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 71 | + 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 Geissler | bffdb3e | 2020-08-21 16:13:29 -0500 | [diff] [blame^] | 77 | |
| 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 Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 82 | + 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') |