[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser-build][main] 3 commits: Bug 40852: Compile lox library to wasm



Title: GitLab

boklm pushed to branch main at The Tor Project / Applications / tor-browser-build

Commits:

  • 3b1b0d89
    by Cecylia Bocovich at 2023-10-17T15:38:41+02:00
    Bug 40852: Compile lox library to wasm
    
  • f1003d94
    by Cecylia Bocovich at 2023-10-17T15:38:43+02:00
    Bug 40852: Add wasm-bindgen project
    
  • 94a3fda8
    by Cecylia Bocovich at 2023-10-17T15:38:45+02:00
    Bug 40852: Generate _javascript_ bindings for lox-wasm
    

5 changed files:

Changes:

  • Makefile
    ... ... @@ -615,6 +615,12 @@ cargo_vendor-application-services: submodule-update
    615 615
     cargo_vendor-cbindgen: submodule-update
    
    616 616
     	$(rbm) build cbindgen --step cargo_vendor --target alpha --target torbrowser-linux-x86_64
    
    617 617
     
    
    618
    +cargo_vendor-wasm-bindgen: submodule-update
    
    619
    +	$(rbm) build wasm-bindgen --step cargo_vendor --target alpha --target torbrowser-linux-x86_64
    
    620
    +
    
    621
    +cargo_vendor-lox: submodule-update
    
    622
    +	$(rbm) build lox-wasm --step cargo_vendor --target alpha --target torbrowser-linux-x86_64
    
    623
    +
    
    618 624
     go_vendor-snowflake-alpha: submodule-update
    
    619 625
     	$(rbm) build snowflake --step go_vendor --target alpha --target torbrowser-linux-x86_64
    
    620 626
     
    

  • projects/lox-wasm/build
    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
    +tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/wasm-bindgen') %]
    
    9
    +export PATH="/var/tmp/dist/wasm-bindgen:$PATH"
    
    10
    +[% IF c("var/linux") -%]
    
    11
    +  export LD_LIBRARY_PATH="/var/tmp/dist/rust/lib:$LD_LIBRARY_PATH"
    
    12
    +[% END -%]
    
    13
    +mkdir -p /var/tmp/build
    
    14
    +tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
    
    15
    +
    
    16
    +# Now prepare the offline build
    
    17
    +# Move the directory for hardcoding the path in .cargo/config
    
    18
    +mv /var/tmp/build/[% project %]-[% c('version') %] $builddir
    
    19
    +tar -C $builddir -xf $rootdir/[% c('input_files_by_name/cargo_vendor') %]
    
    20
    +cd $builddir
    
    21
    +mkdir .cargo
    
    22
    +cat > .cargo/config << 'EOF'
    
    23
    +[source.crates-io]
    
    24
    +replace-with = "vendored-sources"
    
    25
    +
    
    26
    +[source."https://git-crysp.uwaterloo.ca/iang/lox.git"]
    
    27
    +git = "https://git-crysp.uwaterloo.ca/iang/lox.git"
    
    28
    +replace-with = "vendored-sources"
    
    29
    +
    
    30
    +[source.vendored-sources]
    
    31
    +directory = "/var/tmp/build/lox-wasm/vendor"
    
    32
    +EOF
    
    33
    +
    
    34
    +cargo build -p lox-wasm --release --frozen --target wasm32-unknown-unknown
    
    35
    +mv target/wasm32-unknown-unknown/release/lox_wasm.wasm $distdir/[% project %]
    
    36
    +
    
    37
    +cd $distdir
    
    38
    +wasm-bindgen --out-dir [% project %] --target web [% project %]/lox_wasm.wasm
    
    39
    +
    
    40
    +[% c('tar', {
    
    41
    +        tar_src => [ project ],
    
    42
    +        tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
    
    43
    +    }) %]

  • projects/lox-wasm/config
    1
    +# vim: filetype=yaml sw=2
    
    2
    +# Remember to update also the package's hash, with the version!
    
    3
    +version: "0.1.0"
    
    4
    +git_url: https://gitlab.torproject.org/tpo/anti-censorship/lox-rs
    
    5
    +git_hash: 003d9c886be3cef59c4c61db03e54a90990e2e93
    
    6
    +container:
    
    7
    +  use_container: 1
    
    8
    +
    
    9
    +steps:
    
    10
    +  build:
    
    11
    +    filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.[% c("compress_tar") %]'
    
    12
    +    input_files:
    
    13
    +      - project: container-image
    
    14
    +        pkg_type: build
    
    15
    +      - project: rust
    
    16
    +        name: rust
    
    17
    +        pkg_type: build
    
    18
    +      - project: wasm-bindgen
    
    19
    +        name: wasm-bindgen
    
    20
    +        pkg_type: build
    
    21
    +      - name: cargo_vendor
    
    22
    +        project: lox-wasm
    
    23
    +        pkg_type: cargo_vendor
    
    24
    +        norec:
    
    25
    +          sha256sum: c4d31f971d406688a08414d471bca6ae2dcea4ce9507ab44a4e54324768c2b22

  • projects/wasm-bindgen/build
    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.[% c('compress_tar') %]
    
    13
    +
    
    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/cargo_vendor') %]
    
    18
    +cd $builddir
    
    19
    +cat > .cargo/config << 'EOF'
    
    20
    +[source.crates-io]
    
    21
    +replace-with = "vendored-sources"
    
    22
    +
    
    23
    +[source."git+https://github.com/alexcrichton/raytracer?branch=update-deps"]
    
    24
    +git = "https://github.com/alexcrichton/raytracer"
    
    25
    +branch = "update-deps"
    
    26
    +replace-with = "vendored-sources"
    
    27
    +
    
    28
    +[source."git+https://github.com/rustwasm/weedle.git"]
    
    29
    +git = "https://github.com/rustwasm/weedle.git"
    
    30
    +replace-with = "vendored-sources"
    
    31
    +
    
    32
    +[source.vendored-sources]
    
    33
    +directory = "/var/tmp/build/wasm-bindgen/vendor"
    
    34
    +EOF
    
    35
    +
    
    36
    +cargo build -p wasm-bindgen-cli --release --frozen --target x86_64-unknown-linux-gnu
    
    37
    +cd $builddir
    
    38
    +mv target/x86_64-unknown-linux-gnu/release/wasm-bindgen $distdir/[% project %]
    
    39
    +
    
    40
    +cd $distdir
    
    41
    +[% c('tar', {
    
    42
    +        tar_src => [ project ],
    
    43
    +        tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
    
    44
    +    }) %]

  • projects/wasm-bindgen/config
    1
    +# vim: filetype=yaml sw=2
    
    2
    +version: 0.2.86
    
    3
    +git_url: https://github.com/cohosh/wasm-bindgen
    
    4
    +git_hash: ecc5ca153cda278bfcebc99c157fb4732eb75e6e
    
    5
    +container:
    
    6
    +  use_container: 1
    
    7
    +
    
    8
    +steps:
    
    9
    +  build:
    
    10
    +    filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.[% c("compress_tar") %]'
    
    11
    +    input_files:
    
    12
    +      - project: container-image
    
    13
    +      - project: rust
    
    14
    +        name: rust
    
    15
    +      - name: cargo_vendor
    
    16
    +        project: wasm-bindgen
    
    17
    +        pkg_type: cargo_vendor
    
    18
    +        norec:
    
    19
    +          sha256sum: 926e938cc4eebf2f5c99f34170fddc5aa7b12445fb379d768eb51aaae3b305a3

  • _______________________________________________
    tor-commits mailing list
    tor-commits@xxxxxxxxxxxxxxxxxxxx
    https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits