build 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. tar -C /var/tmp/dist -xf [% c('input_files_by_name/uniuri') %]
  8. tar -C /var/tmp/dist -xf [% c('input_files_by_name/goptlib') %]
  9. tar -C /var/tmp/dist -xf [% c('input_files_by_name/pion-webrtc') %]
  10. tar -C /var/tmp/dist -xf [% c('input_files_by_name/kcp-go') %]
  11. tar -C /var/tmp/dist -xf [% c('input_files_by_name/smux') %]
  12. mkdir -p /var/tmp/build
  13. tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
  14. cd /var/tmp/build/[% project %]-[% c('version') %]
  15. mkdir -p "$GOPATH/src/git.torproject.org/pluggable-transports"
  16. ln -sf "$PWD" "$GOPATH/src/git.torproject.org/pluggable-transports/snowflake.git"
  17. # Fix gopath location of versioned dependencies
  18. ln -sf "$GOPATH/src/github.com/pion/webrtc" "$GOPATH/src/github.com/pion/webrtc/v2"
  19. ln -sf "$GOPATH/src/github.com/pion/sdp" "$GOPATH/src/github.com/pion/sdp/v2"
  20. ln -sf "$GOPATH/src/github.com/xtaci/kcp-go" "$GOPATH/src/github.com/xtaci/kcp-go/v5"
  21. cd client
  22. go build -ldflags '-s'
  23. cp -a client[% IF c("var/windows") %].exe[% END %] $PTDIR/snowflake-client[% IF c("var/windows") %].exe[% END %]
  24. cd ..
  25. cp -a README.md $DOCSDIR
  26. cd $distdir
  27. [% c('tar', {
  28. tar_src => [ '.' ],
  29. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  30. }) %]