buildout.cfg 4.02 KB
Newer Older
Kirill Smelkov's avatar
Kirill Smelkov committed
1 2
# Go language - https://golang.org/
[buildout]
3 4
extends =
  ../findutils/buildout.cfg
5
  ../gcc/buildout.cfg
6
  ../git/buildout.cfg
7
  ../pkgconfig/buildout.cfg
8

9
parts = gowork
Kirill Smelkov's avatar
Kirill Smelkov committed
10

11
# ---- Go builds itself ----
Kirill Smelkov's avatar
Kirill Smelkov committed
12 13 14 15 16 17 18

[golang-common]
recipe = slapos.recipe.cmmi
configure-command = :
location = ${buildout:parts-directory}/${:_buildout_section_name_}
make-binary =
make-targets= cd src && ./all.bash && cp -alf .. ${:location}
19 20
# some testdata files have an issue with slapos.extension.strip.
post-install = ${findutils:location}/bin/find ${:location}/src -type d -name testdata -exec rm -rf {} \; || true
Kirill Smelkov's avatar
Kirill Smelkov committed
21
environment =
22
  PATH=${gcc-8.2:location}/bin:%(PATH)s
Kirill Smelkov's avatar
Kirill Smelkov committed
23 24 25
  GOROOT_FINAL=${:location}
  ${:environment-extra}

26 27 28 29
[golang14-repository]
<= git-repository
repository = https://github.com/golang/go.git
revision = go1.4.3-16-g4d5426a
Kirill Smelkov's avatar
Kirill Smelkov committed
30 31 32

[golang14]
<= golang-common
33
path = ${golang14-repository:location}
Kirill Smelkov's avatar
Kirill Smelkov committed
34
environment-extra =
35
make-targets= cd src && ./make.bash && cp -alf .. ${:location}
Kirill Smelkov's avatar
Kirill Smelkov committed
36 37


Kirill Smelkov's avatar
Kirill Smelkov committed
38
[golang19]
Kirill Smelkov's avatar
Kirill Smelkov committed
39
<= golang-common
40 41
url = https://dl.google.com/go/go1.9.7.src.tar.gz
md5sum = 3c2cf876ed6612a022574a565206c6ea
Kirill Smelkov's avatar
Kirill Smelkov committed
42

Kirill Smelkov's avatar
Kirill Smelkov committed
43
# go1.9 needs go1.4 to bootstrap
Kirill Smelkov's avatar
Kirill Smelkov committed
44 45
environment-extra =
  GOROOT_BOOTSTRAP=${golang14:location}
Alain Takoudjou's avatar
Alain Takoudjou committed
46

Kirill Smelkov's avatar
Kirill Smelkov committed
47
[golang1.10]
Alain Takoudjou's avatar
Alain Takoudjou committed
48
<= golang-common
Kirill Smelkov's avatar
Kirill Smelkov committed
49 50
url = https://dl.google.com/go/go1.10.3.src.tar.gz
md5sum = d15dfb264105c5e84fbe33f4a4aa5021
Alain Takoudjou's avatar
Alain Takoudjou committed
51

Kirill Smelkov's avatar
Kirill Smelkov committed
52
# go1.10 needs go1.4 to bootstrap
Alain Takoudjou's avatar
Alain Takoudjou committed
53 54
environment-extra =
  GOROOT_BOOTSTRAP=${golang14:location}
55 56 57 58 59 60 61 62 63 64 65


# ---- infrastructure to build Go workspaces / projects ----

# gowork is a top-level section representing workspace
#
# users should add `install` field to [gowork] to describe packages they want to
# be installed (+ automatically their dependencies are installed too). e.g.
#
#   [gowork]
#   install =
66 67
#       lab.nexedi.com/kirr/neo/go/...
#       github.com/pkg/profile
68
#       golang.org/x/perf/cmd/benchstat
69
#
70 71 72 73 74 75 76 77 78
# For Cgo support pkg-config is made pre-available by gowork, and users
# should list paths where to search for pkg-config files, e.g. this way:
#
#   [gowork]
#   cpkgpath =
#       ${sqlite3:location}/lib/pkgconfig
#       ${zlib:location}/lib/pkgconfig
#
# It is also possible to specify Go build flags used for compilation e.g. this way:
79 80 81
#
#   [gowork]
#   buildflags = -race
82 83 84 85 86 87 88
[gowork]
directory = ${buildout:directory}/go.work
src	= ${:directory}/src
bin	= ${:directory}/bin
depends = ${gowork.goinstall:recipe}

# go version used for the workspace (possible to override in applications)
Kirill Smelkov's avatar
Kirill Smelkov committed
89
golang  = ${golang1.10:location}
90

91 92 93
# no special build flags by default
buildflags =

94 95 96
# empty pkg-config path by default
cpkgpath =

97 98 99 100 101 102 103 104 105 106 107 108 109
# everything is done by dependent parts
recipe  = plone.recipe.command
command = :

# env.sh for compiling and running go programs
[gowork]
env.sh  = ${gowork-env.sh:output}

[gowork-env.sh]
recipe	= slapos.recipe.template
url     = ${:_profile_base_location_}/goenv.sh.in
output	= ${gowork:directory}/env.sh
depends = ${gowork.mkdir:recipe}
110
md5sum	= 7a067a3974c446c3eaa0e82818ba1adb
111 112 113 114 115 116 117 118 119 120 121 122 123 124

[gowork.mkdir]
# NOTE do not use slapos.cookbook:mkdirectory here - if anything in software (not instance)
# uses slapos.cookbook:* in recipe - slapos.cookbook will get compiled against system
# libxml/libxslt or fail to bootstrap at all if those are not present.
recipe  = plone.recipe.command
command = mkdir -p ${gowork:directory}
update-command = ${:command}
stop-on-error = true

# install go packages
# clients should put package list to install to gowork:install ("..." requests installing everything)
[gowork.goinstall]
recipe  = plone.recipe.command
125
command = bash -c ". ${gowork:env.sh} && go install ${gowork:buildflags} -v $(echo -n '${gowork:install}' |tr '\n' ' ')"
126 127 128 129 130 131 132 133 134 135 136 137 138 139
update-command = ${:command}
stop-on-error = true


[git-repository]
recipe  = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git

# a go package should:
# 1) <= go-git-package
# 2) provide go.importpath
# 3) provide repository (which is not the same as importpath in general case)
#
# the list of go packages for a go workspace state can be automatically
140
# generated with the help of gowork-snapshot tool.
141 142 143
[go-git-package]
<= git-repository
location = ${gowork:src}/${:go.importpath}