-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve build documentation and scripts (#395)
Add virtualenv as a requirement and deal with more versions of it. Add option to create a worktree instead of clone download. No need to clone if there is already a local repository with the right commit. Find Python3 outside of the virtualenv too. Generate the compilation database by default for programming tools. This allows for example clangd-based tools to understand the code. Use subshell instead of changing directory, less robust. Clarify the build recipe by referring to the CI files. Take into account the submodules when cloning.
- Loading branch information
Showing
5 changed files
with
88 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,41 @@ | ||
#!/usr/bin/env bash | ||
##===- utils/clone-llvm.sh - Build LLVM for github workflow --*- Script -*-===## | ||
# | ||
# | ||
# This file licensed under the Apache License v2.0 with LLVM Exceptions. | ||
# See https://llvm.org/LICENSE.txt for license information. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
# | ||
##===----------------------------------------------------------------------===## | ||
# | ||
# This script checks out LLVM. We use this instead of a git submodule to avoid | ||
# excessive copies of the LLVM tree. | ||
# | ||
##===----------------------------------------------------------------------===## | ||
|
||
export commithash=35ca64989a75c93ea7e935ef11c3d1883c21cccd | ||
# The LLVM commit to use. | ||
# TODO: create a branch or a tag instead, to avoid fetching main and | ||
# this commit later. | ||
commithash=35ca64989a75c93ea7e935ef11c3d1883c21cccd | ||
|
||
git clone --depth 1 https://github.com/llvm/llvm-project.git llvm | ||
pushd llvm | ||
git fetch --depth=1 origin $commithash | ||
git checkout $commithash | ||
popd | ||
here=$PWD | ||
|
||
# Use --worktree <directory-of-local-LLVM-repo> to reuse some existing | ||
# local LLVM git repository | ||
if [ x"$1" == x--llvm-worktree ]; then | ||
git_central_llvm_repo_dir="$2" | ||
( | ||
cd $git_central_llvm_repo_dir | ||
# Use force just in case there are various experimental iterations | ||
# after you have removed the llvm directory | ||
git worktree add --force "$here"/llvm $commithash | ||
) | ||
else | ||
# Fetch main first just to clone | ||
git clone --depth 1 https://github.com/llvm/llvm-project.git llvm | ||
( | ||
cd llvm | ||
# Then fetch the interesting part | ||
git fetch --depth=1 origin $commithash | ||
git checkout $commithash | ||
) | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,11 @@ | |
##===----------------------------------------------------------------------===## | ||
|
||
python3 -m virtualenv sandbox | ||
source sandbox/bin/activate | ||
# The real path to source might depend on the virtualenv version | ||
if [ -r sandbox/local/bin/activate ]; then | ||
source sandbox/local/bin/activate | ||
else | ||
source sandbox/local/activate | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
fifield
Collaborator
|
||
fi | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install -r utils/requirements.txt |
I think this should be
sandbox/bin/activate
. This change broke the script for me to where it now installs the packages globally, not just in the virtualenv.