build 1.8 KB

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