qt5base.mk 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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_STATIC_LIBS),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 with exception or LGPLv3
  47. QT5BASE_LICENSE_FILES = LICENSE.LGPLv21 LGPL_EXCEPTION.txt LICENSE.LGPLv3
  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. ifeq ($(BR2_PACKAGE_QT5BASE_PSQL),y)
  61. QT5BASE_CONFIGURE_OPTS += -plugin-sql-psql -psql_config $(STAGING_DIR)/usr/bin/pg_config
  62. QT5BASE_DEPENDENCIES += postgresql
  63. else
  64. QT5BASE_CONFIGURE_OPTS += -no-sql-psql
  65. endif
  66. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_SQLITE_QT),-plugin-sql-sqlite)
  67. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_SQLITE_SYSTEM),-system-sqlite)
  68. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_SQLITE_SYSTEM),sqlite)
  69. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_SQLITE_NONE),-no-sql-sqlite)
  70. endif
  71. # We have to use --enable-linuxfb, otherwise Qt thinks that -linuxfb
  72. # is to add a link against the "inuxfb" library.
  73. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_GUI),-gui,-no-gui)
  74. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_WIDGETS),-widgets,-no-widgets)
  75. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_LINUXFB),--enable-linuxfb,-no-linuxfb)
  76. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_DIRECTFB),-directfb,-no-directfb)
  77. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_DIRECTFB),directfb)
  78. ifeq ($(BR2_PACKAGE_QT5BASE_XCB),y)
  79. QT5BASE_CONFIGURE_OPTS += -xcb -system-xkbcommon
  80. QT5BASE_DEPENDENCIES += \
  81. libxcb \
  82. xcb-util-wm \
  83. xcb-util-image \
  84. xcb-util-keysyms \
  85. xlib_libX11 \
  86. libxkbcommon
  87. ifeq ($(BR2_PACKAGE_QT5BASE_WIDGETS),y)
  88. QT5BASE_DEPENDENCIES += xlib_libXext
  89. endif
  90. else
  91. QT5BASE_CONFIGURE_OPTS += -no-xcb
  92. endif
  93. ifeq ($(BR2_PACKAGE_QT5BASE_OPENGL_DESKTOP),y)
  94. QT5BASE_CONFIGURE_OPTS += -opengl desktop
  95. QT5BASE_DEPENDENCIES += libgl
  96. else ifeq ($(BR2_PACKAGE_QT5BASE_OPENGL_ES2),y)
  97. QT5BASE_CONFIGURE_OPTS += -opengl es2
  98. QT5BASE_DEPENDENCIES += libgles
  99. else
  100. QT5BASE_CONFIGURE_OPTS += -no-opengl
  101. endif
  102. QT5BASE_DEFAULT_QPA = $(call qstrip,$(BR2_PACKAGE_QT5BASE_DEFAULT_QPA))
  103. QT5BASE_CONFIGURE_OPTS += $(if $(QT5BASE_DEFAULT_QPA),-qpa $(QT5BASE_DEFAULT_QPA))
  104. ifeq ($(BR2_PACKAGE_QT5BASE_EGLFS),y)
  105. QT5BASE_CONFIGURE_OPTS += -eglfs
  106. QT5BASE_DEPENDENCIES += libegl
  107. ifeq ($(BR2_PACKAGE_GPU_VIV_BIN_MX6Q),y)
  108. QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES = \
  109. $(@D)/mkspecs/devices/linux-imx6-g++/qeglfshooks_imx6.cpp
  110. endif
  111. ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
  112. QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES = \
  113. $(@D)/mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp
  114. endif
  115. else
  116. QT5BASE_CONFIGURE_OPTS += -no-eglfs
  117. endif
  118. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_OPENSSL),-openssl,-no-openssl)
  119. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_OPENSSL),openssl)
  120. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_FONTCONFIG),-fontconfig,-no-fontconfig)
  121. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_FONTCONFIG),fontconfig)
  122. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_GIF),,-no-gif)
  123. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_JPEG),-system-libjpeg,-no-libjpeg)
  124. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_JPEG),jpeg)
  125. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_PNG),-system-libpng,-no-libpng)
  126. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_PNG),libpng)
  127. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_DBUS),-dbus,-no-dbus)
  128. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_DBUS),dbus)
  129. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_TSLIB),-tslib,-no-tslib)
  130. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_TSLIB),tslib)
  131. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_LIBGLIB2),-glib,-no-glib)
  132. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBGLIB2),libglib2)
  133. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_ICU),-icu,-no-icu)
  134. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_ICU),icu)
  135. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_EXAMPLES),-make,-nomake) examples
  136. # Build the list of libraries to be installed on the target
  137. QT5BASE_INSTALL_LIBS_y += Qt5Core
  138. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_NETWORK) += Qt5Network
  139. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_CONCURRENT) += Qt5Concurrent
  140. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_SQL) += Qt5Sql
  141. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_TEST) += Qt5Test
  142. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_XML) += Qt5Xml
  143. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_OPENGL_LIB) += Qt5OpenGL
  144. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_GUI) += Qt5Gui
  145. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_WIDGETS) += Qt5Widgets
  146. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_PRINTSUPPORT) += Qt5PrintSupport
  147. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_DBUS) += Qt5DBus
  148. define QT5BASE_CONFIGURE_CMDS
  149. (cd $(@D); \
  150. PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
  151. PKG_CONFIG_LIBDIR="$(STAGING_DIR)/usr/lib/pkgconfig" \
  152. PKG_CONFIG_SYSROOT_DIR="$(STAGING_DIR)" \
  153. MAKEFLAGS="$(MAKEFLAGS) -j$(PARALLEL_JOBS)" \
  154. $(QT5BASE_CONFIGURE_ENV) \
  155. ./configure \
  156. -v \
  157. -prefix /usr \
  158. -hostprefix $(HOST_DIR)/usr \
  159. -headerdir /usr/include/qt5 \
  160. -sysroot $(STAGING_DIR) \
  161. -plugindir /usr/lib/qt/plugins \
  162. -examplesdir /usr/lib/qt/examples \
  163. -no-rpath \
  164. -nomake tests \
  165. -device buildroot \
  166. -device-option CROSS_COMPILE="$(TARGET_CROSS)" \
  167. -device-option BR_CCACHE="$(CCACHE)" \
  168. -device-option BR_COMPILER_CFLAGS="$(TARGET_CFLAGS)" \
  169. -device-option BR_COMPILER_CXXFLAGS="$(TARGET_CXXFLAGS)" \
  170. -device-option EGLFS_PLATFORM_HOOKS_SOURCES="$(QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES)" \
  171. $(QT5BASE_CONFIGURE_OPTS) \
  172. )
  173. endef
  174. define QT5BASE_BUILD_CMDS
  175. $(MAKE) -C $(@D)
  176. endef
  177. define QT5BASE_INSTALL_STAGING_CMDS
  178. $(MAKE) -C $(@D) install
  179. $(QT5_LA_PRL_FILES_FIXUP)
  180. endef
  181. define QT5BASE_INSTALL_TARGET_LIBS
  182. for lib in $(QT5BASE_INSTALL_LIBS_y); do \
  183. cp -dpf $(STAGING_DIR)/usr/lib/lib$${lib}.so.* $(TARGET_DIR)/usr/lib || exit 1 ; \
  184. done
  185. endef
  186. define QT5BASE_INSTALL_TARGET_PLUGINS
  187. if [ -d $(STAGING_DIR)/usr/lib/qt/plugins/ ] ; then \
  188. mkdir -p $(TARGET_DIR)/usr/lib/qt/plugins ; \
  189. cp -dpfr $(STAGING_DIR)/usr/lib/qt/plugins/* $(TARGET_DIR)/usr/lib/qt/plugins ; \
  190. fi
  191. endef
  192. define QT5BASE_INSTALL_TARGET_FONTS
  193. if [ -d $(STAGING_DIR)/usr/lib/fonts/ ] ; then \
  194. mkdir -p $(TARGET_DIR)/usr/lib/fonts ; \
  195. cp -dpfr $(STAGING_DIR)/usr/lib/fonts/* $(TARGET_DIR)/usr/lib/fonts ; \
  196. fi
  197. endef
  198. define QT5BASE_INSTALL_TARGET_EXAMPLES
  199. if [ -d $(STAGING_DIR)/usr/lib/qt/examples/ ] ; then \
  200. mkdir -p $(TARGET_DIR)/usr/lib/qt/examples ; \
  201. cp -dpfr $(STAGING_DIR)/usr/lib/qt/examples/* $(TARGET_DIR)/usr/lib/qt/examples ; \
  202. fi
  203. endef
  204. ifeq ($(BR2_STATIC_LIBS),y)
  205. define QT5BASE_INSTALL_TARGET_CMDS
  206. $(QT5BASE_INSTALL_TARGET_FONTS)
  207. $(QT5BASE_INSTALL_TARGET_EXAMPLES)
  208. endef
  209. else
  210. define QT5BASE_INSTALL_TARGET_CMDS
  211. $(QT5BASE_INSTALL_TARGET_LIBS)
  212. $(QT5BASE_INSTALL_TARGET_PLUGINS)
  213. $(QT5BASE_INSTALL_TARGET_FONTS)
  214. $(QT5BASE_INSTALL_TARGET_EXAMPLES)
  215. endef
  216. endif
  217. $(eval $(generic-package))