Skip to content

Commit 2685f2c

Browse files
authored
Use venv to install llvm dependencies and run build script (#4514)
Installing pip packages system-wide is no longer recommended, therefore we create virtual environment for setting up the build environment for LLVM.
1 parent 2fe36f4 commit 2685f2c

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

wamr-compiler/build_llvm.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,17 @@
33
# Copyright (C) 2020 Intel Corporation. All rights reserved.
44
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55

6-
/usr/bin/env python3 -m pip install --user -r ../build-scripts/requirements.txt
6+
TEMP_DIR=$(mktemp -d)
7+
8+
cleanup() {
9+
local exit_code=$?
10+
rm -rf "$TEMP_DIR"
11+
exit $exit_code
12+
}
13+
14+
trap cleanup EXIT INT TERM
15+
16+
/usr/bin/env python3 -m venv --clear "$TEMP_DIR"
17+
source "$TEMP_DIR/bin/activate"
18+
/usr/bin/env python3 -m pip install -r ../build-scripts/requirements.txt
719
/usr/bin/env python3 ../build-scripts/build_llvm.py "$@"

wamr-compiler/build_llvm_arc.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
# Copyright (C) 2020 Intel Corporation. All rights reserved.
44
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55

6-
/usr/bin/env python3 -m pip install --user -r ../build-scripts/requirements.txt
7-
/usr/bin/env python3 ../build-scripts/build_llvm.py --platform arc "$@"
6+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7+
$SCRIPT_DIR/build_llvm.sh --platform arc "$@"

wamr-compiler/build_llvm_xtensa.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
# Copyright (C) 2020 Intel Corporation. All rights reserved.
44
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55

6-
/usr/bin/env python3 -m pip install --user -r ../build-scripts/requirements.txt
7-
/usr/bin/env python3 ../build-scripts/build_llvm.py --platform xtensa "$@"
6+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7+
$SCRIPT_DIR/build_llvm.sh --platform xtensa "$@"

0 commit comments

Comments
 (0)