build 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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. # Now prepare the offline build
  14. # Move the directory for hardcoding the path in .cargo/config
  15. mv /var/tmp/build/[% project %]-[% c('version') %] $builddir
  16. tar -C $builddir -xf $rootdir/[% c('input_files_by_name/cbindgen_vendor') %]
  17. cd $builddir
  18. mkdir .cargo
  19. cat > .cargo/config << 'EOF'
  20. [source.crates-io]
  21. replace-with = "vendored-sources"
  22. [source.vendored-sources]
  23. directory = "/var/tmp/build/cbindgen/vendor"
  24. EOF
  25. cargo build --release --frozen --target x86_64-unknown-linux-gnu
  26. mv target/x86_64-unknown-linux-gnu/release/cbindgen $distdir/[% project %]
  27. cd $distdir
  28. [% c('tar', {
  29. tar_src => [ project ],
  30. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  31. }) %]