Re: fix nodejs/node-gyp tarball version

2020-04-02 Thread Denis Fondras
On Thu, Apr 02, 2020 at 09:05:01AM -0600, Aaron Bieber wrote:
> On Thu, 02 Apr 2020 at 15:54:03 +0200, Jeremie Courreges-Anglas wrote:
> > 
> > +cc maintainer ;)
> > 
> > On Thu, Apr 02 2020, Denis Fondras  wrote:
> > > node-gyp needs to know about the installed Node.js version.
> > >
> > > This needs to be updated each time Node.js is upgraded. May we do this
> > > automatically with sed in Makefile pre-patch section ?
> > 
> > pre-configure already uses ${SUBST_CMD} on this file.
> > With this diff you should be able to use ${NODE_VERSION} in
> > patches/patch-deps_npm_node_modules_node-gyp_lib_install_js (untested).
> 
> So upstream ships -headers distfiles now - we should be using that instead of
> the full tarball. Alternatively, we could completely remove this fix as we
> don't have native modules in tree anymore.
> 
> Here is a diff that updates node to the latest version and includes a fix to
> store the -headers file:
>   https://deftly.net/patches/node-12.16.1.diff
> 

Thank you for the diff Aaron.

OK denis@ with a fix (deps/npm/node_modules/node-gyp/lib/install.js is missing
'/share' in the path).

diff --git a/lang/node/Makefile b/lang/node/Makefile
index b06ab358476..b9baa0b4b13 100644
--- a/lang/node/Makefile
+++ b/lang/node/Makefile
@@ -11,9 +11,11 @@ USE_WXNEEDED =   Yes
 
 COMMENT =  V8 JavaScript for clients and servers
 
-NODE_VERSION = v12.13.1
+NODE_VERSION = v12.16.1
 PLEDGE_VER =   1.1.2
-DISTFILES =node-pledge-{}${PLEDGE_VER}.tar.gz:0 ${DISTNAME}.tar.gz
+DISTFILES =node-pledge-{}${PLEDGE_VER}.tar.gz:0 \
+   ${DISTNAME}-headers.tar.gz \
+   ${DISTNAME}.tar.gz
 
 DISTNAME = node-${NODE_VERSION}
 PKGNAME =  ${DISTNAME:S/v//g}
@@ -24,8 +26,6 @@ CATEGORIES =  lang devel
 
 HOMEPAGE = http://nodejs.org/
 
-MAINTAINER =   Aaron Bieber 
-
 # MIT
 PERMIT_PACKAGE =   Yes
 
@@ -63,6 +63,8 @@ SUBST_VARS += EXTRACT_SUFX
 SUBST_VARS +=  LOCALBASE
 SUBST_VARS +=  PREFIX
 SUBST_VARS +=  WRKDIST
+SUBST_VARS +=  MAKE_PROGRAM
+SUBST_VARS +=  NODE_VERSION
 
 MAKE_ENV +=V=1 CXX="${CXX}" CXXFLAGS="${CXXFLAGS}" \
LDFLAGS="-L${LOCALBASE}/lib -L${X11BASE}/lib"
@@ -82,6 +84,7 @@ pre-configure:
${WRKDIST}/deps/npm/bin/node-gyp-bin/node-gyp \
${WRKDIST}/deps/npm/node_modules/node-gyp/lib/find-python.js \
${WRKDIST}/deps/npm/node_modules/node-gyp/lib/install.js \
+   ${WRKDIST}/deps/openssl/config/generate_gypi.pl \
${WRKDIST}/node.gyp \
${WRKDIST}/common.gypi \
${WRKDIST}/tools/test.py
@@ -96,8 +99,8 @@ post-install:
${MODPY_BIN} ${MODPY_LIBDIR}/compileall.py \
${PREFIX}/lib/node_modules/npm/node_modules/node-gyp/gyp
${INSTALL_DATA_DIR} ${PREFIX}/share/node
-   ${INSTALL_DATA} ${FULLDISTDIR}/${DISTNAME}.tar.gz \
-   ${PREFIX}/share/node/${DISTNAME}.tar.gz
+   ${INSTALL_DATA} ${FULLDISTDIR}/${DISTNAME}-headers.tar.gz \
+   ${PREFIX}/share/node/${DISTNAME}-headers.tar.gz
ln -s ${TRUEPREFIX}/lib/node_modules/npm/bin/node-gyp-bin/node-gyp \
${PREFIX}/bin/node-gyp;
cd ${PREFIX}/lib/node_modules/npm/node_modules && for x in *; do \
diff --git a/lang/node/distinfo b/lang/node/distinfo
index 894a6f96fd0..8b606c87328 100644
--- a/lang/node/distinfo
+++ b/lang/node/distinfo
@@ -1,4 +1,6 @@
 SHA256 (node-pledge-1.1.2.tar.gz) = 
zY/JcbZ32mmtqWXXNn3/9aTh7Y3F6fAAaADDA8SYwEk=
-SHA256 (node-v12.13.1.tar.gz) = TucQCHaHyN4UIynZUIX1y6ZuRUosnqfsEeH0tHbW0aw=
+SHA256 (node-v12.16.1-headers.tar.gz) = 
gV5zJWG2vhsjibDKxT40tlrRg1pfA1TZiI2ZKkYTlH8=
+SHA256 (node-v12.16.1.tar.gz) = T+jDRU+b7lu+ctRKolzZMYWbMDe3qUcwgbOyvRtGW5U=
 SIZE (node-pledge-1.1.2.tar.gz) = 3155
-SIZE (node-v12.13.1.tar.gz) = 50682874
+SIZE (node-v12.16.1-headers.tar.gz) = 563107
+SIZE (node-v12.16.1.tar.gz) = 52290732
diff --git a/lang/node/patches/patch-common_gypi 
b/lang/node/patches/patch-common_gypi
index 8fbbed51969..f7f66b51d95 100644
--- a/lang/node/patches/patch-common_gypi
+++ b/lang/node/patches/patch-common_gypi
@@ -3,13 +3,13 @@ $OpenBSD: patch-common_gypi,v 1.13 2019/11/24 18:42:28 
abieber Exp $
 Index: common.gypi
 --- common.gypi.orig
 +++ common.gypi
-@@ -497,6 +497,10 @@
+@@ -498,6 +498,10 @@
'-Wl,--export-dynamic',
  ],
}],
 +  ['OS=="openbsd"', {
-+'cflags': [ '-I/usr/local/include' ],
-+'libraries': [ '-L/usr/local/lib' ],
++'cflags': [ '-I${LOCALBASE}/include' ],
++'libraries': [ '-L${LOCALBASE}/lib' ],
 +  }],
# if node is built as an executable,
#  the openssl mechanism for keeping itself "dload"-ed to ensure 
proper
diff --git 
a/lang/node/patches/patch-deps_npm_node_modules_node-gyp_lib_install_js

Re: fix nodejs/node-gyp tarball version

2020-04-02 Thread Aaron Bieber
On Thu, 02 Apr 2020 at 15:54:03 +0200, Jeremie Courreges-Anglas wrote:
> 
> +cc maintainer ;)
> 
> On Thu, Apr 02 2020, Denis Fondras  wrote:
> > node-gyp needs to know about the installed Node.js version.
> >
> > This needs to be updated each time Node.js is upgraded. May we do this
> > automatically with sed in Makefile pre-patch section ?
> 
> pre-configure already uses ${SUBST_CMD} on this file.
> With this diff you should be able to use ${NODE_VERSION} in
> patches/patch-deps_npm_node_modules_node-gyp_lib_install_js (untested).

So upstream ships -headers distfiles now - we should be using that instead of
the full tarball. Alternatively, we could completely remove this fix as we
don't have native modules in tree anymore.

Here is a diff that updates node to the latest version and includes a fix to
store the -headers file:
  https://deftly.net/patches/node-12.16.1.diff

> 
> Index: Makefile
> ===
> RCS file: /d/cvs/ports/lang/node/Makefile,v
> retrieving revision 1.82
> diff -u -p -p -u -r1.82 Makefile
> --- Makefile  24 Nov 2019 18:42:28 -  1.82
> +++ Makefile  2 Apr 2020 13:52:05 -
> @@ -61,6 +61,7 @@ SUBST_VARS +=   DISTNAME
>  SUBST_VARS +=DISTFILES
>  SUBST_VARS +=EXTRACT_SUFX
>  SUBST_VARS +=LOCALBASE
> +SUBST_VARS +=NODE_VERSION
>  SUBST_VARS +=PREFIX
>  SUBST_VARS +=WRKDIST
>  
> 
> > Index: patches/patch-deps_npm_node_modules_node-gyp_lib_install_js
> > ===
> > RCS file: 
> > /cvs/ports/lang/node/patches/patch-deps_npm_node_modules_node-gyp_lib_install_js,v
> > retrieving revision 1.11
> > diff -u -p -r1.11 patch-deps_npm_node_modules_node-gyp_lib_install_js
> > --- patches/patch-deps_npm_node_modules_node-gyp_lib_install_js 24 Nov 
> > 2019 18:42:28 -  1.11
> > +++ patches/patch-deps_npm_node_modules_node-gyp_lib_install_js 2 Apr 
> > 2020 07:18:39 -
> > @@ -11,7 +11,7 @@ Index: deps/npm/node_modules/node-gyp/li
> >   
> > // now download the node tarball
> >  -  var tarPath = gyp.opts.tarball
> > -+  var tarPath = gyp.opts['tarball'] || 
> > '/usr/local/share/node/node-v12.9.0.tar.gz' // Fix for OpenBSD
> > ++  var tarPath = gyp.opts['tarball'] || 
> > '/usr/local/share/node/node-v12.13.1.tar.gz' // Fix for OpenBSD
> > var badDownload = false
> > var extractCount = 0
> > var contentShasums = {}
> >
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

-- 
PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE



Re: fix nodejs/node-gyp tarball version

2020-04-02 Thread Jeremie Courreges-Anglas


+cc maintainer ;)

On Thu, Apr 02 2020, Denis Fondras  wrote:
> node-gyp needs to know about the installed Node.js version.
>
> This needs to be updated each time Node.js is upgraded. May we do this
> automatically with sed in Makefile pre-patch section ?

pre-configure already uses ${SUBST_CMD} on this file.
With this diff you should be able to use ${NODE_VERSION} in
patches/patch-deps_npm_node_modules_node-gyp_lib_install_js (untested).

Index: Makefile
===
RCS file: /d/cvs/ports/lang/node/Makefile,v
retrieving revision 1.82
diff -u -p -p -u -r1.82 Makefile
--- Makefile24 Nov 2019 18:42:28 -  1.82
+++ Makefile2 Apr 2020 13:52:05 -
@@ -61,6 +61,7 @@ SUBST_VARS += DISTNAME
 SUBST_VARS +=  DISTFILES
 SUBST_VARS +=  EXTRACT_SUFX
 SUBST_VARS +=  LOCALBASE
+SUBST_VARS +=  NODE_VERSION
 SUBST_VARS +=  PREFIX
 SUBST_VARS +=  WRKDIST
 

> Index: patches/patch-deps_npm_node_modules_node-gyp_lib_install_js
> ===
> RCS file: 
> /cvs/ports/lang/node/patches/patch-deps_npm_node_modules_node-gyp_lib_install_js,v
> retrieving revision 1.11
> diff -u -p -r1.11 patch-deps_npm_node_modules_node-gyp_lib_install_js
> --- patches/patch-deps_npm_node_modules_node-gyp_lib_install_js   24 Nov 
> 2019 18:42:28 -  1.11
> +++ patches/patch-deps_npm_node_modules_node-gyp_lib_install_js   2 Apr 
> 2020 07:18:39 -
> @@ -11,7 +11,7 @@ Index: deps/npm/node_modules/node-gyp/li
>   
> // now download the node tarball
>  -  var tarPath = gyp.opts.tarball
> -+  var tarPath = gyp.opts['tarball'] || 
> '/usr/local/share/node/node-v12.9.0.tar.gz' // Fix for OpenBSD
> ++  var tarPath = gyp.opts['tarball'] || 
> '/usr/local/share/node/node-v12.13.1.tar.gz' // Fix for OpenBSD
> var badDownload = false
> var extractCount = 0
> var contentShasums = {}
>

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



fix nodejs/node-gyp tarball version

2020-04-02 Thread Denis Fondras
node-gyp needs to know about the installed Node.js version.

This needs to be updated each time Node.js is upgraded. May we do this
automatically with sed in Makefile pre-patch section ?

Index: patches/patch-deps_npm_node_modules_node-gyp_lib_install_js
===
RCS file: 
/cvs/ports/lang/node/patches/patch-deps_npm_node_modules_node-gyp_lib_install_js,v
retrieving revision 1.11
diff -u -p -r1.11 patch-deps_npm_node_modules_node-gyp_lib_install_js
--- patches/patch-deps_npm_node_modules_node-gyp_lib_install_js 24 Nov 2019 
18:42:28 -  1.11
+++ patches/patch-deps_npm_node_modules_node-gyp_lib_install_js 2 Apr 2020 
07:18:39 -
@@ -11,7 +11,7 @@ Index: deps/npm/node_modules/node-gyp/li
  
// now download the node tarball
 -  var tarPath = gyp.opts.tarball
-+  var tarPath = gyp.opts['tarball'] || 
'/usr/local/share/node/node-v12.9.0.tar.gz' // Fix for OpenBSD
++  var tarPath = gyp.opts['tarball'] || 
'/usr/local/share/node/node-v12.13.1.tar.gz' // Fix for OpenBSD
var badDownload = false
var extractCount = 0
var contentShasums = {}