config 3.0 KB

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