actions.py 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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 shelltools
  7. from pisi.actionsapi import autotools
  8. from pisi.actionsapi import pisitools
  9. from pisi.actionsapi import qt5
  10. from pisi.actionsapi import get
  11. import os
  12. WorkDir = "qtbase-opensource-src-%s" % get.srcVERSION().replace('_','-').replace('pre1', 'tp')
  13. qtbase = qt5.prefix
  14. absoluteWorkDir = "%s/%s" % (get.workDIR(), WorkDir)
  15. #Temporary bindir to avoid qt4 conflicts
  16. bindirQt5="/usr/lib/qt5/bin"
  17. def setup():
  18. checkdeletepath="%s/qtbase/src/3rdparty" % absoluteWorkDir
  19. for dir in ('libjpeg', 'freetype', 'libpng', 'zlib', "xcb", "sqlite"):
  20. if os.path.exists(checkdeletepath+dir):
  21. shelltools.unlinkDir(checkdeletepath+dir)
  22. filteredCFLAGS = get.CFLAGS().replace("-g3", "-g")
  23. filteredCXXFLAGS = get.CXXFLAGS().replace("-g3", "-g")
  24. vars = {"PISILINUX_CC" : get.CC() + (" -m32" if get.buildTYPE() == "emul32" else ""),
  25. "PISILINUX_CXX": get.CXX() + (" -m32" if get.buildTYPE() == "emul32" else ""),
  26. "PISILINUX_CFLAGS": filteredCFLAGS + (" -m32" if get.buildTYPE() == "emul32" else ""),
  27. "PISILINUX_LDFLAGS": get.LDFLAGS() + (" -m32" if get.buildTYPE() == "emul32" else "")}
  28. for k, v in vars.items():
  29. pisitools.dosed("mkspecs/common/g++-base.conf", k, v)
  30. pisitools.dosed("mkspecs/common/g++-unix.conf", k, v)
  31. shelltools.export("CFLAGS", filteredCFLAGS)
  32. shelltools.export("CXXFLAGS", filteredCXXFLAGS)
  33. #check that dosed commands without releated patches
  34. pisitools.dosed("mkspecs/common/gcc-base-unix.conf", "\-Wl,\-rpath,")
  35. pisitools.dosed("mkspecs/common/gcc-base.conf", "\-O2", filteredCFLAGS)
  36. pisitools.dosed("mkspecs/common/gcc-base.conf", "^(QMAKE_LFLAGS\s+\+=)", r"\1 %s" % get.LDFLAGS())
  37. if not get.buildTYPE() == "emul32":
  38. #-no-pch makes build ccache-friendly
  39. options = "-v -confirm-license -opensource \
  40. -no-rpath \
  41. -no-use-gold-linker\
  42. -prefix %s \
  43. -bindir %s \
  44. -headerdir %s \
  45. -archdatadir %s\
  46. -docdir %s \
  47. -plugindir %s \
  48. -importdir %s \
  49. -qmldir %s \
  50. -datadir %s \
  51. -testsdir %s \
  52. -translationdir %s \
  53. -sysconfdir %s \
  54. -examplesdir %s \
  55. -libdir %s \
  56. -system-harfbuzz \
  57. -system-sqlite \
  58. -openssl-linked \
  59. -nomake tests \
  60. -nomake examples \
  61. -optimized-qmake \
  62. -reduce-relocations \
  63. -dbus-linked" % (qt5.prefix, bindirQt5, qt5.headerdir, qt5.archdatadir, qt5.docdir, qt5.plugindir, qt5.importdir, qt5.qmldir, qt5.datadir, qt5.testdir, qt5.translationdir, qt5.sysconfdir, qt5.examplesdir, qt5.libdir)
  64. else:
  65. pisitools.dosed("mkspecs/linux-g++-64/qmake.conf", "-m64", "-m32")
  66. shelltools.export("LDFLAGS", "-m32 %s" % get.LDFLAGS())
  67. options = "-no-pch -v -confirm-license -opensource -no-use-gold-linker\
  68. -platform linux-g++-32 \
  69. -xplatform linux-g++-32 \
  70. -prefix /usr/lib32 \
  71. -bindir /usr/lib32/qt5/bin \
  72. -docdir /usr/share/doc/qt \
  73. -headerdir /usr/lib32/qt5/include/qt5 \
  74. -datadir /usr/share/qt5 \
  75. -sysconfdir /etc/xdg \
  76. -examplesdir /usr/share/doc/qt/examples \
  77. -system-sqlite \
  78. -openssl-linked \
  79. -nomake examples \
  80. -no-xcb \
  81. -no-rpath \
  82. -optimized-qmake \
  83. -dbus-linked \
  84. -system-harfbuzz \
  85. -libdir /usr/lib32/ \
  86. -archdatadir /usr/lib32/qt5/"
  87. autotools.rawConfigure(options)
  88. def build():
  89. shelltools.export("LD_LIBRARY_PATH", "%s/lib:%s" % (get.curDIR(), get.ENV("LD_LIBRARY_PATH")))
  90. qt5.make()
  91. def install():
  92. if get.buildTYPE() == "emul32":
  93. qt5.install("INSTALL_ROOT=%s32" % get.installDIR())
  94. shelltools.move("%s32/usr/lib32" % get.installDIR(), "%s/usr" % get.installDIR())
  95. return
  96. pisitools.dodir(qt5.libdir)
  97. qt5.install("INSTALL_ROOT=%s" % get.installDIR())
  98. #I hope qtchooser will manage this issue
  99. for bin in shelltools.ls("%s/usr/lib/qt5/bin" % get.installDIR()):
  100. pisitools.dosym("/usr/lib/qt5/bin/%s" % bin, "/usr/bin/%s-qt5" % bin)
  101. mkspecPath = "%s/mkspecs" % qt5.archdatadir
  102. pisitools.dodoc("LGPL_EXCEPTION.txt", "LICENSE.*")