User:Ehsan/How to build-clang

From MozillaWiki
Jump to: navigation, search

This explains how to build clang on a pristine desktop-build image:

mkdir -p /home/worker/workspace/build
cd /home/worker/workspace/build
git clone https://github.com/mozilla/gecko-dev.git src
git clone https://github.com/mozilla/build-tooltool.git
cd src
../build-tooltool/tooltool.py -m browser/config/tooltool-manifests/linux64/releng.manifest fetch
cd build/unix/build-clang
vi build-clang.py # Change the centOS6 global variable to true
./build-clang.py -c clang-trunk.json

After the refactorings, the following new tools are needed:

git clone git://github.com/martine/ninja.git && cd ninja
git checkout release
./configure.py --bootstrap
cp ninja /usr/local/bin/ninja
cp ninja /usr/local/bin/ninja-build

The builds can run on TaskCluster using a payload like this:

{
	"created": "2015-10-14T20:00:24.775Z",
	"deadline": "2015-10-15T21:00:24.775Z",
	"provisionerId": "aws-provisioner-v1",
	"workerType": "opt-linux64",
	"retries": 5,
	"expires": "2016-10-12T02:17:01.554Z",
	"payload": {
		"maxRunTime": 36000,
		"image": "taskcluster/desktop-build:0.1.11",
		"artifacts": {
			"public/clang.tar.xz": {
				"path": "/home/worker/workspace/artifacts/clang.tar.xz",
				"expires": "2016-10-12T02:17:01.554913Z",
				"type": "file"
			}
		},
		"command": [
			"/bin/bash",
			"-c",
			"cd /home/worker/ && ./bin/checkout-sources.sh && ./workspace/build/src/testing/taskcluster/scripts/misc/build-clang-linux.sh"
		],
		"env": {
			"GECKO_HEAD_REV": "3cb54681feb4",
			"GECKO_HEAD_REPOSITORY": "https://hg.mozilla.org/try"
		}
	},
	"metadata": {
		"owner": "ehsan@mozilla.com",
		"source": "http://todo.com/soon",
		"name": "Build Clang (Linux64)",
		"description": "Build Clang"
	},
	"tags": {
		"createdForUser": "eakhgari@mozilla.com"
	},
	"extra": {
		"index": {
			"rank": 92444
		}
	}
}

Note that you probably want to use the "Update Timestamps" button on TaskCreator and then change the "deadline" to be a day after "created" (the default one hour deadline is insufficient to build clang.)