This is an archive of the discontinued LLVM Phabricator instance.

Utility for checking out llvm, clang, and associated tools and configuring a build folder
Needs ReviewPublic

Authored by lefticus on Jan 11 2018, 11:04 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Based on Chandler's talk at Pacific++ 2017

This script is intended for Unix-like hosts. It checks out llvm, clang, lld and utilities from svn and configures a build directory using ninja. It is intended to be very simple, providing only minimal options.

Diff Detail

Repository
rL LLVM

Event Timeline

lefticus created this revision.Jan 11 2018, 11:04 AM
joerg added a subscriber: joerg.Jan 11 2018, 2:47 PM
joerg added inline comments.
utils/checkout_llvm.sh
1

Add an explicit #!/bin/sh

13

Please just use cd llvm/tools and cd .././ below. Same for the rest.

40

I'd suggest putting $2 into a variable, shifting twice and then appending any remaining arguments. Makes the script a bit more useful and allows overriding undesirable settings.

MatzeB added a subscriber: MatzeB.Jan 11 2018, 2:59 PM

This whole script is pretty opinionated:

  • Use of svn vs. the git mirrors
  • picking a specific set of llvm projects
  • picking a specific set of cmake options (BUILD_TYPE=Release, ENABLE_ASSERTIONS=OFF, ninja...)

How can we avoid giving the impression that these are somehow recommended? (Because really I could start 3 longish bikeshed-like discussions now about what choices would be better here...)

This whole script is pretty opinionated:

  • Use of svn vs. the git mirrors
  • picking a specific set of llvm projects
  • picking a specific set of cmake options (BUILD_TYPE=Release, ENABLE_ASSERTIONS=OFF, ninja...)

How can we avoid giving the impression that these are somehow recommended? (Because really I could start 3 longish bikeshed-like discussions now about what choices would be better here...)

I think this is an important question.

Fundamentally, I *like* this script precisely because it is a bit opinionated. For some users, the fact that there are options doesn't matter and they'd just like a "reasonable" checkout (for some highly subjective definition). But I totally see your point and am not sure how to avoid this becoming some tacit endorsement -- which it should not be!

Maybe we could give it a name and prefix the script with that name so that it was very clear that this is just *one* way to check out LLVM. My suggestion for this would be something along the lines of toolchain-svn and the script could be toolchain_svn_checkout.sh or some such. The idea being, that this includes all the LLVM subprojects that are needed to build a complete LLVM toolchain. Maybe there are better names for this slice of opinionated options though. The goal (I think) should be to capture the motivation that leads to the opinionated parts of the script, or if it is arbitrary, the choice. So the subproject set is probably based on a particular motivation / use case, but it's an arbitrary choice to use svn vs. git.

utils/checkout_llvm.sh
25–35

If you want these three, you probably also want openmp.

This whole script is pretty opinionated:

  • Use of svn vs. the git mirrors
  • picking a specific set of llvm projects
  • picking a specific set of cmake options (BUILD_TYPE=Release, ENABLE_ASSERTIONS=OFF, ninja...)

How can we avoid giving the impression that these are somehow recommended? (Because really I could start 3 longish bikeshed-like discussions now about what choices would be better here...)

I think this is an important question.

Fundamentally, I *like* this script precisely because it is a bit opinionated. For some users, the fact that there are options doesn't matter and they'd just like a "reasonable" checkout (for some highly subjective definition). But I totally see your point and am not sure how to avoid this becoming some tacit endorsement -- which it should not be!

Maybe we could give it a name and prefix the script with that name so that it was very clear that this is just *one* way to check out LLVM. My suggestion for this would be something along the lines of toolchain-svn and the script could be toolchain_svn_checkout.sh or some such. The idea being, that this includes all the LLVM subprojects that are needed to build a complete LLVM toolchain. Maybe there are better names for this slice of opinionated options though. The goal (I think) should be to capture the motivation that leads to the opinionated parts of the script, or if it is arbitrary, the choice. So the subproject set is probably based on a particular motivation / use case, but it's an arbitrary choice to use svn vs. git.

get_started.sh? Well git vs. svn is really personal preference so okay, the set of projects is also fine in that it gives you a typical clang based toolchain which should be the most popular use of llvm. I'm not sure why you would enable release mode and turn of assertions, I would expect someone that bothers to checkout from version control wants to do development and should have at least assertions turned on...

There's a medium-term goal of migrating to git, so an svn-based script seems like the wrong direction.
I've been using the experimental git mono-repo for a while and I'm finding it pretty convenient. A sample configuration script for setting up a useful subset of projects and canonical CMake parameters seems like a good helpful starting point.