-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprotobuf-setup.hcl
48 lines (40 loc) · 1.33 KB
/
protobuf-setup.hcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
param "build_dir" {
default = "{{env `HOME`}}/protobuf-build"
}
param "install_dir" {
default = "{{env `HOME`}}/protobuf-install"
}
param "protobuf_version" {
default = "3.1.0"
}
param "packages" {
default = "autoconf automake libtool curl make g++ unzip zip"
}
task "package-deps" {
check = "dpkg -s {{param `packages`}} >/dev/null 2>&1"
apply = "apt-get update 2>&1 > /dev/null && apt-get -y install {{param `packages`}}"
}
file.directory "proto-build" {
destination = "{{param `build_dir`}}"
}
task "protobuf-src-dl" {
check = "[[ -f v{{param `protobuf_version`}}.tar.gz ]]"
apply = "curl -L -O https://github.com/google/protobuf/archive/v{{param `protobuf_version`}}.tar.gz"
dir = "{{param `build_dir`}}"
interpreter = "/bin/bash"
depends = ["task.package-deps","file.directory.proto-build"]
}
task "protobuf-src-unzip" {
check = "[[ -d protobuf-{{param `protobuf_version`}} ]]"
apply = "tar zxvf v{{param `protobuf_version`}}.tar.gz"
dir = "{{param `build_dir`}}"
interpreter = "/bin/bash"
depends = ["task.protobuf-src-dl"]
}
task "autogen.sh" {
check = "[[ -f configure ]]"
apply = "./autogen.sh"
dir = "{{param `build_dir`}}/protobuf-{{param `protobuf_version`}}"
interpreter = "/bin/bash"
depends = ["task.protobuf-src-unzip"]
}