build 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
  5. tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/binutils') %]
  6. export PATH="/var/tmp/dist/binutils/bin:$PATH"
  7. export CGO_ENABLED=1
  8. [% IF c("var/linux-cross") %]
  9. # libcap includes
  10. mkdir -p /var/tmp/dist/gcc-cross/[% c("var/crosstarget") %]/include/sys/
  11. cp /usr/include/sys/capability.h /var/tmp/dist/gcc-cross/[% c("var/crosstarget") %]/include/sys/
  12. # libcap libraries
  13. cp /lib/[% c("var/crosstarget") %]/libcap.* /var/tmp/dist/gcc-cross/[% c("var/crosstarget") %]/lib/
  14. cp /lib/[% c("var/crosstarget") %]/libattr.* /var/tmp/dist/gcc-cross/[% c("var/crosstarget") %]/lib/
  15. # libcap search paths
  16. export CGO_LDFLAGS="$CGO_LDFLAGS -Wl,-rpath-link=/var/tmp/dist/gcc-cross/[% c("var/crosstarget") %]/lib/"
  17. [% END %]
  18. distdir=/var/tmp/dist/[% project %]
  19. mkdir -p $distdir
  20. [% FOREACH dep = c("var/go_lib_deps") -%]
  21. tar -C /var/tmp/dist -xf [% c('input_files_by_name/' _ dep) %]
  22. [% END -%]
  23. mkdir -p $GOPATH/src/github.com/namecoin
  24. tar -C $GOPATH/src/github.com/namecoin -xf [% project %]-[% c('version') %].tar.gz
  25. mv $GOPATH/src/github.com/namecoin/ncdns-[% c('version') %] $GOPATH/src/github.com/namecoin/ncdns
  26. TAGS="-tags no_namecoin_tls"
  27. [% FOREACH inst IN c("var/go_lib_install") %]
  28. go install $TAGS -ldflags '-s' [% inst %]
  29. [% END %]
  30. cd /var/tmp/dist
  31. [% c('tar', {
  32. tar_src => [ 'gopath' ],
  33. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  34. }) %]