build 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. [% c("var/set_default_env") -%]
  3. mkdir /var/tmp/dist
  4. distdir=/var/tmp/dist/binutils
  5. [% IF c("var/linux") %]
  6. # Config options for hardening-wrapper
  7. export DEB_BUILD_HARDENING=1
  8. export DEB_BUILD_HARDENING_STACKPROTECTOR=1
  9. export DEB_BUILD_HARDENING_FORTIFY=1
  10. export DEB_BUILD_HARDENING_FORMAT=1
  11. export DEB_BUILD_HARDENING_PIE=1
  12. tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/bison') %]
  13. export PATH=/var/tmp/dist/bison/bin:$PATH
  14. [% END %]
  15. tar xf [% project %]-[% c("version") %].tar.xz
  16. cd [% project %]-[% c("version") %]
  17. ./configure --prefix=$distdir [% c('var/configure_opt') %]
  18. # Jessie's makeinfo is too old, and it makes the build fail even if installed.
  19. # So we replace the makeinfo calls with `true`.
  20. # Trick from https://stackoverflow.com/a/56159871
  21. make -j[% c("num_procs") %] MAKEINFO=true
  22. make install MAKEINFO=true
  23. [% IF c("var/linux") && ! c("var/linux-arm64") && ! c("var/linux-armhf") %]
  24. # Make sure gold is used with the hardening wrapper for full RELRO, see #13031.
  25. cd $distdir/bin
  26. rm ld
  27. cp /usr/bin/hardened-ld ./
  28. mv ld.gold ld.gold.real
  29. ln -sf hardened-ld ld.gold
  30. ln -sf ld.gold ld
  31. [% END %]
  32. cd /var/tmp/dist
  33. [% c('tar', {
  34. tar_src => [ project ],
  35. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  36. }) %]