actions.py 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Licensed under the GNU General Public License, version 3.
  5. # See the file http://www.gnu.org/licenses/gpl.txt
  6. from pisi.actionsapi import autotools
  7. from pisi.actionsapi import pisitools
  8. from pisi.actionsapi import shelltools
  9. from pisi.actionsapi import get
  10. # linker = "gold"
  11. linker = "ld"
  12. multilib = "--enable-multilib" if get.ARCH() == "x86_64" else ""
  13. # WorkDir = "binutils-2.20.51"
  14. def setup():
  15. # Build binutils with LD_SYMBOLIC_FUNCTIONS=1 and reduce PLT relocations in libfd.so by 84%.
  16. #shelltools.export("LD_SYMBOLIC_FUNCTIONS", "1")
  17. shelltools.system('sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure')
  18. shelltools.system("sed -i '/^development=/s/true/false/' bfd/development.sh")
  19. autotools.configure('--enable-shared \
  20. --build=%s \
  21. --enable-threads \
  22. --enable-ld=default \
  23. --enable-gold \
  24. --enable-plugins \
  25. --enable-targets=x86_64-pep \
  26. --with-pkgversion="Pisi Linux" \
  27. --with-bugurl=https://bugs.pisilinux.org/ \
  28. --without-stage1-ldflags \
  29. %s \
  30. --with-pic \
  31. --disable-nls \
  32. --disable-werror' % (get.HOST(), multilib))
  33. #--enable-targets="i386-linux" \
  34. def build():
  35. autotools.make("configure-host")
  36. autotools.make()
  37. # check fails because of LD_LIBRARY_PATH
  38. #def check():
  39. #autotools.make("-k LDFLAGS="" check || true")
  40. # autotools.make("check -j1")
  41. def install():
  42. autotools.rawInstall("DESTDIR=%s tooldir=/usr" % get.installDIR())
  43. # Rebuild libbfd.a and libiberty.a with -fPIC
  44. #pisitools.remove("/usr/lib/libbfd.a")
  45. #pisitools.remove("/usr/lib/libiberty.a")
  46. # pisitools.remove("/usr/include/libiberty.h")
  47. autotools.make("-C libiberty clean")
  48. autotools.make('CFLAGS="-fPIC %s" -C libiberty' % get.CFLAGS())
  49. autotools.make("-C bfd clean")
  50. autotools.make('CFLAGS="-fPIC %s" -C bfd' % get.CFLAGS())
  51. # pisitools.insinto("/usr/lib", "bfd/libbfd.a")
  52. pisitools.insinto("/usr/lib", "libiberty/libiberty.a")
  53. pisitools.insinto("/usr/include", "include/libiberty.h")
  54. pisitools.insinto("/usr/include", "include/demangle.h")
  55. # Copy plugin-api.h file to build LLVM with LLVM gold plugin
  56. pisitools.insinto("/usr/include", "include/plugin-api.h")
  57. # Prevent programs to link against libbfd and libopcodes dynamically,
  58. # they are changing far too often
  59. pisitools.remove("/usr/lib/libopcodes.so")
  60. pisitools.remove("/usr/lib/libbfd.so")
  61. # Remove libtool files, which reference the .so libs
  62. pisitools.remove("/usr/lib/libopcodes.la")
  63. pisitools.remove("/usr/lib/libbfd.la")
  64. # Remove unneded man , info
  65. unneeded_man={"dlltool.1"}
  66. for i in unneeded_man:
  67. pisitools.remove("/usr/share/man/man1/%s" %i)
  68. #pisitools.remove("/usr/share/info/configure.info")
  69. #pisitools.remove("/usr/share/info/standards.info")