build 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. [% 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/ed25519') %]
  15. tar -C /var/tmp/dist -xf [% c('input_files_by_name/siphash') %]
  16. tar -C /var/tmp/dist -xf [% c('input_files_by_name/goxcrypto') %]
  17. tar -C /var/tmp/dist -xf [% c('input_files_by_name/goxnet') %]
  18. tar -C /var/tmp/dist -xf [% c('input_files_by_name/goutls') %]
  19. tar -C /var/tmp/dist -xf [% c('input_files_by_name/goxtext') %]
  20. mkdir -p /var/tmp/build
  21. tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
  22. cd /var/tmp/build/[% project %]-[% c('version') %]
  23. mkdir -p "$GOPATH/src/gitlab.com/yawning"
  24. ln -sf "$PWD" "$GOPATH/src/gitlab.com/yawning/obfs4.git"
  25. cd obfs4proxy
  26. go build -ldflags '-s'
  27. cp -a obfs4proxy[% IF c("var/windows") %].exe[% END %] $PTDIR
  28. cd $distdir
  29. [% c('tar', {
  30. tar_src => [ '.' ],
  31. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  32. }) %]