<feed xmlns='http://www.w3.org/2005/Atom'>
<title>unit.git/auto/modules/nodejs, branch 1.34.1</title>
<subtitle>Universal Web Application Server</subtitle>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/'/>
<entry>
<title>Node.js: Build/install fix</title>
<updated>2024-02-19T16:47:27+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-11-07T19:38:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=0c98353091e6c95f6a70a461d0146b7872a8f14d'/>
<id>0c98353091e6c95f6a70a461d0146b7872a8f14d</id>
<content type='text'>
A user on GitHub reported an issue when trying to build/install the
nodejs language module.

Doing a

  $ ./configure nodejs --node=/usr/bin/node --npm=/usr/bin/npm --node-gyp=/usr/bin/node-gyp
  $ make install

was throwing the following error

  mv build/src//usr/bin/node/unit-http-g/unit-http-1.31.1.tgz build//usr/bin/node-unit-http-g.tar.gz
  mv: cannot move 'build/src//usr/bin/node/unit-http-g/unit-http-1.31.1.tgz' to 'build//usr/bin/node-unit-http-g.tar.gz': No such file or directory
  make: *** [build/Makefile:2061: build//usr/bin/node-unit-http-g.tar.gz] Error 1

The fact that we're using the path given by --node= to then use as
directory locations seems erroneous.

But rather than risk breaking existing expectations the simple fix is to
just use build/src in the destination path above to match that of the
source.

These paths were added in some previous commits, and the missing 'src/'
component looks like an oversight.

After this commit both the following work

  $ ./configure nodejs --node-gyp=/usr/lib/node_modules/bin/node-gyp-bin/node-gyp --local=/opt/unit/node
  $ ./configure nodejs --node=/usr/bin/node --node-gyp=/usr/lib/node_modules/npm/bin/node-gyp-bin/node-gyp --local=/opt/unit/node

Reported-by: ruspaul013 &lt;https://github.com/ruspaul013&gt;
Tested-by: ruspaul013 &lt;https://github.com/ruspaul013&gt;
Fixes: 0ee8de554 ("Fixed Makefile target for NodeJS.")
Fixes: c84948386 ("Node.js: fixing module global installation.")
Reviewed-by: Timo Stark &lt;t.stark@nginx.com&gt;
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A user on GitHub reported an issue when trying to build/install the
nodejs language module.

Doing a

  $ ./configure nodejs --node=/usr/bin/node --npm=/usr/bin/npm --node-gyp=/usr/bin/node-gyp
  $ make install

was throwing the following error

  mv build/src//usr/bin/node/unit-http-g/unit-http-1.31.1.tgz build//usr/bin/node-unit-http-g.tar.gz
  mv: cannot move 'build/src//usr/bin/node/unit-http-g/unit-http-1.31.1.tgz' to 'build//usr/bin/node-unit-http-g.tar.gz': No such file or directory
  make: *** [build/Makefile:2061: build//usr/bin/node-unit-http-g.tar.gz] Error 1

The fact that we're using the path given by --node= to then use as
directory locations seems erroneous.

But rather than risk breaking existing expectations the simple fix is to
just use build/src in the destination path above to match that of the
source.

These paths were added in some previous commits, and the missing 'src/'
component looks like an oversight.

After this commit both the following work

  $ ./configure nodejs --node-gyp=/usr/lib/node_modules/bin/node-gyp-bin/node-gyp --local=/opt/unit/node
  $ ./configure nodejs --node=/usr/bin/node --node-gyp=/usr/lib/node_modules/npm/bin/node-gyp-bin/node-gyp --local=/opt/unit/node

Reported-by: ruspaul013 &lt;https://github.com/ruspaul013&gt;
Tested-by: ruspaul013 &lt;https://github.com/ruspaul013&gt;
Fixes: 0ee8de554 ("Fixed Makefile target for NodeJS.")
Fixes: c84948386 ("Node.js: fixing module global installation.")
Reviewed-by: Timo Stark &lt;t.stark@nginx.com&gt;
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Auto: mirroring installation structure in build tree.</title>
<updated>2023-03-28T22:41:08+00:00</updated>
<author>
<name>Alejandro Colomar</name>
<email>alx@nginx.com</email>
</author>
<published>2023-03-22T15:55:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=6e16d7ac5bb86140a55ea30a35c69ee0df3eff8d'/>
<id>6e16d7ac5bb86140a55ea30a35c69ee0df3eff8d</id>
<content type='text'>
This makes the build tree more organized, which is good for adding new
stuff.  Now, it's useful for example for adding manual pages in man3/,
but it may be useful in the future for example for extending the build
system to run linters (e.g., clang-tidy(1), Clang analyzer, ...) on the
C source code.

Previously, the build tree was quite flat, and looked like this (after
`./configure &amp;&amp; make`):

    $ tree -I src build
    build
    ├── Makefile
    ├── autoconf.data
    ├── autoconf.err
    ├── echo
    ├── libnxt.a
    ├── nxt_auto_config.h
    ├── nxt_version.h
    ├── unitd
    └── unitd.8

    1 directory, 9 files

And after this patch, it looks like this:

    $ tree -I src build
    build
    ├── Makefile
    ├── autoconf.data
    ├── autoconf.err
    ├── bin
    │   └── echo
    ├── include
    │   ├── nxt_auto_config.h
    │   └── nxt_version.h
    ├── lib
    │   ├── libnxt.a
    │   └── unit
    │       └── modules
    ├── sbin
    │   └── unitd
    ├── share
    │   └── man
    │       └── man8
    │           └── unitd.8
    └── var
        ├── lib
        │   └── unit
        ├── log
        │   └── unit
        └── run
            └── unit

    17 directories, 9 files

It also solves one issue introduced in
5a37171f733f ("Added default values for pathnames.").  Before that
commit, it was possible to run unitd from the build system
(`./build/unitd`).  Now, since it expects files in a very specific
location, that has been broken.  By having a directory structure that
mirrors the installation, it's possible to trick it to believe it's
installed, and run it from there:

    $ ./configure --prefix=./build
    $ make
    $ ./build/sbin/unitd

Fixes: 5a37171f733f ("Added default values for pathnames.")
Reported-by: Liam Crilly &lt;liam@nginx.com&gt;
Reviewed-by: Konstantin Pavlov &lt;thresh@nginx.com&gt;
Reviewed-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
Cc: Andrei Zeliankou &lt;zelenkov@nginx.com&gt;
Cc: Zhidao Hong &lt;z.hong@f5.com&gt;
Signed-off-by: Alejandro Colomar &lt;alx@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This makes the build tree more organized, which is good for adding new
stuff.  Now, it's useful for example for adding manual pages in man3/,
but it may be useful in the future for example for extending the build
system to run linters (e.g., clang-tidy(1), Clang analyzer, ...) on the
C source code.

Previously, the build tree was quite flat, and looked like this (after
`./configure &amp;&amp; make`):

    $ tree -I src build
    build
    ├── Makefile
    ├── autoconf.data
    ├── autoconf.err
    ├── echo
    ├── libnxt.a
    ├── nxt_auto_config.h
    ├── nxt_version.h
    ├── unitd
    └── unitd.8

    1 directory, 9 files

And after this patch, it looks like this:

    $ tree -I src build
    build
    ├── Makefile
    ├── autoconf.data
    ├── autoconf.err
    ├── bin
    │   └── echo
    ├── include
    │   ├── nxt_auto_config.h
    │   └── nxt_version.h
    ├── lib
    │   ├── libnxt.a
    │   └── unit
    │       └── modules
    ├── sbin
    │   └── unitd
    ├── share
    │   └── man
    │       └── man8
    │           └── unitd.8
    └── var
        ├── lib
        │   └── unit
        ├── log
        │   └── unit
        └── run
            └── unit

    17 directories, 9 files

It also solves one issue introduced in
5a37171f733f ("Added default values for pathnames.").  Before that
commit, it was possible to run unitd from the build system
(`./build/unitd`).  Now, since it expects files in a very specific
location, that has been broken.  By having a directory structure that
mirrors the installation, it's possible to trick it to believe it's
installed, and run it from there:

    $ ./configure --prefix=./build
    $ make
    $ ./build/sbin/unitd

Fixes: 5a37171f733f ("Added default values for pathnames.")
Reported-by: Liam Crilly &lt;liam@nginx.com&gt;
Reviewed-by: Konstantin Pavlov &lt;thresh@nginx.com&gt;
Reviewed-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
Cc: Andrei Zeliankou &lt;zelenkov@nginx.com&gt;
Cc: Zhidao Hong &lt;z.hong@f5.com&gt;
Signed-off-by: Alejandro Colomar &lt;alx@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Node.js: improving and test packaging.</title>
<updated>2021-06-15T07:35:15+00:00</updated>
<author>
<name>Max Romanov</name>
<email>max.romanov@nginx.com</email>
</author>
<published>2021-06-15T07:35:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=1e3f7808b1091d76b80369a93f0361453247f368'/>
<id>1e3f7808b1091d76b80369a93f0361453247f368</id>
<content type='text'>
The patch removes the "files" section from package.json to avoid future issues
with missing files.  For package testing purposes, 'npm pack' is used instead
of plain 'tar' to simulate packaging more accurately.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The patch removes the "files" section from package.json to avoid future issues
with missing files.  For package testing purposes, 'npm pack' is used instead
of plain 'tar' to simulate packaging more accurately.
</pre>
</div>
</content>
</entry>
<entry>
<title>Node.js: used distinct placeholder for version in "package.json".</title>
<updated>2021-03-25T13:15:03+00:00</updated>
<author>
<name>Valentin Bartenev</name>
<email>vbart@nginx.com</email>
</author>
<published>2021-03-25T13:15:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=067c6096e2ec306c4fdae6993140fbbdf4f9a6fd'/>
<id>067c6096e2ec306c4fdae6993140fbbdf4f9a6fd</id>
<content type='text'>
This makes the "sed" instruction simpler and more portable, as the previous
variant didn't work well on BSD systems due to the "\s" metacharacter.

Thanks to Sergey A. Osokin &lt;osa@FreeBSD.org.ru&gt; for spotting this issue.

Also, this should prevent accidentally creating a version 1.0.0 package.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This makes the "sed" instruction simpler and more portable, as the previous
variant didn't work well on BSD systems due to the "\s" metacharacter.

Thanks to Sergey A. Osokin &lt;osa@FreeBSD.org.ru&gt; for spotting this issue.

Also, this should prevent accidentally creating a version 1.0.0 package.
</pre>
</div>
</content>
</entry>
<entry>
<title>Node.js: fixing module global installation.</title>
<updated>2021-03-25T13:09:24+00:00</updated>
<author>
<name>Max Romanov</name>
<email>max.romanov@nginx.com</email>
</author>
<published>2021-03-25T13:09:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=c849483862cba283a123354b9fda7687a9fa32fd'/>
<id>c849483862cba283a123354b9fda7687a9fa32fd</id>
<content type='text'>
Globally installed modules require a globally installed libunit.
The "binding_pub.gyp" file is the correct version, otherwise linked module
may have unresolved symbols because libunit is not linked.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Globally installed modules require a globally installed libunit.
The "binding_pub.gyp" file is the correct version, otherwise linked module
may have unresolved symbols because libunit is not linked.
</pre>
</div>
</content>
</entry>
<entry>
<title>Added trailing zero to version string.</title>
<updated>2019-02-27T14:25:28+00:00</updated>
<author>
<name>Valentin Bartenev</name>
<email>vbart@nginx.com</email>
</author>
<published>2019-02-27T14:25:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=5c9fe8c3060f8204b143abae6d81ee8363aba060'/>
<id>5c9fe8c3060f8204b143abae6d81ee8363aba060</id>
<content type='text'>
While it looks nicer without zero 3-rd version number, this should
improve interoperability.  Version string can be parsed or used for
sorting.  And it is easier to handle and less confusing when there
is constant number of version parts.

Moreover, NPM also expects version format with 3 parts.
So ".0" has already been used in Node.js module version.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
While it looks nicer without zero 3-rd version number, this should
improve interoperability.  Version string can be parsed or used for
sorting.  And it is easier to handle and less confusing when there
is constant number of version parts.

Moreover, NPM also expects version format with 3 parts.
So ".0" has already been used in Node.js module version.
</pre>
</div>
</content>
</entry>
<entry>
<title>Improvement and unification of version processing in build scripts.</title>
<updated>2019-02-22T13:31:44+00:00</updated>
<author>
<name>Alexander Borisov</name>
<email>alexander.borisov@nginx.com</email>
</author>
<published>2019-02-22T13:31:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=608e09e9def182756e2f1650c6f3416b209fbf58'/>
<id>608e09e9def182756e2f1650c6f3416b209fbf58</id>
<content type='text'>
This also eliminates expressions that incompatible with BSD make, thus fixing
installation of Node.js module on FreeBSD (broken by dace60fc4926).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This also eliminates expressions that incompatible with BSD make, thus fixing
installation of Node.js module on FreeBSD (broken by dace60fc4926).
</pre>
</div>
</content>
</entry>
<entry>
<title>Node.js: fixed module version on installation from sources.</title>
<updated>2019-01-23T14:47:53+00:00</updated>
<author>
<name>Alexander Borisov</name>
<email>alexander.borisov@nginx.com</email>
</author>
<published>2019-01-23T14:47:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=2bc8fb7b43a5106ab8cdf8adae4834837ae7fc16'/>
<id>2bc8fb7b43a5106ab8cdf8adae4834837ae7fc16</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Node.js: added check for libunit version at compile time.</title>
<updated>2018-12-19T12:56:57+00:00</updated>
<author>
<name>Alexander Borisov</name>
<email>alexander.borisov@nginx.com</email>
</author>
<published>2018-12-19T12:56:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=d6f38a3268dd4df717bdb9054f3f9ee47fa1f429'/>
<id>d6f38a3268dd4df717bdb9054f3f9ee47fa1f429</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>libunit: added generation of version header file.</title>
<updated>2018-12-19T12:56:54+00:00</updated>
<author>
<name>Alexander Borisov</name>
<email>alexander.borisov@nginx.com</email>
</author>
<published>2018-12-19T12:56:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=c55f329ecf8d32bad0d5bc2aae1da1522b3a92f8'/>
<id>c55f329ecf8d32bad0d5bc2aae1da1522b3a92f8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
