actions.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/usr/bin/env 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 cmaketools
  7. from pisi.actionsapi import pisitools
  8. from pisi.actionsapi import shelltools
  9. from pisi.actionsapi import get
  10. tools = "-DLLVM_BUILD_TOOLS=OFF" if get.buildTYPE() == "emul32" else "-DLLVM_BUILD_TOOLS=ON"
  11. libdir = "lib32" if get.buildTYPE() == "emul32" else "lib"
  12. def setup():
  13. options = "-DBUILD_SHARED_LIBS=ON \
  14. -DCMAKE_INSTALL_PREFIX=/usr \
  15. -DCMAKE_BUILD_TYPE=Release \
  16. -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
  17. -DCMAKE_SKIP_RPATH=ON \
  18. -DLLVM_SPIRV_BUILD_EXTERNAL=YES \
  19. -DLLVM_INCLUDE_TESTS=ON \
  20. -DLLVM_EXTERNAL_LIT=/usr/bin/lit \
  21. -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/usr/include/spirv/ \
  22. -DCMAKE_INSTALL_LIBDIR=%s \
  23. %s \
  24. -Wno-dev" % (libdir, tools)
  25. if get.buildTYPE() == "emul32":
  26. shelltools.export("CC", "gcc -m32")
  27. shelltools.export("CXX", "g++ -m32")
  28. shelltools.export("PKG_CONFIG_PATH","/usr/lib32/pkgconfig")
  29. options += " -DLLVM_LIBDIR_SUFFIX=32 \
  30. -DCMAKE_INSTALL_BINDIR:PATH=bin32"
  31. cmaketools.configure(options)
  32. def build():
  33. cmaketools.make()
  34. def install():
  35. cmaketools.rawInstall("DESTDIR=%s" % get.installDIR())
  36. if get.buildTYPE() == "emul32":
  37. pisitools.removeDir("/usr/bin32")
  38. return
  39. pisitools.dodoc("LICENSE*", "README*")