config 3.7 KB

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