build 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. [% c("var/set_default_env") -%]
  3. distdir=/var/tmp/dist/[% project %]
  4. mkdir -p /var/tmp/dist
  5. tar -C /var/tmp/dist -xf [% c('input_files_by_name/cmake') %]
  6. export PATH="/var/tmp/dist/cmake/bin:$PATH"
  7. [% IF c("var/linux") %]
  8. # We need a link to our GCC, otherwise the system cc gets used which points
  9. # to /usr/bin/gcc.
  10. [% pc('gcc', 'var/setup', { compiler_tarfile => c('input_files_by_name/gcc'),
  11. hardened_gcc => 0 }) %]
  12. ln -s gcc /var/tmp/dist/gcc/bin/cc
  13. [% pc('python', 'var/setup', { python_tarfile => c('input_files_by_name/python') }) %]
  14. [% END -%]
  15. [% IF c("var/linux") || c("var/android") -%]
  16. tar -C /var/tmp/dist -xf [% c('input_files_by_name/binutils') %]
  17. export PATH="/var/tmp/dist/binutils/bin:$PATH"
  18. [% END -%]
  19. mkdir -p /var/tmp/build
  20. cd /var/tmp/build
  21. tar -xf $rootdir/[% c('input_files_by_name/clang-source') %]
  22. cd clang-source
  23. export LLVM_HOME=$(pwd)
  24. mkdir build
  25. cd build
  26. cmake ../llvm -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$distdir \
  27. -DCMAKE_BUILD_TYPE=Release \
  28. [% IF c("var/android") -%]
  29. -DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" \
  30. [% END -%]
  31. [% IF c("var/rlbox") -%]-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly[% END %] \
  32. -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;compiler-rt;libcxx;libcxxabi;lld"
  33. make -j[% c("buildconf/num_procs") %]
  34. make install
  35. cd /var/tmp/dist
  36. [% c('tar', {
  37. tar_src => [ project ],
  38. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  39. }) %]