blob: a42acfa01f109fc6bef06332b3b78dd8c3e12d22 [file] [log] [blame]
Brian Silvermancce76582015-10-31 23:38:52 +00001#!/bin/bash
2
3# This script builds a Debian package from a Bazel source tree with the
4# correct version.
5# The only argument is the path to a Bazel source tree.
6
7set -e
8set -u
9
10BAZEL_SOURCE="$1"
11
12VERSION="$(date +%Y%m%d%H%M)+$(GIT_DIR="${BAZEL_SOURCE}/.git" git rev-parse --short HEAD)"
Brian Silvermand1c19fb2016-07-07 00:10:57 -070013DEB="bazel_${VERSION}_amd64.deb"
Brian Silvermancce76582015-10-31 23:38:52 +000014
15"${BAZEL_SOURCE}/compile.sh" compile
16(
17cd "${BAZEL_SOURCE}"
Brian Silvermand1c19fb2016-07-07 00:10:57 -070018./output/bazel build -c opt //scripts/packages:bazel-debian --embed_label="${VERSION}"
Brian Silvermancce76582015-10-31 23:38:52 +000019)
20
21cp "${BAZEL_SOURCE}/bazel-bin/scripts/packages/bazel-debian.deb" "${DEB}"
22
23echo "Output is at ${DEB}"