config 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. # vim: filetype=yaml sw=2
  2. version: 1.12.5
  3. filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
  4. var:
  5. go14_version: 1.4.3
  6. container:
  7. use_container: 1
  8. setup: |
  9. [% c("var/setarch") -%]
  10. mkdir -p /var/tmp/dist
  11. tar -C /var/tmp/dist -xf $rootdir/[% c("go_tarfile") %]
  12. export GOOS=[% c("var/GOOS") %]
  13. export GOARCH=[% c("var/GOARCH") %]
  14. export GOPATH=/var/tmp/dist/gopath
  15. [% IF c("var/linux-x86_64") -%]
  16. export GOTARGETBIN=${GOPATH}/bin
  17. [% ELSE %]
  18. export GOTARGETBIN=${GOPATH}/bin/${GOOS}_${GOARCH}
  19. [% END -%]
  20. export PATH=/var/tmp/dist/go/bin:/var/tmp/dist/gopath/bin:"$PATH"
  21. [% IF c("var/linux") -%]
  22. export CGO_LDFLAGS_ALLOW="-z|noexecstack"
  23. export CGO_LDFLAGS="-z noexecstack"
  24. [% END -%]
  25. [% IF c("var/linux-i686") -%]
  26. export CGO_ENABLED=1
  27. [% END -%]
  28. # Template build script for building a go package (library or
  29. # executable).
  30. # This can be called as projects/go/var/build_go_lib.
  31. # You need to define /var/go_lib, and optionally var/go_lib_install as
  32. # a list of install targets. If you want to construct the output tar
  33. # yourself (usually for executable packages), set var/go_lib_no_output
  34. # to 1.
  35. build_go_lib: |
  36. #!/bin/bash
  37. [% c("var/set_default_env") -%]
  38. [% pc('go', 'var/setup', { go_tarfile => c('input_files_by_name/go') }) %]
  39. distdir=/var/tmp/dist/[% project %]
  40. mkdir -p /var/tmp/build
  41. tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
  42. [% FOREACH dep = c("var/go_lib_deps") -%]
  43. tar -C /var/tmp/dist -xf [% c('input_files_by_name/' _ dep) %]
  44. [% END -%]
  45. mkdir -p $(dirname "$GOPATH/src/[% c("var/go_lib") %]")
  46. mv /var/tmp/build/[% project %]-[% c('version') %] "$GOPATH/src/[% c("var/go_lib") %]"
  47. cd "$GOPATH/src/[% c("var/go_lib") %]"
  48. for p in $(ls -1 $rootdir/*.patch 2> /dev/null | sort)
  49. do
  50. patch -p1 < $p
  51. done
  52. [% IF c("var/build_go_lib_pre"); GET c("var/build_go_lib_pre"); END; -%]
  53. [% IF c("var/go_lib_install") -%]
  54. [% FOREACH inst IN c("var/go_lib_install") %]
  55. [% c("var/go_lib_install_env") %] go install -ldflags '[% c("var/go_lib_ldflags") %]' [% inst %]
  56. [% END %]
  57. [% ELSE %]
  58. [% c("var/go_lib_install_env") %] go install -ldflags '[% c("var/go_lib_ldflags") %]' [% c("var/go_lib") %]
  59. [% END %]
  60. cd /var/tmp/dist
  61. [% IF c("var/build_go_lib_post"); GET c("var/build_go_lib_post"); END; -%]
  62. [% IF !c("var/go_lib_no_output") -%]
  63. [% c('tar', {
  64. tar_src => [ 'gopath' ],
  65. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  66. }) %]
  67. [% END %]
  68. targets:
  69. windows:
  70. var:
  71. GOOS: windows
  72. windows-i686:
  73. var:
  74. GOARCH: 386
  75. windows-x86_64:
  76. var:
  77. GOARCH: amd64
  78. osx-x86_64:
  79. var:
  80. GOOS: darwin
  81. GOARCH: amd64
  82. arch_deps:
  83. - faketime
  84. linux:
  85. var:
  86. GOOS: linux
  87. linux-x86_64:
  88. var:
  89. GOARCH: amd64
  90. linux-i686:
  91. var:
  92. GOARCH: 386
  93. input_files:
  94. - project: container-image
  95. - name: '[% c("var/compiler") %]'
  96. project: '[% c("var/compiler") %]'
  97. enable: '[% c("var/windows") || c("var/osx") %]'
  98. - URL: 'https://golang.org/dl/go[% c("version") %].src.tar.gz'
  99. name: go
  100. sha256sum: 2aa5f088cbb332e73fc3def546800616b38d3bfe6b8713b8a6404060f22503e8
  101. - URL: 'https://golang.org/dl/go[% c("var/go14_version") %].src.tar.gz'
  102. name: go14
  103. sha256sum: 9947fc705b0b841b5938c48b22dc33e9647ec0752bae66e50278df4f23f64959