Welcome to mirror list, hosted at ThFree Co, Russian Federation.

update-llhttp.sh « tools - github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a95eef1237df58ffc9d995ee01877c0c5a9f39c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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 llhttp to $LLHTTP_VERSION\""
echo ""