deps: add simdutf dependency

PR-URL: https://github.com/nodejs/node/pull/45803
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <midawson@redhat.com>
This commit is contained in:
Yagiz Nizipli 2022-11-30 11:05:17 -05:00 committed by Node.js GitHub Bot
parent 71951a0e86
commit f4c200dc76
12 changed files with 30637 additions and 0 deletions

View File

@ -125,6 +125,16 @@ jobs:
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
./tools/dep_updaters/update-libuv.sh "$NEW_VERSION"
fi
- id: simdutf
subsystem: deps
label: dependencies
run: |
NEW_VERSION=$(gh api repos/simdutf/simdutf/releases/latest -q '.tag_name|ltrimstr("v")')
CURRENT_VERSION=$(grep "#define SIMDUTF_VERSION" ./deps/simdutf/simdutf.h | sed -n "s/^.*VERSION \(.*\)/\1/p")
if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
./tools/update-simdutf.sh "$NEW_VERSION"
fi
steps:
- uses: actions/checkout@v3
with:

22
LICENSE
View File

@ -1316,6 +1316,28 @@ The externally maintained libraries used by Node.js are:
jloup@gzip.org madler@alumni.caltech.edu
"""
- simdutf, located at deps/simdutf, is licensed as follows:
"""
Copyright 2021 The simdutf authors
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
- npm, located at deps/npm, is licensed as follows:
"""
The npm application

View File

@ -170,6 +170,7 @@ with-code-cache test-code-cache:
out/Makefile: config.gypi common.gypi node.gyp \
deps/uv/uv.gyp deps/llhttp/llhttp.gyp deps/zlib/zlib.gyp \
deps/simdutf/simdutf.gyp \
tools/v8_gypfiles/toolchain.gypi tools/v8_gypfiles/features.gypi \
tools/v8_gypfiles/inspector.gypi tools/v8_gypfiles/v8.gyp
$(PYTHON) tools/gyp_node.py -f make

18
deps/simdutf/LICENSE-MIT vendored Normal file
View File

@ -0,0 +1,18 @@
Copyright 2021 The simdutf authors
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

13
deps/simdutf/README.md vendored Normal file
View File

@ -0,0 +1,13 @@
# simdutf
This project boosts unicode validation and transcoding performance by
utilizing SIMD operations where possible.
The source is pulled from: https://github.com/simdutf/simdutf
Active development occurs in the default branch (currently named `master`).
## Updating
See [tools/dep_updaters/README.md#simdutf](../../tools/dep_updaters/README.md#simdutf)
for instructions.

28037
deps/simdutf/simdutf.cpp vendored Normal file

File diff suppressed because it is too large Load Diff

13
deps/simdutf/simdutf.gyp vendored Normal file
View File

@ -0,0 +1,13 @@
{
'targets': [
{
'target_name': 'simdutf',
'type': 'static_library',
'include_dirs': ['.'],
'direct_dependent_settings': {
'include_dirs': ['.'],
},
'sources': ['simdutf.cpp'],
},
]
}

2443
deps/simdutf/simdutf.h vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -455,6 +455,7 @@
'deps/googletest/googletest.gyp:gtest_prod',
'deps/histogram/histogram.gyp:histogram',
'deps/uvwasi/uvwasi.gyp:uvwasi',
'deps/simdutf/simdutf.gyp:simdutf',
],
'sources': [

View File

@ -35,3 +35,28 @@ been created with the changes), do the following:
example).
[`c61870c`]: https://github.com/nodejs/node/commit/c61870c376e2f5b0dbaa939972c46745e21cdbdd
## simdutf
The `update-simdutf.sh` script takes the target version to update as its only
argument, downloads it from the [GitHub repo](https://github.com/simdutf/simdutf)
and uses it to replace the contents of `deps/simdutf/`. The contents are replaced
entirely except for the `*.gyp` and `*.gypi` build files, which are part of the
Node.js build definitions and are not present in the upstream repo.
For example, in order to update to version `2.0.7`, the following command can
be run:
```bash
./tools/dep_updaters/update-simdutf.sh 2.0.7
```
Once the script has run (either manually, or by CI in which case a PR will have
been created with the changes), do the following:
1. Check the [changelog](https://github.com/simdutf/simdutf/releases/tag/v2.0.7) for
things that might require changes in Node.js.
2. If necessary, update `simdutf.gyp` with build-related changes.
3. Check that Node.js compiles without errors and the tests pass.
4. Create a commit for the update and in the commit message include the
important/relevant items from the changelog.

View File

@ -0,0 +1,52 @@
#!/bin/sh
set -e
# Shell script to update simdutf in the source tree to a specific version
BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd)
DEPS_DIR="$BASE_DIR/deps"
SIMDUTF_VERSION=$1
if [ "$#" -le 0 ]; then
echo "Error: please provide an simdutf version to update to"
echo " e.g. $0 2.0.3"
exit 1
fi
echo "Making temporary workspace..."
WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp')
cleanup () {
EXIT_CODE=$?
[ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE"
exit $EXIT_CODE
}
trap cleanup INT TERM EXIT
SIMDUTF_REF="v$SIMDUTF_VERSION"
SIMDUTF_ZIP="simdutf-$SIMDUTF_VERSION.zip"
SIMDUTF_LICENSE="LICENSE-MIT"
cd "$WORKSPACE"
echo "Fetching simdutf source archive..."
curl -sL -o "$SIMDUTF_ZIP" "https://github.com/simdutf/simdutf/releases/download/$SIMDUTF_REF/singleheader.zip"
unzip "$SIMDUTF_ZIP"
rm "$SIMDUTF_ZIP"
rm ./*_demo.cpp
curl -sL -o "$SIMDUTF_LICENSE" "https://raw.githubusercontent.com/simdutf/simdutf/HEAD/LICENSE-MIT"
echo "Replacing existing simdutf (except GYP build files)"
mv "$DEPS_DIR/simdutf/"*.gyp "$DEPS_DIR/simdutf/README.md" "$WORKSPACE/"
rm -rf "$DEPS_DIR/simdutf"
mv "$WORKSPACE" "$DEPS_DIR/simdutf"
echo "All done!"
echo ""
echo "Please git add simdutf, commit the new version:"
echo ""
echo "$ git add -A deps/simdutf"
echo "$ git commit -m \"deps: update simdutf to $SIMDUTF_VERSION\""
echo ""

View File

@ -79,6 +79,8 @@ licenseText="$(sed -e '/You should have received a copy of the CC0/,$d' -e 's/^\
addlicense "SipHash" "deps/v8/src/third_party/siphash" "$licenseText"
licenseText="$(sed -e '/The data format used by the zlib library/,$d' -e 's/^\/\* *//' -e 's/^ *//' "${rootdir}/deps/zlib/zlib.h")"
addlicense "zlib" "deps/zlib" "$licenseText"
licenseText="$(cat "${rootdir}/deps/simdutf/LICENSE-MIT")"
addlicense "simdutf" "deps/simdutf" "$licenseText"
# npm
licenseText="$(cat "${rootdir}/deps/npm/LICENSE")"