build 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 to
  9. # /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. [% END -%]
  14. mkdir -p /var/tmp/build
  15. cd /var/tmp/build
  16. tar -xf $rootdir/[% c('input_files_by_name/llvm') %]
  17. tar -xf $rootdir/[% c('input_files_by_name/cfe') %]
  18. tar -xf $rootdir/[% c('input_files_by_name/libcxx') %]
  19. tar -xf $rootdir/[% c('input_files_by_name/libcxxabi') %]
  20. tar -xf $rootdir/[% c('input_files_by_name/lld') %]
  21. tar -xf $rootdir/[% c('input_files_by_name/compiler-rt') %]
  22. mv llvm-* llvm
  23. mv cfe-* llvm/tools/clang
  24. mv libcxx-* llvm/projects/libcxx
  25. mv libcxxabi-* llvm/projects/libcxxabi
  26. mv lld-* llvm/tools/lld
  27. mv compiler-rt-* llvm/projects/compiler-rt
  28. [% IF c("var/windows") -%]
  29. # Patch order is important here
  30. for i in {1..12}
  31. do git apply $rootdir/win-patches/llvm-objcopy-$i.patch
  32. done
  33. [% END %]
  34. cd llvm
  35. export LLVM_HOME=$(pwd)
  36. mkdir build
  37. cd build
  38. cmake .. -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$distdir -DCMAKE_BUILD_TYPE:STRING=Release $LLVM_HOME
  39. make -j[% c("buildconf/num_procs") %]
  40. make install
  41. cd /var/tmp/dist
  42. [% c('tar', {
  43. tar_src => [ project ],
  44. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  45. }) %]