qt5base.mk 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. ################################################################################
  2. #
  3. # qt5base
  4. #
  5. ################################################################################
  6. QT5BASE_VERSION = $(QT5_VERSION)
  7. QT5BASE_SITE = $(QT5_SITE)
  8. QT5BASE_SOURCE = qtbase-opensource-src-$(QT5BASE_VERSION).tar.xz
  9. QT5BASE_DEPENDENCIES = host-pkgconf zlib pcre
  10. QT5BASE_INSTALL_STAGING = YES
  11. # A few comments:
  12. # * -no-pch to workaround the issue described at
  13. # http://comments.gmane.org/gmane.comp.lib.qt.devel/5933.
  14. # * -system-zlib because zlib is mandatory for Qt build, and we
  15. # want to use the Buildroot packaged zlib
  16. # * -system-pcre because pcre is mandatory to build Qt, and we
  17. # want to use the one packaged in Buildroot
  18. QT5BASE_CONFIGURE_OPTS += \
  19. -optimized-qmake \
  20. -no-kms \
  21. -no-cups \
  22. -no-nis \
  23. -no-iconv \
  24. -system-zlib \
  25. -system-pcre \
  26. -no-pch
  27. ifeq ($(BR2_ENABLE_DEBUG),y)
  28. QT5BASE_CONFIGURE_OPTS += -debug
  29. else
  30. QT5BASE_CONFIGURE_OPTS += -release
  31. endif
  32. ifeq ($(BR2_PREFER_STATIC_LIB),y)
  33. QT5BASE_CONFIGURE_OPTS += -static
  34. else
  35. # We apparently can't build both the shared and static variants of the
  36. # library.
  37. QT5BASE_CONFIGURE_OPTS += -shared
  38. endif
  39. ifeq ($(BR2_LARGEFILE),y)
  40. QT5BASE_CONFIGURE_OPTS += -largefile
  41. else
  42. QT5BASE_CONFIGURE_OPTS += -no-largefile
  43. endif
  44. ifeq ($(BR2_PACKAGE_QT5BASE_LICENSE_APPROVED),y)
  45. QT5BASE_CONFIGURE_OPTS += -opensource -confirm-license
  46. QT5BASE_LICENSE = LGPLv2.1 or GPLv3.0
  47. QT5BASE_LICENSE_FILES = LICENSE.GPL LICENSE.LGPL LGPL_EXCEPTION.txt
  48. else
  49. QT5BASE_LICENSE = Commercial license
  50. QT5BASE_REDISTRIBUTE = NO
  51. endif
  52. # Qt5 SQL Plugins
  53. ifeq ($(BR2_PACKAGE_QT5BASE_SQL),y)
  54. ifeq ($(BR2_PACKAGE_QT5BASE_MYSQL),y)
  55. QT5BASE_CONFIGURE_OPTS += -plugin-sql-mysql -mysql_config $(STAGING_DIR)/usr/bin/mysql_config
  56. QT5BASE_DEPENDENCIES += mysql
  57. else
  58. QT5BASE_CONFIGURE_OPTS += -no-sql-mysql
  59. endif
  60. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_SQLITE_QT),-plugin-sql-sqlite)
  61. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_SQLITE_SYSTEM),-system-sqlite)
  62. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_SQLITE_SYSTEM),sqlite)
  63. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_SQLITE_NONE),-no-sql-sqlite)
  64. endif
  65. # We have to use --enable-linuxfb, otherwise Qt thinks that -linuxfb
  66. # is to add a link against the "inuxfb" library.
  67. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_GUI),-gui,-no-gui)
  68. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_WIDGETS),-widgets,-no-widgets)
  69. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_LINUXFB),--enable-linuxfb,-no-linuxfb)
  70. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_DIRECTFB),-directfb,-no-directfb)
  71. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_DIRECTFB),directfb)
  72. ifeq ($(BR2_PACKAGE_QT5BASE_XCB),y)
  73. QT5BASE_CONFIGURE_OPTS += -xcb -system-xkbcommon
  74. QT5BASE_DEPENDENCIES += \
  75. libxcb \
  76. xcb-util-wm \
  77. xcb-util-image \
  78. xcb-util-keysyms \
  79. xlib_libX11 \
  80. libxkbcommon
  81. ifeq ($(BR2_PACKAGE_QT5BASE_WIDGETS),y)
  82. QT5BASE_DEPENDENCIES += xlib_libXext
  83. endif
  84. else
  85. QT5BASE_CONFIGURE_OPTS += -no-xcb
  86. endif
  87. ifeq ($(BR2_PACKAGE_QT5BASE_EGLFS),y)
  88. QT5BASE_CONFIGURE_OPTS += -opengl es2 -eglfs
  89. QT5BASE_DEPENDENCIES += libgles libegl
  90. ifeq ($(BR2_PACKAGE_GPU_VIV_BIN_MX6Q),y)
  91. QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES = \
  92. $(@D)/mkspecs/devices/linux-imx6-g++/qeglfshooks_imx6.cpp
  93. endif
  94. ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
  95. QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES = \
  96. $(@D)/mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp
  97. endif
  98. else
  99. QT5BASE_CONFIGURE_OPTS += -no-opengl -no-eglfs
  100. endif
  101. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_OPENSSL),-openssl,-no-openssl)
  102. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_OPENSSL),openssl)
  103. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_FONTCONFIG),-fontconfig,-no-fontconfig)
  104. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_FONTCONFIG),fontconfig)
  105. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_GIF),,-no-gif)
  106. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_JPEG),-system-libjpeg,-no-libjpeg)
  107. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_JPEG),jpeg)
  108. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_PNG),-system-libpng,-no-libpng)
  109. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_PNG),libpng)
  110. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_DBUS),-dbus,-no-dbus)
  111. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_DBUS),dbus)
  112. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_TSLIB),-tslib,-no-tslib)
  113. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_TSLIB),tslib)
  114. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_LIBGLIB2),-glib,-no-glib)
  115. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBGLIB2),libglib2)
  116. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_ICU),-icu,-no-icu)
  117. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_ICU),icu)
  118. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_EXAMPLES),-make,-nomake) examples
  119. # Build the list of libraries to be installed on the target
  120. QT5BASE_INSTALL_LIBS_y += Qt5Core
  121. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_NETWORK) += Qt5Network
  122. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_CONCURRENT) += Qt5Concurrent
  123. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_SQL) += Qt5Sql
  124. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_TEST) += Qt5Test
  125. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_XML) += Qt5Xml
  126. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_EGLFS) += Qt5OpenGL
  127. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_GUI) += Qt5Gui
  128. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_WIDGETS) += Qt5Widgets
  129. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_PRINTSUPPORT) += Qt5PrintSupport
  130. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_DBUS) += Qt5DBus
  131. define QT5BASE_CONFIGURE_CMDS
  132. (cd $(@D); \
  133. PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
  134. PKG_CONFIG_LIBDIR="$(STAGING_DIR)/usr/lib/pkgconfig" \
  135. PKG_CONFIG_SYSROOT_DIR="$(STAGING_DIR)" \
  136. MAKEFLAGS="$(MAKEFLAGS) -j$(PARALLEL_JOBS)" \
  137. ./configure \
  138. -v \
  139. -prefix /usr \
  140. -hostprefix $(HOST_DIR)/usr \
  141. -headerdir /usr/include/qt5 \
  142. -sysroot $(STAGING_DIR) \
  143. -plugindir /usr/lib/qt/plugins \
  144. -examplesdir /usr/lib/qt/examples \
  145. -no-rpath \
  146. -nomake tests \
  147. -device buildroot \
  148. -device-option CROSS_COMPILE="$(CCACHE) $(TARGET_CROSS)" \
  149. -device-option BR_COMPILER_CFLAGS="$(TARGET_CFLAGS)" \
  150. -device-option BR_COMPILER_CXXFLAGS="$(TARGET_CXXFLAGS)" \
  151. -device-option EGLFS_PLATFORM_HOOKS_SOURCES="$(QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES)" \
  152. -no-c++11 \
  153. $(QT5BASE_CONFIGURE_OPTS) \
  154. )
  155. endef
  156. define QT5BASE_BUILD_CMDS
  157. $(MAKE) -C $(@D)
  158. endef
  159. define QT5BASE_INSTALL_STAGING_CMDS
  160. $(MAKE) -C $(@D) install
  161. $(QT5_LA_PRL_FILES_FIXUP)
  162. endef
  163. define QT5BASE_INSTALL_TARGET_LIBS
  164. for lib in $(QT5BASE_INSTALL_LIBS_y); do \
  165. cp -dpf $(STAGING_DIR)/usr/lib/lib$${lib}.so.* $(TARGET_DIR)/usr/lib ; \
  166. done
  167. endef
  168. define QT5BASE_INSTALL_TARGET_PLUGINS
  169. if [ -d $(STAGING_DIR)/usr/lib/qt/plugins/ ] ; then \
  170. mkdir -p $(TARGET_DIR)/usr/lib/qt/plugins ; \
  171. cp -dpfr $(STAGING_DIR)/usr/lib/qt/plugins/* $(TARGET_DIR)/usr/lib/qt/plugins ; \
  172. fi
  173. endef
  174. define QT5BASE_INSTALL_TARGET_FONTS
  175. if [ -d $(STAGING_DIR)/usr/lib/fonts/ ] ; then \
  176. mkdir -p $(TARGET_DIR)/usr/lib/fonts ; \
  177. cp -dpfr $(STAGING_DIR)/usr/lib/fonts/* $(TARGET_DIR)/usr/lib/fonts ; \
  178. fi
  179. endef
  180. define QT5BASE_INSTALL_TARGET_EXAMPLES
  181. if [ -d $(STAGING_DIR)/usr/lib/qt/examples/ ] ; then \
  182. mkdir -p $(TARGET_DIR)/usr/lib/qt/examples ; \
  183. cp -dpfr $(STAGING_DIR)/usr/lib/qt/examples/* $(TARGET_DIR)/usr/lib/qt/examples ; \
  184. fi
  185. endef
  186. ifeq ($(BR2_PREFER_STATIC_LIB),y)
  187. define QT5BASE_INSTALL_TARGET_CMDS
  188. $(QT5BASE_INSTALL_TARGET_FONTS)
  189. $(QT5BASE_INSTALL_TARGET_EXAMPLES)
  190. endef
  191. else
  192. define QT5BASE_INSTALL_TARGET_CMDS
  193. $(QT5BASE_INSTALL_TARGET_LIBS)
  194. $(QT5BASE_INSTALL_TARGET_PLUGINS)
  195. $(QT5BASE_INSTALL_TARGET_FONTS)
  196. $(QT5BASE_INSTALL_TARGET_EXAMPLES)
  197. endef
  198. endif
  199. $(eval $(generic-package))