clang - getting started with git

Hi,

Are there instruction for checking out/compiling clang with git
instead of svn? Is it possible to build clang with ninja instead of
make?

The getting started doc is for svn - http://clang.llvm.org/get_started.html

Many — perhaps even most — of us do use git, despite the repository
being canonically in svn. LLVM.org provides a standard git mirror, which
you can read about on LLVM's Getting Started page:
  http://llvm.org/docs/GettingStarted.html#starting

If you're planning on committing patches yourself, I would recommend
setting up your repository with git-svn; that's also described in that
document.

John.

here is how I setup my dev environment from scratch:

first I search google for "llvm git", because I can never remember the
git mirror's address. This takes me to
http://llvm.org/docs/GettingStarted.html#git_mirror

then here's what I do (I'm doing this for real as I'm typing this):

$ mkdir llvm
$ cd llvm
$ git clone http://llvm.org/git/llvm.git
$ mv llvm source
$ cd source/tools
$ git clone http://llvm.org/git/clang.git
$ cd ../../
$ mkdir debug+asserts
$ cd debug+asserts
$ cmake -G Ninja ../source -DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++ -DLLVM_ENABLE_ASSERTIONS=ON
-DCMAKE_BUILD_TYPE=RelWithDebInfo
$ ninja

You should now be building LLVM/Clang :slight_smile:

A few notes:
You'll need a pretty recent CMake (>=2.8.8 IIRC). If you're on Mac,
you will need to build from source to enable Ninja since CMake doesn't
enable ninja "by default" on mac. You can force it to enable ninja by
passing in a special flag (IIRC it is -DCMAKE_ENABLE_NINJA).
I usually just build ninja from scratch (clone
<https://github.com/martine/ninja>).

I hope that helps.
--Sean Silva

Done.

Does that means anyone has commit writes in llvm/clang repositories?
It seems dangerous.

Nope. Only people with commit rights may commit that way.

-eric

Then what's the point of git-svn? Just use this workflow:

1. Clone the git repository

2. Put it on github or somewhere else accessible

3. Then those with commit rights can pull from the git repository and push it up to svn. Or just make a diff with git if that's what's preferred.

As long as you are working without committing in llvm.org/svn, you can
live w/o git-svn.

Whenever you would obtain commit access, git-svn could be set up easily.
You may ask again about git-svn, then.

I suppose git-diff could be accepted on the lists.

...Takumi

Would be easier to just pull from the git repository if most developers with commit access uses git-svn.