build 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. [% c("var/set_default_env") -%]
  3. distdir=/var/tmp/dist
  4. builddir=/var/tmp/build/[% project %]
  5. mkdir -p $distdir/[% project %]
  6. tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/rust') %]
  7. export PATH="/var/tmp/dist/rust/bin:$PATH"
  8. mkdir -p /var/tmp/build
  9. tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
  10. [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
  11. # Now prepare the offline build
  12. # Move the directory for hardcoding the path in .cargo/config
  13. mv /var/tmp/build/[% project %]-[% c('version') %] $builddir
  14. tar -C $builddir -xjf cbindgen-vendor.tar.bz2
  15. cd $builddir
  16. mkdir .cargo
  17. cat > .cargo/config << 'EOF'
  18. [source.crates-io]
  19. replace-with = "vendored-sources"
  20. [source.vendored-sources]
  21. directory = "/var/tmp/build/cbindgen/vendor"
  22. EOF
  23. cargo build --release --frozen --target [% c("var/gnu-build-triplet") %]
  24. mv target/[% c("var/gnu-build-triplet") %]/release/cbindgen $distdir/[% project %]
  25. cd $distdir
  26. [% c('tar', {
  27. tar_src => [ project ],
  28. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  29. }) %]