# Go language - https://golang.org/ [buildout] extends = ../findutils/buildout.cfg ../gcc/buildout.cfg ../git/buildout.cfg ../pkgconfig/buildout.cfg parts = gowork # ---- Go builds itself ---- [golang-common] recipe = slapos.recipe.cmmi shared = true configure-command = : location = @@LOCATION@@ make-binary = make-targets= cd src && ./all.bash && cp -alf .. ${:location} # gcc version to use gcc-bin-directory = ${gcc-8.2:location}/bin # 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 environment = PATH=${:gcc-bin-directory}:%(PATH)s GOROOT_FINAL=${:location} ${:environment-extra} [golang14] <= golang-common # https://golang.org/doc/install/source#bootstrapFromSource url = https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz md5sum = dbf727a4b0e365bf88d97cbfde590016 environment-extra = make-targets= cd src && ./make.bash && cp -alf .. ${:location} [golang19] <= golang-common url = https://dl.google.com/go/go1.9.7.src.tar.gz md5sum = 3c2cf876ed6612a022574a565206c6ea # go1.9 needs go1.4 to bootstrap environment-extra = GOROOT_BOOTSTRAP=${golang14:location} [golang1.10] <= golang-common url = https://dl.google.com/go/go1.10.3.src.tar.gz md5sum = d15dfb264105c5e84fbe33f4a4aa5021 # go1.10 needs go1.4 to bootstrap environment-extra = GOROOT_BOOTSTRAP=${golang14:location} [golang1.11] <= golang-common url = https://dl.google.com/go/go1.11.4.src.tar.gz md5sum = a77697673215be465d1b583680ef2318 # go1.11 needs go1.4 to bootstrap environment-extra = GOROOT_BOOTSTRAP=${golang14:location} [golang1.12] <= golang-common url = https://dl.google.com/go/go1.12.9.src.tar.gz md5sum = 6132109d4050da349eadc9f7b0304ef4 # go1.11 needs go1.4 to bootstrap environment-extra = GOROOT_BOOTSTRAP=${golang14:location} # ---- 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 = # lab.nexedi.com/kirr/neo/go/... # github.com/pkg/profile # golang.org/x/perf/cmd/benchstat # # 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: # # [gowork] # buildflags = -race [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) golang = ${golang1.10:location} # gcc version must be compatible with go version selected gcc-bin-directory = ${golang1.10:gcc-bin-directory} # no special build flags by default buildflags = # empty pkg-config path by default cpkgpath = # 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} md5sum = 7eaad1f9aabd3cfad554975098c5d4c3 [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 command = bash -c ". ${gowork:env.sh} && go install ${gowork:buildflags} -v $(echo -n '${gowork:install}' |tr '\n' ' ')" 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 # generated with the help of gowork-snapshot tool. [go-git-package] <= git-repository location = ${gowork:src}/${:go.importpath}