config 3.4 KB

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