build 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/bash
  2. [% c("var/set_default_env") -%]
  3. [% pc('go', 'var/setup', { go_tarfile => c('input_files_by_name/go') }) %]
  4. [% pc(c('var/compiler'), 'var/setup', {
  5. compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')),
  6. hardened_gcc => c('var/container/suite') != 'buster'
  7. }) %]
  8. tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/binutils') %]
  9. export PATH="/var/tmp/dist/binutils/bin:$PATH"
  10. export CGO_ENABLED=1
  11. [% IF c("var/linux-cross") %]
  12. # libcap includes
  13. mkdir -p /var/tmp/dist/gcc-cross/[% c("var/crosstarget") %]/include/sys/
  14. cp /usr/include/sys/capability.h /var/tmp/dist/gcc-cross/[% c("var/crosstarget") %]/include/sys/
  15. # libcap libraries
  16. cp /lib/[% c("var/crosstarget") %]/libcap.* /var/tmp/dist/gcc-cross/[% c("var/crosstarget") %]/lib/
  17. cp /usr/lib/[% c("var/crosstarget") %]/libcap.* /var/tmp/dist/gcc-cross/[% c("var/crosstarget") %]/lib/
  18. [% IF c("var/linux-arm") %]
  19. cp /lib/[% c("var/crosstarget") %]/libattr.* /var/tmp/dist/gcc-cross/[% c("var/crosstarget") %]/lib/
  20. [% END %]
  21. # libcap search paths
  22. export CGO_LDFLAGS="$CGO_LDFLAGS -Wl,-rpath-link=/var/tmp/dist/gcc-cross/[% c("var/crosstarget") %]/lib/"
  23. [% IF c("var/linux-ppc64le") %]
  24. # GCC's cc1 expects Jessie libmpfr; we feed it a symlink to Buster's instead
  25. # as a stupid compat cludge. TODO: Maybe copy in the actual Jessie version
  26. # from the GCC build container?
  27. mkdir -p /var/tmp/dist/libmpfr
  28. ln -s -T /usr/lib/x86_64-linux-gnu/libmpfr.so.6 /var/tmp/dist/libmpfr/libmpfr.so.4
  29. export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/var/tmp/dist/libmpfr"
  30. [% END %]
  31. [% END %]
  32. distdir=/var/tmp/dist/[% project %]
  33. mkdir -p $distdir
  34. [% FOREACH dep = c("var/go_lib_deps") -%]
  35. tar -C /var/tmp/dist -xf [% c('input_files_by_name/' _ dep) %]
  36. [% END -%]
  37. mkdir -p $GOPATH/src/github.com/namecoin
  38. tar -C $GOPATH/src/github.com/namecoin -xf [% project %]-[% c('version') %].tar.gz
  39. mv $GOPATH/src/github.com/namecoin/ncdns-[% c('version') %] $GOPATH/src/github.com/namecoin/ncdns
  40. TAGS="-tags no_namecoin_tls"
  41. [% FOREACH inst IN c("var/go_lib_install") %]
  42. go install $TAGS -ldflags '-s' [% inst %]
  43. [% END %]
  44. cd /var/tmp/dist
  45. [% c('tar', {
  46. tar_src => [ 'gopath' ],
  47. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  48. }) %]