build 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 $distdir -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. # Now prepare the offline build
  11. # Move the directory for hardcoding the path in .cargo/config
  12. mv /var/tmp/build/[% project %]-[% c('version') %] $builddir
  13. tar -C $builddir -xjf uniffi-rs-vendor-[% c('version') %].tar.bz2
  14. cd $builddir
  15. mkdir .cargo
  16. cat > .cargo/config << 'EOF'
  17. [source.crates-io]
  18. replace-with = "vendored-sources"
  19. [source.vendored-sources]
  20. directory = "/var/tmp/build/uniffi-rs/vendor"
  21. EOF
  22. # We change the data type of the `all_known_types` Set from HashSet to BTreeSet.
  23. # Uniffi iterates over the elements of this set, and iteration over a HashSet occurs
  24. # in an arbitrary order, while iteration over a BTreeSet orders in a defined (and
  25. # deterministic) order. This patch solves a build reproducibility issue, see
  26. # tor-browser-build#40208.
  27. #
  28. # Upstream bug: https://github.com/mozilla/uniffi-rs/issues/374
  29. patch -p1 < $rootdir/btreeset.patch
  30. # We usually use --frozen but there is no Cargo.lock file available. Thus resort
  31. # to --offline.
  32. cargo build --release --offline --target x86_64-unknown-linux-gnu
  33. mv target/x86_64-unknown-linux-gnu/release/uniffi-bindgen $distdir/[% project %]
  34. cd $distdir
  35. [% c('tar', {
  36. tar_src => [ project ],
  37. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  38. }) %]