mirror of https://github.com/nodejs/node.git
tools: add update-llhttp.sh
PR-URL: https://github.com/nodejs/node/pull/44652 Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> Co-authored-by: Tobias Nießen <tniessen@tnie.de> Co-authored-by: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
a2a32d8bee
commit
66531d51e9
|
@ -1,7 +1,7 @@
|
|||
cmake_minimum_required(VERSION 3.5.1)
|
||||
cmake_policy(SET CMP0069 NEW)
|
||||
|
||||
project(llhttp VERSION )
|
||||
project(llhttp VERSION 6.0.9)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
|
|
|
@ -78,32 +78,32 @@ are maintained in the [llhttp](https://github.com/nodejs/llhttp)
|
|||
repository. Updates are pulled into Node.js under
|
||||
[deps/llhttp](https://github.com/nodejs/node/tree/HEAD/deps/llhttp).
|
||||
|
||||
In order to update Node.js with a new version of llhttp:
|
||||
In order to update Node.js with a new version of llhttp you can use the
|
||||
`tools/update-llhttp.sh` script.
|
||||
|
||||
* check out the tagged release that you want to update to (a release
|
||||
should be created in the llhttp repo before updating Node.js).
|
||||
* run `npm install` in the directory that you checked out llhttp.
|
||||
* run `make release` in the directory that you checked out llhttp.
|
||||
* copy the contents of the `release` directory from the directory you
|
||||
checked llhttp out to
|
||||
[deps/llhttp](https://github.com/nodejs/node/tree/HEAD/deps/llhttp)
|
||||
The contents of the `deps/llhttp` folder should look like the following:
|
||||
|
||||
It should look like the following:
|
||||
```bash
|
||||
$ find deps/llhttp
|
||||
|
||||
```console
|
||||
├── CMakeLists.txt
|
||||
├── common.gypi
|
||||
├── include
|
||||
│ └── llhttp.h
|
||||
├── LICENSE-MIT
|
||||
├── llhttp.gyp
|
||||
├── README.md
|
||||
└── src
|
||||
├── api.c
|
||||
├── http.c
|
||||
└── llhttp.c
|
||||
deps/llhttp/
|
||||
deps/llhttp/CMakeLists.txt
|
||||
deps/llhttp/include
|
||||
deps/llhttp/include/llhttp.h
|
||||
deps/llhttp/llhttp.gyp
|
||||
deps/llhttp/README.md
|
||||
deps/llhttp/common.gypi
|
||||
deps/llhttp/libllhttp.pc.in
|
||||
deps/llhttp/LICENSE-MIT
|
||||
deps/llhttp/src
|
||||
deps/llhttp/src/api.c
|
||||
deps/llhttp/src/http.c
|
||||
deps/llhttp/src/llhttp.c
|
||||
```
|
||||
|
||||
After updating, make sure the version in `CMakeLists.txt` and `include/llhttp.h`
|
||||
are the same and that they match the one you are expecting.
|
||||
|
||||
The low-level implementation is made available in the Node.js API through
|
||||
JavaScript code in the [lib](https://github.com/nodejs/node/tree/HEAD/lib)
|
||||
directory and C++ code in the
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Shell script to update llhttp in the source tree to specific version
|
||||
|
||||
BASE_DIR="$( pwd )"/
|
||||
DEPS_DIR="${BASE_DIR}deps/"
|
||||
LLHTTP_VERSION="$1"
|
||||
|
||||
if [ "$#" -le 0 ]; then
|
||||
echo "Error: Please provide an llhttp version to update to."
|
||||
echo "Error: To download directly from GitHub, use the organization/repository syntax, without the .git suffix."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cleanup () {
|
||||
EXIT_CODE=$?
|
||||
[ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE"
|
||||
exit $EXIT_CODE
|
||||
}
|
||||
|
||||
echo "Making temporary workspace ..."
|
||||
WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp')
|
||||
trap cleanup INT TERM EXIT
|
||||
|
||||
cd "$WORKSPACE"
|
||||
|
||||
if echo "$LLHTTP_VERSION" | grep -qs "/" ; then # Download a release
|
||||
REPO="git@github.com:$LLHTTP_VERSION.git"
|
||||
BRANCH=$2
|
||||
[ -z "$BRANCH" ] && BRANCH=main
|
||||
|
||||
echo "Cloning llhttp source archive $REPO ..."
|
||||
git clone "$REPO" llhttp
|
||||
cd llhttp
|
||||
echo "Checking out branch $BRANCH ..."
|
||||
git checkout "$BRANCH"
|
||||
|
||||
echo "Building llhtttp ..."
|
||||
npm install
|
||||
make release
|
||||
|
||||
echo "Copying llhtttp release ..."
|
||||
rm -rf "$DEPS_DIR/llhttp"
|
||||
cp -a release "$DEPS_DIR/llhttp"
|
||||
else
|
||||
echo "Download llhttp release $LLHTTP_VERSION ..."
|
||||
curl -sL -o llhttp.tar.gz "https://github.com/nodejs/llhttp/archive/refs/tags/release/v$LLHTTP_VERSION.tar.gz"
|
||||
gzip -dc llhttp.tar.gz | tar xf -
|
||||
|
||||
echo "Copying llhtttp release ..."
|
||||
rm -rf "$DEPS_DIR/llhttp"
|
||||
cp -a "llhttp-release-v$LLHTTP_VERSION" "$DEPS_DIR/llhttp"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "All done!"
|
||||
echo ""
|
||||
echo "Please git add llhttp, commit the new version:"
|
||||
echo ""
|
||||
echo "$ git add -A deps/llhttp"
|
||||
echo "$ git commit -m \"deps: update nghttp2 to $LLHTTP_VERSION\""
|
||||
echo ""
|
Loading…
Reference in New Issue