build 1.5 KB

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