The latest nightly snapshot can be built with the following steps. First, ensure you add to your apt.sources the nightly repositories for your distribution.
Use apt-get to retrieve the sources of the llvm-toolchain-snapshot package,
$ mkdir build/ && cd build/
$ apt-get source llvm-toolchain-snapshot
This should download all the original snapshot tarballs, and create a directory named llvm-toolchain-snapshot-X.Y~++202.... Depending on the last update of the jenkins nightly builder, the snapshot version number and git hash will vary.
Then install the build dependencies,
$ sudo apt-get build-dep llvm-toolchain-snapshot
On older versions of Ubuntu, some build dependencies cannot be satisfied because the required gcc versions are missing. To fix this issue you should add the Ubuntu Toolchain PPA to your system before executing the above command.
Once everything is ready, enter the directory and build the package,
$ cd llvm-toolchain-snapshot-X.Y~++202*/
$ debuild -us -uc -b
In some cases you may want to build a snapshot package manually. For example to debug the Debian package scripts, or to build a package for a specific development branch. In that scenario, follow the following steps:
Clone the llvm-toolchain source package.
The source package is maintained in git, you can retrieve it using the debcheckout command,
$ git clone https://salsa.debian.org/pkg-llvm-team/llvm-toolchain.git -b snapshot snapshot
Retrieve the latest snapshot and create original tarballs.
Run the orig-tar.sh script,
$ sh snapshot/debian/orig-tar.sh
which will retrieve the latest version for each LLVM subproject (llvm, clang, lldb, etc.) from the git repository and repack it as a set of tarballs.
Unpack the original tarballs and apply quilt Debian patches.
run the unpack.sh script,
$ sh snapshot/debian/unpack.sh
which will unpack the source tree inside a new directory such as branches/llvm-toolchain-snapshot_X.Y~++200*. Depending on the current snapshot version number and git hash, the directory name will be different. Quilt patches will then be applied.
Build the binary packages using,
$ debian/rules binary
When debugging, successive builds can be recompiled faster by using tools such as ccache (PATH=/usr/lib/ccache:$PATH debian/rules binary).
When using orig-tar.sh, if you need to retrieve a specific branch, you can pass the branch name as the first argument. For example, to get the 13 release branch at https://github.com/llvm/llvm-project/tree/release/13.x you should use,
$ sh 13/debian/orig-tar.sh release/13.x
To retrieve a specific release candidate, you can pass the branch name as the first argument, and the tag rc number as the second argument. For example, to get the 13.0.1 release candidate rc3 at https://github.com/llvm/llvm-project/releases/tag/llvmorg-13.0.1-rc3 you should use,
$ sh 13/debian/orig-tar.sh 13.0.1 rc3
The Debian package for each LLVM point release is maintained as a separate git branch. For example, the 3.8 release lives at 3.8.
The current snapshot release is maintained at branches/snapshot.
for f in 4.0 5.0 6.0 7.0 snapshot; do
git clone email@example.com:pkg-llvm-team/llvm-toolchain.git -b $f $f;
The script qualify-clang.sh that is found at the root should be used to quickly test a newly built clang package. It runs a short set of sanity-check tests.
The script releases/snapshot/debian/prepare-new-release.sh is used when preparing a new point release. It automatically replaces version numbers in various files of the package.