config 2.9 KB

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