build 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/bash
  2. [% c("var/set_default_env") -%]
  3. distdir=/var/tmp/dist/[% project %]
  4. mkdir -p $distdir
  5. tar -C /var/tmp/dist -xf [% c('input_files_by_name/cmake') %]
  6. export PATH="/var/tmp/dist/cmake/bin:$PATH"
  7. tar -C /var/tmp/dist -xf [% c('input_files_by_name/ninja') %]
  8. export PATH=/var/tmp/dist/ninja:$PATH
  9. tar -C /var/tmp/dist -xf [% c('input_files_by_name/previous_rust') %]
  10. cd /var/tmp/dist/rust-[% c('var/previous_version') %]-x86_64-unknown-linux-gnu
  11. ./install.sh --prefix=$distdir-rust-old
  12. export PATH="$distdir-rust-old/bin:$PATH"
  13. [% IF c("var/linux-cross") -%]
  14. [% pc('gcc', 'var/setup', {
  15. compiler_tarfile => c('input_files_by_name/' _ 'gcc-host'),
  16. target => [ c('var/channel'), 'torbrowser-linux-x86_64' ]
  17. }) %]
  18. [% END -%]
  19. [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
  20. [% IF c("var/linux") -%]
  21. [% pc('python', 'var/setup', { python_tarfile => c('input_files_by_name/python') }) %]
  22. [% END -%]
  23. [% IF c("var/osx") %]
  24. # We need to clear `CC` and `LDFLAGS` as they are used for the host platform
  25. # (i.e. Linux).
  26. unset CC
  27. unset LDFLAGS
  28. mkdir $distdir/helper
  29. # We need to adapt our CFLAGS and make sure our flags are passed down to all
  30. # dependencies. Using `CFLAGS_x86_apple-darwin` did not do the trick, so resort
  31. # to a wrapper script.
  32. cat > $distdir/helper/x86_64-apple-darwin-clang << 'EOF'
  33. #!/bin/sh
  34. BASEDIR=/var/tmp/dist/macosx-toolchain
  35. $BASEDIR/cctools/bin/x86_64-apple-darwin-clang -target x86_64-apple-darwin -B $BASEDIR/cctools/bin -isysroot $sysrootdir -Wl,-syslibroot,$sysrootdir -Wl,-dead_strip -Wl,-pie "$@"
  36. EOF
  37. chmod +x $distdir/helper/x86_64-apple-darwin-clang
  38. export PATH=$distdir/helper:$PATH
  39. [% END %]
  40. cd $rootdir
  41. mkdir /var/tmp/build
  42. tar -C /var/tmp/build -xf [% c('input_files_by_name/rust') %]
  43. cd /var/tmp/build/rustc-[% c('version') %]-src
  44. [% IF ! c("var/android") -%]
  45. # Patches for fixing:
  46. # https://github.com/rust-lang/rust/issues/86436
  47. # https://github.com/rust-lang/rust/pull/86568
  48. # https://github.com/rust-lang/rust/issues/86999
  49. # This can be removed when updating to >= 1.54.0.
  50. patch -p1 < $rootdir/fix-build-1.53.0.patch
  51. [% END -%]
  52. mkdir build
  53. cd build
  54. ../configure --prefix=$distdir --disable-docs --disable-compiler-docs [% c("var/configure_opt") %]
  55. make -j[% c("buildconf/num_procs") %]
  56. make install
  57. cd /var/tmp/dist
  58. [% IF c("var/linux-cross") %]
  59. # rustup expects Wheezy openssl, so we make sure it's available to downstream
  60. # containers.
  61. mkdir "$distdir/lib_host"
  62. cp -a /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 "$distdir/lib_host/"
  63. cp -a /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 "$distdir/lib_host/"
  64. [% END %]
  65. [% c('tar', {
  66. tar_src => [ project ],
  67. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  68. }) %]