Index: www/node/Makefile =================================================================== --- www/node/Makefile +++ www/node/Makefile @@ -3,7 +3,7 @@ PORTNAME= node PORTVERSION= 14.10.0 DISTVERSIONPREFIX= v -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= www MASTER_SITES= http://nodejs.org/dist/v${PORTVERSION}/ @@ -17,8 +17,8 @@ BROKEN_SSL_REASON= Node.js 14.x requires OpenSSL 1.1.x or the BUNDLED_SSL option enabled ONLY_FOR_ARCHS= aarch64 amd64 armv6 armv7 i386 powerpc64 -OPTIONS_DEFINE= BUNDLED_SSL DOCS NLS DTRACE -OPTIONS_DEFAULT= DTRACE +OPTIONS_DEFINE= BUNDLED_SSL DOCS NLS DTRACE SHARED +OPTIONS_DEFAULT= DTRACE SHARED OPTIONS_DEFAULT_FreeBSD_11= BUNDLED_SSL OPTIONS_DEFAULT+= ${OPTIONS_DEFAULT_${OPSYS}_${OSREL:R}} OPTIONS_SUB= yes @@ -44,6 +44,14 @@ DTRACE_CONFIGURE_ON= --with-dtrace +# Node.js uses their module version as the shared library version suffix. The +# value here must be updated whenever upstream changes. +NODE_MODULE_VERSION= 83 +SHARED_DESC= Build and install libnode.so +SHARED_CONFIGURE_ON= --shared +SHARED_USE_LDCONFIG= yes +SHARED_PLIST_SUB+= NODE_MODULE_VERSION=${NODE_MODULE_VERSION} + USES= compiler:c++11-lib gmake python:build pkgconfig \ localbase shebangfix @@ -98,6 +106,21 @@ CONFIGURE_ARGS+=--openssl-no-asm .endif +post-extract: + # Fail the build if NODE_MODULE_VERSION from the upstream packages does + # match the value defined above. The value above needs to be updated + # and an entry added to UPDATING to give users notice of the shared + # library version change and how to rebuild all dependent ports. + @( \ + VALUE=$$(${AWK} '/^#define NODE_MODULE_VERSION/ { print $$3 }' \ + ${WRKSRC}/src/node_version.h \ + ); \ + test ${NODE_MODULE_VERSION} -eq $$VALUE || { \ + echo "NODE_MODULE_VERSION mismatch! Expected ${NODE_MODULE_VERSION}, got $$VALUE"; \ + exit 1; \ + } \ + ) + post-patch: @${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|' \ ${WRKSRC}/tools/v8_gypfiles/v8.gyp @@ -114,5 +137,9 @@ post-install: ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/node +.if ${PORT_OPTIONS:MSHARED} + ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libnode.so.${NODE_MODULE_VERSION} + ${LN} -fs libnode.so.${NODE_MODULE_VERSION} ${STAGEDIR}${PREFIX}/lib/libnode.so +.endif .include Index: www/node/files/patch-tools_install.py =================================================================== --- /dev/null +++ www/node/files/patch-tools_install.py @@ -0,0 +1,38 @@ +--- tools/install.py.orig 2020-09-10 04:57:37 UTC ++++ tools/install.py +@@ -121,26 +121,23 @@ def subdir_files(path, dest, action): + + def files(action): + is_windows = sys.platform == 'win32' +- output_file = 'node' + output_prefix = 'out/Release/' + +- if 'false' == variables.get('node_shared'): ++ output_file = 'node' ++ if is_windows: ++ output_file += '.exe' ++ action([output_prefix + output_file], 'bin/' + output_file) ++ ++ if 'true' == variables.get('node_shared'): + if is_windows: +- output_file += '.exe' +- else: +- if is_windows: +- output_file += '.dll' ++ output_lib = 'node.dll' + else: +- output_file = 'lib' + output_file + '.' + variables.get('shlib_suffix') ++ output_lib = 'lib' + output_file + '.' + variables.get('shlib_suffix') + # GYP will output to lib.target except on OS X, this is hardcoded + # in its source - see the _InstallableTargetInstallPath function. + if sys.platform != 'darwin': + output_prefix += 'lib.target/' +- +- if 'false' == variables.get('node_shared'): +- action([output_prefix + output_file], 'bin/' + output_file) +- else: +- action([output_prefix + output_file], 'lib/' + output_file) ++ action([output_prefix + output_lib], 'lib/' + output_lib) + + if 'true' == variables.get('node_use_dtrace'): + action(['out/Release/node.d'], 'lib/dtrace/node.d') Index: www/node/pkg-plist =================================================================== --- www/node/pkg-plist +++ www/node/pkg-plist @@ -496,6 +496,8 @@ include/node/v8.h include/node/v8config.h %%DTRACE%%lib/dtrace/node.d +%%SHARED%%lib/libnode.so +%%SHARED%%lib/libnode.so.%%NODE_MODULE_VERSION%% @(,,444) man/man1/node.1.gz %%PORTDOCS%%%%DOCSDIR%%/gdbinit %%PORTDOCS%%%%DOCSDIR%%/lldb_commands.py