|
This commit adds a new script, llvm-env, which sets up the environment for
working with LLVM. It looks for an environment variable LLVM_ROOT and tries to
create the following hierarchy:
$LLVM_ROOT
`- repos
| `- llvm
| `- clang
| `- compiler-rt
| [...]
`- <branch1>
| `- llvm
| `- build
| `- debug
`- <branch2>
| `- llvm
| `- build
| `- debug
[...]
The $LLVM_ROOT/repos directory contains all the repositories, as checked out by
llvm-prepare, and will always track master. For other branches,
llvm-env <branch_name> will create a new directory, $LLVM_ROOT/<branch_name>,
and will add an llvm worktree directory there. If -d is passed, it will also
create a debug directory there, otherwise it will create a build directory.
Notice that these 2 can live in parallel, and we can switch between them at any
time by invoking llvm-env. It will set LLVM_SRC and LLVM_BLD accordingly, and
also modify the path to point to the binaries in LLVM_BLD.
The other scripts will now work with the LLVM_SRC and LLVM_BLD set by llvm-env
in the current shell. Because llvm-env controls whether or not we're doing a
debug build, llvm-build will no longer take a -d flag (it will instead look
after a LLVM_DEBUG environment variable, also set by llvm-env). There are
changes in llvm-projs, too, because now it no longer creates links - instead it
creates worktree directories in the corresponding $LLVM_ROOT/<branch>/llvm.
Other scripts have also been updated accordingly.
To make things easier, here are some of the changes that I had to make that are
not particularly important for the review (pretty mechanical stuff):
* Moved function has() from llvm-branch to llvm-common, so I could reuse it
* Because of this, I had to rename the has() function in llvm-projs to
has_link(), which is actually a better name for it anyway
* Disable the checks for LLVM_SRC and LLVM_BLD in llvm-common
Change-Id: I9e02f6d8e0c803e79838845013b81331dffba99c
|
|
Fix some typos in the READMEs.
Nit #1: Use full path when cloning repo
If we use the basename, we're forced to run the script from the directory where
we want the whole thing to live. By using the full path, we can run the script
from anywhere.
Nit #2: Use more general name for variable (generator vs ninja)
Nit #3 (noticed by Renato): Set generator explicitly in llvm-build
When ninja is not found, we use make for the build. However, we don't tell
cmake about it and instead let it choose its own default generator. This commit
explicitly sets the cmake generator to "Unix Makefiles", in case cmake's default
generator for the current platform is not make.
In order to get this to work, it was necessary to make some changes to the
safe_run helper function, so we wouldn't lose the quotes around "Unix
Makefiles".
Change-Id: I9592645d517d006b0e680a2996d498e57f009400
|