build 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. [% c("var/set_default_env") -%]
  3. [% IF c("var/linux") %]
  4. # We need a link to our GCC, otherwise the system cc gets used which points to
  5. # /usr/bin/gcc.
  6. [% pc('gcc', 'var/setup', { compiler_tarfile => c('input_files_by_name/gcc'),
  7. hardened_gcc => 0 }) %]
  8. ln -s gcc /var/tmp/dist/gcc/bin/cc
  9. tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/binutils') %]
  10. export PATH="/var/tmp/dist/binutils/bin:$PATH"
  11. [% END -%]
  12. distdir=/var/tmp/dist
  13. builddir=/var/tmp/build/[% project %]
  14. mkdir -p $distdir
  15. tar -C /var/tmp/dist -xf [% c('input_files_by_name/cmake') %]
  16. tar -C /var/tmp/dist -xf [% c('input_files_by_name/ninja') %]
  17. export PATH=/var/tmp/dist/binutils/bin:/var/tmp/dist/cmake/bin:/var/tmp/dist/ninja:$PATH
  18. mkdir -p /var/tmp/build
  19. tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
  20. mv /var/tmp/build/[% project %]-[% c('version') %] $builddir
  21. cd $builddir
  22. # We have no .git in our tar ball but the script version.sh used by
  23. # the Makefile depends on that. We replace the script.
  24. cat > 'version.sh' << EOF
  25. #!/bin/sh
  26. echo '[% c("abbrev") %]'
  27. EOF
  28. # XXX: We don't want to use the clang 9.0 wasi-sdk would use, see:
  29. # https://bugzilla.mozilla.org/show_bug.cgi?id=1605708
  30. make -j[% c("buildconf/num_procs") %] PREFIX=$distdir/[% project %] DESTDIR=/
  31. cd $distdir
  32. [% c('tar', {
  33. tar_src => [ project ],
  34. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  35. }) %]