build 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/bash
  2. [% c("var/set_default_env") -%]
  3. [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
  4. distdir=/var/tmp/dist
  5. builddir=/var/tmp/build/[% project %]
  6. mkdir -p $distdir
  7. tar -C /var/tmp/dist -xf [% c('input_files_by_name/cmake') %]
  8. tar -C /var/tmp/dist -xf [% c('input_files_by_name/clang') %]
  9. tar -C /var/tmp/dist -xf [% c('input_files_by_name/binutils') %]
  10. tar -C /var/tmp/dist -xf [% c('input_files_by_name/rust') %]
  11. tar -C /var/tmp/dist -xf [% c('input_files_by_name/wasi-sysroot') %]
  12. export PATH="/var/tmp/dist/cmake/bin:/var/tmp/dist/clang/bin:/var/tmp/dist/binutils/bin:/var/tmp/dist/rust/bin:$PATH"
  13. export CC=$distdir/clang/bin/clang
  14. export CFLAGS="-L$distdir/clang/lib"
  15. export CXXFLAGS=$CFLAGS
  16. export CXX=$distdir/clang/bin/clang++
  17. export AR=$distdir/clang/bin/llvm-ar
  18. export RUSTFLAGS="-C linker=$CXX -C link-arg=$CXXFLAGS"
  19. export LUCET_PREFIX=$distdir/[% project %]
  20. export WASI_SYSROOT=$distdir/wasi-sysroot
  21. mkdir -p /var/tmp/build
  22. tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
  23. # Now prepare the offline build
  24. # Move the directory for hardcoding the path in .cargo/config
  25. mv /var/tmp/build/[% project %]-[% c('version') %] $builddir
  26. tar -C $builddir -xjf lucetc-vendor.tar.bz2
  27. cd $builddir
  28. # .cargo exists already, let's just add to it
  29. cat >> .cargo/config << 'EOF'
  30. [source.crates-io]
  31. replace-with = "vendored-sources"
  32. [source.vendored-sources]
  33. directory = "/var/tmp/build/lucetc/vendor"
  34. EOF
  35. make -j[% c("buildconf/num_procs") %] build
  36. make install
  37. cd $distdir
  38. [% c('tar', {
  39. tar_src => [ project ],
  40. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  41. }) %]