config 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. # vim: filetype=yaml sw=2
  2. version: 1.16.7
  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. android:
  98. var:
  99. GOOS: android
  100. android-x86:
  101. var:
  102. GOARCH: 386
  103. android-x86_64:
  104. var:
  105. GOARCH: amd64
  106. android-armv7:
  107. var:
  108. GOARCH: arm
  109. android-aarch64:
  110. var:
  111. GOARCH: arm64
  112. input_files:
  113. - project: container-image
  114. - name: '[% c("var/compiler") %]'
  115. project: '[% c("var/compiler") %]'
  116. enable: '[% ! c("var/linux") || c("var/linux-cross") %]'
  117. - URL: 'https://golang.org/dl/go[% c("version") %].src.tar.gz'
  118. name: go
  119. sha256sum: 1a9f2894d3d878729f7045072f30becebe243524cf2fce4e0a7b248b1e0654ac
  120. - URL: 'https://golang.org/dl/go[% c("var/go14_version") %].src.tar.gz'
  121. name: go14
  122. sha256sum: 9947fc705b0b841b5938c48b22dc33e9647ec0752bae66e50278df4f23f64959
  123. - filename: 0001-Use-fixed-go-build-tmp-directory.patch
  124. enable: '[% c("var/android") %]'