build 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 $DOCSDIR
  7. [% IF c("var/android") -%]
  8. [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
  9. # We need to explicitly set CGO_ENABLED with Go 1.13.x as the Android build
  10. # breaks otherwise.
  11. export CGO_ENABLED=1
  12. [% END -%]
  13. tar -C /var/tmp/dist -xf [% c('input_files_by_name/goptlib') %]
  14. tar -C /var/tmp/dist -xf [% c('input_files_by_name/pion-webrtc') %]
  15. tar -C /var/tmp/dist -xf [% c('input_files_by_name/kcp-go') %]
  16. tar -C /var/tmp/dist -xf [% c('input_files_by_name/smux') %]
  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. mkdir -p "$GOPATH/src/git.torproject.org/pluggable-transports"
  21. ln -sf "$PWD" "$GOPATH/src/git.torproject.org/pluggable-transports/snowflake.git"
  22. # Fix gopath location of versioned dependencies
  23. ln -sf "$GOPATH/src/github.com/pion/webrtc" "$GOPATH/src/github.com/pion/webrtc/v2"
  24. ln -sf "$GOPATH/src/github.com/pion/sdp" "$GOPATH/src/github.com/pion/sdp/v2"
  25. ln -sf "$GOPATH/src/github.com/xtaci/kcp-go" "$GOPATH/src/github.com/xtaci/kcp-go/v5"
  26. cd client
  27. go build -ldflags '-s'
  28. cp -a client[% IF c("var/windows") %].exe[% END %] $PTDIR/snowflake-client[% IF c("var/windows") %].exe[% END %]
  29. cd ..
  30. cp -a README.md $DOCSDIR
  31. cd $distdir
  32. [% c('tar', {
  33. tar_src => [ '.' ],
  34. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  35. }) %]