config 2.7 KB

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