build 1.7 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. distdir=/var/tmp/dist/[% project %]
  5. [% c("var/set_PTDIR_DOCSDIR") -%]
  6. mkdir -p $PTDIR
  7. tar -C /var/tmp/dist -xf [% c('input_files_by_name/goptlib') %]
  8. tar -C /var/tmp/dist -xf [% c('input_files_by_name/ed25519') %]
  9. tar -C /var/tmp/dist -xf [% c('input_files_by_name/siphash') %]
  10. tar -C /var/tmp/dist -xf [% c('input_files_by_name/uniuri') %]
  11. tar -C /var/tmp/dist -xf [% c('input_files_by_name/goxcrypto') %]
  12. tar -C /var/tmp/dist -xf [% c('input_files_by_name/goxnet') %]
  13. [% IF c("var/nightly") -%]
  14. tar -C /var/tmp/dist -xf [% c('input_files_by_name/goutls') %]
  15. tar -C /var/tmp/dist -xf [% c('input_files_by_name/goxtext') %]
  16. [% END -%]
  17. mkdir -p /var/tmp/build
  18. tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
  19. cd /var/tmp/build/[% project %]-[% c('version') %]
  20. [% IF c("var/nightly") -%]
  21. # Remove go.mod and go.sum files until we can build using Go module
  22. # versioning (see bug 28325).
  23. rm -f go.mod go.sum
  24. [% END -%]
  25. # Commit 70d0e90c861be34ce3c5425ef1366a0b2ceb3026 changed the canonical obfs4
  26. # upstream repo to gitlab.com/yawning/obfs4.git.
  27. [% IF c("var/nightly") %]
  28. mkdir -p "$GOPATH/src/gitlab.com/yawning"
  29. ln -sf "$PWD" "$GOPATH/src/gitlab.com/yawning/obfs4.git"
  30. [% ELSE %]
  31. mkdir -p "$GOPATH/src/git.torproject.org/pluggable-transports"
  32. ln -sf "$PWD" "$GOPATH/src/git.torproject.org/pluggable-transports/obfs4.git"
  33. [% END %]
  34. cd obfs4proxy
  35. go build -ldflags '-s'
  36. cp -a obfs4proxy[% IF c("var/windows") %].exe[% END %] $PTDIR
  37. cd $distdir
  38. [% c('tar', {
  39. tar_src => [ '.' ],
  40. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  41. }) %]