commit fb1acab1ece23aeffe7db872fb6c6fdb4ea95aaa Author: Georg Koppen gk@torproject.org Date: Fri Nov 27 12:25:02 2020 +0000
Bug 40156: Add uniffi-rs for application-services --- projects/uniffi-rs/build | 34 ++++++++++++++++++++++++++++++++++ projects/uniffi-rs/config | 17 +++++++++++++++++ 2 files changed, 51 insertions(+)
diff --git a/projects/uniffi-rs/build b/projects/uniffi-rs/build new file mode 100644 index 0000000..60ba1b1 --- /dev/null +++ b/projects/uniffi-rs/build @@ -0,0 +1,34 @@ +#!/bin/bash +[% c("var/set_default_env") -%] +distdir=/var/tmp/dist +builddir=/var/tmp/build/[% project %] +mkdir -p $distdir/[% project %] +tar -C $distdir -xf $rootdir/[% c('input_files_by_name/rust') %] +export PATH="/var/tmp/dist/rust/bin:$PATH" +mkdir -p /var/tmp/build +tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz + +# Now prepare the offline build +# Move the directory for hardcoding the path in .cargo/config +mv /var/tmp/build/[% project %]-[% c('version') %] $builddir +tar -C $builddir -xjf uniffi-rs-vendor-[% c('version') %].tar.bz2 +cd $builddir +mkdir .cargo +cat > .cargo/config << 'EOF' +[source.crates-io] +replace-with = "vendored-sources" + +[source.vendored-sources] +directory = "/var/tmp/build/uniffi-rs/vendor" +EOF + +# We usually use --frozen but there is no Cargo.lock file available. Thus resort +# to --offline. +cargo build --release --offline --target x86_64-unknown-linux-gnu +mv target/x86_64-unknown-linux-gnu/release/uniffi-bindgen $distdir/[% project %] + +cd $distdir +[% c('tar', { + tar_src => [ project ], + tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'), + }) %] diff --git a/projects/uniffi-rs/config b/projects/uniffi-rs/config new file mode 100644 index 0000000..5dda990 --- /dev/null +++ b/projects/uniffi-rs/config @@ -0,0 +1,17 @@ +# vim: filetype=yaml sw=2 +version: 0.5.0 +git_url: https://github.com/mozilla/uniffi-rs +git_hash: bc4a8570ab8430a4f80c3722ef79ff9a4819969e +filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz' + +var: + container: + use_container: 1 + +input_files: + - project: container-image + - name: rust + project: rust + # `cargo vendor vendor` in the `uniffi-rs` directory has vendored the sources. + - URL: https://people.torproject.org/~gk/mirrors/sources/uniffi-rs-vendor-%5B% c('version') %].tar.bz2 + sha256sum: 71d912237208c35a762b3c812afe0a758823792dd745c1253314bcccc1694b7f