build 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. [% IF c("var/linux") -%]
  9. export LD_LIBRARY_PATH="/var/tmp/dist/rust/lib:$LD_LIBRARY_PATH"
  10. [% END -%]
  11. mkdir -p /var/tmp/build
  12. tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
  13. [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
  14. # Now prepare the offline build
  15. # Move the directory for hardcoding the path in .cargo/config
  16. mv /var/tmp/build/[% project %]-[% c('version') %] $builddir
  17. tar -C $builddir -xf $rootdir/[% c('input_files_by_name/cbindgen_vendor') %]
  18. cd $builddir
  19. mkdir .cargo
  20. cat > .cargo/config << 'EOF'
  21. [source.crates-io]
  22. replace-with = "vendored-sources"
  23. [source.vendored-sources]
  24. directory = "/var/tmp/build/cbindgen/vendor"
  25. EOF
  26. cargo build --release --frozen --target [% c("var/gnu-build-triplet") %]
  27. mv target/[% c("var/gnu-build-triplet") %]/release/cbindgen $distdir/[% project %]
  28. cd $distdir
  29. [% c('tar', {
  30. tar_src => [ project ],
  31. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  32. }) %]