summaryrefslogtreecommitdiff
path: root/src/third_party/unwind/scripts/import.sh
blob: 6e35f51fa505612b9a7db166638ce1c4c96354ba (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
#!/bin/bash
# This script downloads and imports libunwind

set -euo pipefail
IFS=$'\n\t'

set -vx

NAME=libunwind
REVISION="v1.6-stable-mongo" # 2022-01-20
VERSION="1.6.2"

DEST_DIR=$(git rev-parse --show-toplevel)/src/third_party/unwind
if [[ -d $DEST_DIR/dist ]]; then
    echo "You must remove '$DEST_DIR/dist' before running $0" >&2
    exit 1
fi

UNWIND_GIT_DIR=$(mktemp -d /tmp/import-libunwind.XXXXXX)
trap "rm -rf $UNWIND_GIT_DIR" EXIT

git clone git@github.com:mongodb-forks/libunwind.git $UNWIND_GIT_DIR
git -C $UNWIND_GIT_DIR checkout $REVISION

pushd $UNWIND_GIT_DIR
autoreconf -i
./configure
make dist
popd

DIST_TGZ=$UNWIND_GIT_DIR/libunwind-$VERSION.tar.gz

mkdir -p $DEST_DIR/dist
tar --strip-components=1 -xvzf $DIST_TGZ  -C $DEST_DIR/dist
# mv libunwind-$VERSION libunwind