build 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/bash
  2. [% c("var/set_default_env") -%]
  3. # XXX: Do we need the GCC part here if we set CC to clang anyway?
  4. [% IF c("var/linux") %]
  5. # We need a link to our GCC, otherwise the system cc gets used which points to
  6. # /usr/bin/gcc.
  7. [% pc('gcc', 'var/setup', { compiler_tarfile => c('input_files_by_name/gcc'),
  8. hardened_gcc => 0 }) %]
  9. ln -s gcc /var/tmp/dist/gcc/bin/cc
  10. tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/binutils') %]
  11. export PATH="/var/tmp/dist/binutils/bin:$PATH"
  12. [% END -%]
  13. distdir=/var/tmp/dist
  14. builddir=/var/tmp/build/[% project %]
  15. mkdir -p $distdir
  16. tar -C /var/tmp/dist -xf [% c('input_files_by_name/cmake') %]
  17. tar -C /var/tmp/dist -xf [% c('input_files_by_name/clang') %]
  18. tar -C /var/tmp/dist -xf [% c('input_files_by_name/rust') %]
  19. tar -C /var/tmp/dist -xf [% c('input_files_by_name/wasi-sysroot') %]
  20. export PATH="/var/tmp/dist/cmake/bin:/var/tmp/dist/clang/bin:/var/tmp/dist/rust/bin:$PATH"
  21. export CC=$distdir/clang/bin/clang
  22. export CFLAGS="-L$distdir/clang/lib"
  23. export CXX=$distdir/clang/bin/clang++
  24. export CXXFLAGS=$CFLAGS
  25. export AR=$distdir/clang/bin/llvm-ar
  26. export RUSTFLAGS="-C linker=$CXX -C link-arg=$CXXFLAGS"
  27. export LUCET_PREFIX=$distdir/[% project %]
  28. # XXX: Why do we need that when Mozilla doesn't? See: taskcluster/scripts/misc/build-lucetc.sh
  29. export WASI_SYSROOT=$distdir/wasi-sysroot
  30. mkdir -p /var/tmp/build
  31. tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
  32. # Now prepare the offline build
  33. # Move the directory for hardcoding the path in .cargo/config
  34. mv /var/tmp/build/[% project %]-[% c('version') %] $builddir
  35. tar -C $builddir -xf [% c('input_files_by_name/lucetc-vendor') %]
  36. cd $builddir
  37. # .cargo exists already, let's just add to it
  38. cat >> .cargo/config << 'EOF'
  39. [source.crates-io]
  40. replace-with = "vendored-sources"
  41. [source.vendored-sources]
  42. directory = "/var/tmp/build/lucetc/vendor"
  43. EOF
  44. patch -p1 < $rootdir/Remove-march-native-from-COMMON_CFLAGS.patch
  45. make -j[% c("buildconf/num_procs") %] build
  46. # XXX: Should not be needed, just the lucetc binary, see: taskcluster/scripts/misc/build-lucetc.sh
  47. make install
  48. cd $distdir
  49. [% c('tar', {
  50. tar_src => [ project ],
  51. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  52. }) %]