Unverified Commit 1e88b1ae authored by Georg Koppen's avatar Georg Koppen
Browse files

Bug 40125: Fold in fenix-*rust and fenix-cbindgen projects

parent 148487e1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ cd /var/tmp/dist
  tar -xf $rootdir/[% c('input_files_by_name/sqlcipher-' _ arch) %]
  mv sqlcipher sqlcipher-[% arch %]
[% END -%]
export PATH=/var/tmp/dist/fenix-as-rust/bin:$PATH
export PATH=/var/tmp/dist/rust/bin:$PATH
cd $rootdir

# application-services uses a newer NDK, 21, than everything else...
+4 −4
Original line number Diff line number Diff line
@@ -24,19 +24,19 @@ input_files:
  - project: '[% c("var/compiler") %]'
    name: '[% c("var/compiler") %]'
  # We need the torbrowser-* targets for Rust, see: #40094.
  - project: fenix-as-rust
  - project: rust
    name: rust-armv7
    target_prepend:
      - torbrowser-android-armv7
  - project: fenix-as-rust
  - project: rust
    name: rust-aarch64
    target_prepend:
      - torbrowser-android-aarch64
  - project: fenix-as-rust
  - project: rust
    name: rust-x86
    target_prepend:
      - torbrowser-android-x86
  - project: fenix-as-rust
  - project: rust
    name: rust-x86_64
    target_prepend:
      - torbrowser-android-x86_64
+14 −3
Original line number Diff line number Diff line
# vim: filetype=yaml sw=2
version: 0.14.1
version: '[% c("var/cbindgen_version") %]'
git_url: https://github.com/eqrion/cbindgen
git_hash: 0761b9bbe48d01ded1bbec45bbeea5544b3b1002 # v0.14.1
git_hash: '[% c("var/cbindgen_hash") %]'
filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz'

var:
  cbindgen_version: 0.14.1
  cbindgen_hash: 0761b9bbe48d01ded1bbec45bbeea5544b3b1002
  cbindgen_vendor_hash: 1c500bc1b8de4eb400f90a528c4b5c6b2c7357e401a95c5354469a18fd365dbc
  container:
    use_container: 1

targets:
  android:
    var:
      cbindgen_version: 0.14.3
      cbindgen_hash: cc2876f709808a52d132a5f84e53ca1964eb92db
      cbindgen_vendor_hash: cc47db55a1c937e7bcd1cbd8664964656a4922bc35175d95c4015d452f2dcb2b

input_files:
  - project: container-image
  - name: rust
    project: rust
  # `cargo vendor vendor` in the `cbindgen` directory has vendored the sources.
  - URL: https://people.torproject.org/~gk/mirrors/sources/cbindgen-vendor-[% c('version') %].tar.bz2
    sha256sum: 1c500bc1b8de4eb400f90a528c4b5c6b2c7357e401a95c5354469a18fd365dbc
    sha256sum: '[% c("var/cbindgen_vendor_hash") %]'

projects/fenix-as-rust/build

deleted100644 → 0
+0 −65
Original line number Diff line number Diff line
#!/bin/bash
[% c("var/set_default_env") -%]
distdir=/var/tmp/dist/[% project %]
mkdir -p $distdir
tar -C /var/tmp/dist -xf [% c('input_files_by_name/cmake') %]
export PATH="/var/tmp/dist/cmake/bin:$PATH"
tar -C /var/tmp/dist -xf [% c('input_files_by_name/prev_rust') %]
cd /var/tmp/dist/rust-[% c('var/prev_version') %]-x86_64-unknown-linux-gnu
./install.sh --prefix=$distdir-rust-old
export PATH="$distdir-rust-old/bin:$PATH"

[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]

[% IF c("var/osx") %]
  # We need to clear `CC` and `LDFLAGS` as they are used for the host platform
  # (i.e. Linux).
  unset CC
  unset LDFLAGS

  mkdir $distdir/helper
  # We need to adapt our CFLAGS and make sure our flags are passed down to all
  # dependencies. Using `CFLAGS_x86_apple-darwin` did not do the trick, so resort
  # to a wrapper script.
  cat > $distdir/helper/x86_64-apple-darwin-clang << 'EOF'
#!/bin/sh
BASEDIR=/var/tmp/dist/macosx-toolchain
$BASEDIR/cctools/bin/x86_64-apple-darwin-clang -target x86_64-apple-darwin -B $BASEDIR/cctools/bin -isysroot $BASEDIR/MacOSX10.11.sdk/ -Wl,-syslibroot,$BASEDIR/MacOSX10.11.sdk/ -Wl,-dead_strip -Wl,-pie "$@"
EOF

  chmod +x $distdir/helper/x86_64-apple-darwin-clang
  export PATH=$distdir/helper:$PATH
[% END %]

cd $rootdir
mkdir /var/tmp/build
tar -C /var/tmp/build -xf  [% c('input_files_by_name/rust') %]
cd /var/tmp/build/rustc-[% c('version') %]-src

# LLVM has reproducibility issues when optimizing bitcode, which we need to
# patch. See: #32053 for more details.
cd src/llvm-project
patch -p1 < $rootdir/43909.patch
cd ../../

[% IF c("var/windows-i686") %]
  # Cross-compiling for Windows 32bit is currently not possible without any
  # patches. The reason for that is libstd expecting DWARF unwinding while most
  # toolchains on Linux, targeting Windows 32bit, use SjLj unwinding.
  # See: https://github.com/rust-lang/rust/issues/12859 for discussion about
  # that and https://github.com/rust-lang/rust/pull/49633 for a newer attempt to
  # fix this problem. We apply the patch from neersighted.
  patch -p1 < $rootdir/unwind.patch
[% END %]

mkdir build
cd build
../configure --prefix=$distdir [% c("var/configure_opt") %]

make -j[% c("buildconf/num_procs") %]
make install
cd /var/tmp/dist
[% c('tar', {
        tar_src => [ project ],
        tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
        }) %]

projects/fenix-as-rust/config

deleted100644 → 0
+0 −103
Original line number Diff line number Diff line
# vim: filetype=yaml sw=2
filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
version: '[% c("input_file_var/rust_version") %]'

# Those values can be changed from the input_files section of other
# projects. See bug 32436.
input_file_var:
  rust_version: 1.45.2
  prev_version: 1.44.1

var:
  prev_version: '[% c("input_file_var/prev_version") %]'
  container:
    use_container: 1

targets:
  android:
    var:
      arch_deps:
        - libssl-dev
        - pkg-config
        - zlib1g-dev
      configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --target=[% c("var/cross_prefix") %] --set=target.[% c("var/cross_prefix") %].cc=[% c("var/CC") %] --set=target.[% c("var/cross_prefix") %].ar=[% c("var/cross_prefix") %]-ar

  android-armv7:
    var:
      configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --target=[% IF pc(c("origin_project"), "var/application_services") %]armv7-linux-androideabi[% ELSE %]thumbv7neon-linux-androideabi[% END %] --set=target.[% IF pc(c("origin_project"), "var/application_services") %]armv7-linux-androideabi[% ELSE %]thumbv7neon-linux-androideabi[% END %].cc=[% c("var/CC") %] --set=target.[% IF pc(c("origin_project"), "var/application_services") %]armv7-linux-androideabi[% ELSE %]thumbv7neon-linux-androideabi[% END %].ar=[% c("var/cross_prefix") %]-ar

  linux:
    var:
      deps:
        - libc6-dev-i386
        - lib32stdc++6
        - build-essential
        - python
        - automake
        - libssl-dev
        - pkg-config
        - hardening-wrapper
      # We use
      # `--enable-local-rust` to avoid downloading the required compiler during
      # build time
      #
      # `--enable-vendor` to avoid downloading crates during build time and just
      # use the ones which are shipped with the source
      #
      # `--enable-extended` to build not only rustc but cargo as well
      #
      # `--enable-llvm-static-stdccp` to take a libstdc++ on Jessie into account
      # which is too old and if used gives undefined reference errors
      #
      # `--release-channel=stable` to just include stable features in the
      # compiler
      #
      # `--sysconfdir=etc` to avoid install failures as |make install| wants to
      # write to /etc otherwise
      #
      # the `target` triple to explicitly specify the architecture and platform
      # for the compiler/std lib. Ideally, it should not be needed unless one is
      # cross-compiling, but compiling `alloc_jemalloc` fails without that in a
      # 32bit container. "--host=x86_64-unknown-linux-gnu" is used in its
      # configure script in this case.
      # `--set=` to explicitly specify the C compiler. We need to compile the
      # bundled LLVM and it wants to use `cc`. However, we don't have that in
      # our compiled GCC resulting in weird errors due to C and C++ compiler
      # version mismatch. We avoid that with this configure option.
      configure_opt: --enable-local-rust --enable-vendor --enable-extended --enable-llvm-static-stdcpp --release-channel=stable --sysconfdir=etc --target=x86_64-unknown-linux-gnu,i686-unknown-linux-gnu --set=target.x86_64-unknown-linux-gnu.cc=gcc --set=target.i686-unknown-linux-gnu.cc=gcc

  osx-x86_64:
    var:
      arch_deps:
        - libssl-dev
        - pkg-config
        - zlib1g-dev
      configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --target=x86_64-apple-darwin --set=target.x86_64-apple-darwin.cc=x86_64-apple-darwin-clang

  windows:
    var:
      arch_deps:
        - libssl-dev
        - pkg-config
        - zlib1g-dev
      configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --target=[% c("arch") %]-pc-windows-gnu

input_files:
  - project: container-image
  - project: cmake
    name: cmake
  - project: '[% c("var/compiler") %]'
    name: '[% c("var/compiler") %]'
  - URL: 'https://static.rust-lang.org/dist/rustc-[% c("version") %]-src.tar.gz'
    name: rust
    sig_ext: asc
    file_gpg_id: 1
    gpg_keyring: rust.gpg
  - URL: 'https://static.rust-lang.org/dist/rust-[% c("var/prev_version") %]-x86_64-unknown-linux-gnu.tar.xz'
    name: prev_rust
    sig_ext: asc
    file_gpg_id: 1
    gpg_keyring: rust.gpg
  - filename: unwind.patch
    enable: '[% c("var/windows-i686") %]'
  - filename: 43909.patch
Loading