build 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. [% c("var/set_default_env") -%]
  3. [% pc('go', 'var/setup', { go_tarfile => c('input_files_by_name/go') }) %]
  4. [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
  5. [% IF c("var/linux") %]
  6. tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/binutils') %]
  7. export PATH="/var/tmp/dist/binutils/bin:$PATH"
  8. # The go-webrtc package sets _GLIBCXX_USE_CXX11_ABI=0 for compatibility with
  9. # the prebuilt libwebrtc-magic.a libraries. Since we build our own
  10. # libwebrtc-magic.a with the C++11 ABI, we have to undo that setting here,
  11. # using CGO_CXXFLAGS.
  12. export CGO_CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=1"
  13. [% END -%]
  14. distdir=/var/tmp/dist/[% project %]
  15. [% c("var/set_PTDIR_DOCSDIR") -%]
  16. mkdir -p $PTDIR $DOCSDIR
  17. [% IF c("var/osx") %]
  18. export CGO_ENABLED=1
  19. export CGO_CFLAGS="[% c("var/FLAGS") %] -mmacosx-version-min=10.7"
  20. export CGO_CXXFLAGS="[% c("var/FLAGS") %] -stdlib=libc++ -mmacosx-version-min=10.7"
  21. export CGO_LDFLAGS="[% c("var/FLAGS") %] -stdlib=libc++ -mmacosx-version-min=10.7"
  22. export CC="$clangdir/bin/clang"
  23. export CXX="$clangdir/bin/clang++"
  24. [% END %]
  25. tar -C /var/tmp/dist -xf [% c('input_files_by_name/go-webrtc') %]
  26. tar -C /var/tmp/dist -xf [% c('input_files_by_name/uniuri') %]
  27. tar -C /var/tmp/dist -xf [% c('input_files_by_name/goptlib') %]
  28. mkdir -p /var/tmp/build
  29. tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
  30. cd /var/tmp/build/[% project %]-[% c('version') %]
  31. cd client
  32. [% IF c("var/osx") -%]
  33. # Without faketime, snowflake-client would contain the timestamp of the
  34. # temporary client.a file created during "go build".
  35. # The -tmpdir flag overrides what would otherwise be a randomly generated
  36. # path, /tmp/go-link-RANDOMNUM/go.o.
  37. mkdir -p /var/tmp/go-link.tmpdir
  38. [% c("var/faketime") %] go build -ldflags '-s -tmpdir /var/tmp/go-link.tmpdir'
  39. [% ELSE -%]
  40. go build -ldflags '-s'
  41. [% END -%]
  42. cp -a client[% IF c("var/windows") %].exe[% END %] $PTDIR/snowflake-client[% IF c("var/windows") %].exe[% END %]
  43. cd ..
  44. cp -a README.md LICENSE $DOCSDIR
  45. cd $distdir
  46. [% c('tar', {
  47. tar_src => [ '.' ],
  48. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  49. }) %]