build 1.7 KB

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