build 945 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. [% c("var/set_default_env") -%]
  3. distdir=/var/tmp/dist/binutils
  4. [% IF c("var/linux") %]
  5. # Config options for hardening-wrapper
  6. export DEB_BUILD_HARDENING=1
  7. export DEB_BUILD_HARDENING_STACKPROTECTOR=1
  8. export DEB_BUILD_HARDENING_FORTIFY=1
  9. export DEB_BUILD_HARDENING_FORMAT=1
  10. export DEB_BUILD_HARDENING_PIE=1
  11. [% END %]
  12. tar xf [% project %]-[% c("version") %].tar.xz
  13. cd [% project %]-[% c("version") %]
  14. ./configure --prefix=$distdir [% c('var/configure_opt') %]
  15. make -j[% c("buildconf/num_procs") %]
  16. make install
  17. [% IF c("var/linux") && ! c("var/linux-arm64") %]
  18. # Make sure gold is used with the hardening wrapper for full RELRO, see #13031.
  19. cd $distdir/bin
  20. rm ld
  21. cp /usr/bin/hardened-ld ./
  22. mv ld.gold ld.gold.real
  23. ln -sf hardened-ld ld.gold
  24. ln -sf ld.gold ld
  25. [% END %]
  26. cd /var/tmp/dist
  27. [% c('tar', {
  28. tar_src => [ project ],
  29. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  30. }) %]