qt5base.mk 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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-cups \
  21. -no-iconv \
  22. -system-zlib \
  23. -system-pcre \
  24. -no-pch \
  25. -shared
  26. # Uses libgbm from mesa3d
  27. ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_EGL),y)
  28. QT5BASE_CONFIGURE_OPTS += -kms -gbm
  29. QT5BASE_DEPENDENCIES += mesa3d
  30. else
  31. QT5BASE_CONFIGURE_OPTS += -no-kms
  32. endif
  33. ifeq ($(BR2_ENABLE_DEBUG),y)
  34. QT5BASE_CONFIGURE_OPTS += -debug
  35. else
  36. QT5BASE_CONFIGURE_OPTS += -release
  37. endif
  38. QT5BASE_CONFIGURE_OPTS += -largefile
  39. ifeq ($(BR2_PACKAGE_QT5BASE_LICENSE_APPROVED),y)
  40. QT5BASE_CONFIGURE_OPTS += -opensource -confirm-license
  41. QT5BASE_LICENSE = GPLv3 or LGPLv2.1 with exception or LGPLv3, GFDLv1.3 (docs)
  42. QT5BASE_LICENSE_FILES = LICENSE.GPLv3 LICENSE.LGPLv21 LGPL_EXCEPTION.txt LICENSE.LGPLv3 LICENSE.FDL
  43. else
  44. QT5BASE_LICENSE = Commercial license
  45. QT5BASE_REDISTRIBUTE = NO
  46. endif
  47. QT5BASE_CONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_QT5BASE_CONFIG_FILE))
  48. ifneq ($(QT5BASE_CONFIG_FILE),)
  49. QT5BASE_CONFIGURE_OPTS += -qconfig buildroot
  50. endif
  51. ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
  52. QT5BASE_DEPENDENCIES += udev
  53. endif
  54. # Qt5 SQL Plugins
  55. ifeq ($(BR2_PACKAGE_QT5BASE_SQL),y)
  56. ifeq ($(BR2_PACKAGE_QT5BASE_MYSQL),y)
  57. QT5BASE_CONFIGURE_OPTS += -plugin-sql-mysql -mysql_config $(STAGING_DIR)/usr/bin/mysql_config
  58. QT5BASE_DEPENDENCIES += mysql
  59. else
  60. QT5BASE_CONFIGURE_OPTS += -no-sql-mysql
  61. endif
  62. ifeq ($(BR2_PACKAGE_QT5BASE_PSQL),y)
  63. QT5BASE_CONFIGURE_OPTS += -plugin-sql-psql -psql_config $(STAGING_DIR)/usr/bin/pg_config
  64. QT5BASE_DEPENDENCIES += postgresql
  65. else
  66. QT5BASE_CONFIGURE_OPTS += -no-sql-psql
  67. endif
  68. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_SQLITE_QT),-plugin-sql-sqlite)
  69. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_SQLITE_SYSTEM),-system-sqlite)
  70. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_SQLITE_SYSTEM),sqlite)
  71. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_SQLITE_NONE),-no-sql-sqlite)
  72. endif
  73. # We have to use --enable-linuxfb, otherwise Qt thinks that -linuxfb
  74. # is to add a link against the "inuxfb" library.
  75. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_GUI),-gui,-no-gui)
  76. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_WIDGETS),-widgets,-no-widgets)
  77. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_LINUXFB),--enable-linuxfb,-no-linuxfb)
  78. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_DIRECTFB),-directfb,-no-directfb)
  79. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_DIRECTFB),directfb)
  80. ifeq ($(BR2_PACKAGE_QT5BASE_XCB),y)
  81. QT5BASE_CONFIGURE_OPTS += -xcb -system-xkbcommon
  82. QT5BASE_DEPENDENCIES += \
  83. libxcb \
  84. xcb-util-wm \
  85. xcb-util-image \
  86. xcb-util-keysyms \
  87. xlib_libX11 \
  88. libxkbcommon
  89. ifeq ($(BR2_PACKAGE_QT5BASE_WIDGETS),y)
  90. QT5BASE_DEPENDENCIES += xlib_libXext
  91. endif
  92. else
  93. QT5BASE_CONFIGURE_OPTS += -no-xcb
  94. endif
  95. ifeq ($(BR2_PACKAGE_QT5BASE_OPENGL_DESKTOP),y)
  96. QT5BASE_CONFIGURE_OPTS += -opengl desktop
  97. QT5BASE_DEPENDENCIES += libgl
  98. else ifeq ($(BR2_PACKAGE_QT5BASE_OPENGL_ES2),y)
  99. QT5BASE_CONFIGURE_OPTS += -opengl es2
  100. QT5BASE_DEPENDENCIES += libgles
  101. else
  102. QT5BASE_CONFIGURE_OPTS += -no-opengl
  103. endif
  104. QT5BASE_DEFAULT_QPA = $(call qstrip,$(BR2_PACKAGE_QT5BASE_DEFAULT_QPA))
  105. QT5BASE_CONFIGURE_OPTS += $(if $(QT5BASE_DEFAULT_QPA),-qpa $(QT5BASE_DEFAULT_QPA))
  106. ifeq ($(BR2_PACKAGE_QT5BASE_EGLFS),y)
  107. QT5BASE_CONFIGURE_OPTS += -eglfs
  108. QT5BASE_DEPENDENCIES += libegl
  109. else
  110. QT5BASE_CONFIGURE_OPTS += -no-eglfs
  111. endif
  112. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_OPENSSL),-openssl,-no-openssl)
  113. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_OPENSSL),openssl)
  114. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_FONTCONFIG),-fontconfig,-no-fontconfig)
  115. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_FONTCONFIG),fontconfig)
  116. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_GIF),,-no-gif)
  117. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_JPEG),-system-libjpeg,-no-libjpeg)
  118. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_JPEG),jpeg)
  119. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_PNG),-system-libpng,-no-libpng)
  120. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_PNG),libpng)
  121. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_DBUS),-dbus,-no-dbus)
  122. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_DBUS),dbus)
  123. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_TSLIB),-tslib,-no-tslib)
  124. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_TSLIB),tslib)
  125. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_LIBGLIB2),-glib,-no-glib)
  126. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBGLIB2),libglib2)
  127. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_ICU),-icu,-no-icu)
  128. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_ICU),icu)
  129. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_EXAMPLES),-make,-nomake) examples
  130. # gstreamer 0.10 support is broken in qt5multimedia
  131. ifeq ($(BR2_PACKAGE_GST1_PLUGINS_BASE),y)
  132. QT5BASE_CONFIGURE_OPTS += -gstreamer 1.0
  133. QT5BASE_DEPENDENCIES += gst1-plugins-base
  134. else
  135. QT5BASE_CONFIGURE_OPTS += -no-gstreamer
  136. endif
  137. ifeq ($(BR2_PACKAGE_LIBINPUT),y)
  138. QT5BASE_CONFIGURE_OPTS += -libinput
  139. QT5BASE_DEPENDENCIES += libinput
  140. else
  141. QT5BASE_CONFIGURE_OPTS += -no-libinput
  142. endif
  143. # Build the list of libraries to be installed on the target
  144. QT5BASE_INSTALL_LIBS_y += Qt5Core
  145. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_XCB) += Qt5XcbQpa
  146. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_NETWORK) += Qt5Network
  147. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_CONCURRENT) += Qt5Concurrent
  148. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_SQL) += Qt5Sql
  149. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_TEST) += Qt5Test
  150. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_XML) += Qt5Xml
  151. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_OPENGL_LIB) += Qt5OpenGL
  152. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_EGLFS) += Qt5EglDeviceIntegration
  153. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_GUI) += Qt5Gui
  154. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_WIDGETS) += Qt5Widgets
  155. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_PRINTSUPPORT) += Qt5PrintSupport
  156. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_DBUS) += Qt5DBus
  157. ifneq ($(QT5BASE_CONFIG_FILE),)
  158. define QT5BASE_CONFIGURE_CONFIG_FILE
  159. cp $(QT5BASE_CONFIG_FILE) $(@D)/src/corelib/global/qconfig-buildroot.h
  160. endef
  161. endif
  162. define QT5BASE_CONFIGURE_CMDS
  163. $(INSTALL) -m 0644 -D $(QT5BASE_PKGDIR)/qmake.conf \
  164. $(@D)/mkspecs/devices/linux-buildroot-g++/qmake.conf
  165. $(INSTALL) -m 0644 -D $(QT5BASE_PKGDIR)/qplatformdefs.h \
  166. $(@D)/mkspecs/devices/linux-buildroot-g++/qplatformdefs.h
  167. $(QT5BASE_CONFIGURE_CONFIG_FILE)
  168. (cd $(@D); \
  169. $(TARGET_MAKE_ENV) \
  170. PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
  171. PKG_CONFIG_LIBDIR="$(STAGING_DIR)/usr/lib/pkgconfig" \
  172. PKG_CONFIG_SYSROOT_DIR="$(STAGING_DIR)" \
  173. MAKEFLAGS="$(MAKEFLAGS) -j$(PARALLEL_JOBS)" \
  174. ./configure \
  175. -v \
  176. -prefix /usr \
  177. -hostprefix $(HOST_DIR)/usr \
  178. -headerdir /usr/include/qt5 \
  179. -sysroot $(STAGING_DIR) \
  180. -plugindir /usr/lib/qt/plugins \
  181. -examplesdir /usr/lib/qt/examples \
  182. -no-rpath \
  183. -nomake tests \
  184. -device buildroot \
  185. -device-option CROSS_COMPILE="$(TARGET_CROSS)" \
  186. -device-option BR_COMPILER_CFLAGS="$(TARGET_CFLAGS) $(QT5BASE_EXTRA_CFLAGS)" \
  187. -device-option BR_COMPILER_CXXFLAGS="$(TARGET_CXXFLAGS) $(QT5BASE_EXTRA_CFLAGS)" \
  188. $(QT5BASE_CONFIGURE_OPTS) \
  189. )
  190. endef
  191. define QT5BASE_BUILD_CMDS
  192. $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
  193. endef
  194. define QT5BASE_INSTALL_STAGING_CMDS
  195. $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install
  196. $(QT5_LA_PRL_FILES_FIXUP)
  197. endef
  198. define QT5BASE_INSTALL_TARGET_LIBS
  199. for lib in $(QT5BASE_INSTALL_LIBS_y); do \
  200. cp -dpf $(STAGING_DIR)/usr/lib/lib$${lib}.so.* $(TARGET_DIR)/usr/lib || exit 1 ; \
  201. done
  202. endef
  203. define QT5BASE_INSTALL_TARGET_PLUGINS
  204. if [ -d $(STAGING_DIR)/usr/lib/qt/plugins/ ] ; then \
  205. mkdir -p $(TARGET_DIR)/usr/lib/qt/plugins ; \
  206. cp -dpfr $(STAGING_DIR)/usr/lib/qt/plugins/* $(TARGET_DIR)/usr/lib/qt/plugins ; \
  207. fi
  208. endef
  209. define QT5BASE_INSTALL_TARGET_FONTS
  210. if [ -d $(STAGING_DIR)/usr/lib/fonts/ ] ; then \
  211. mkdir -p $(TARGET_DIR)/usr/lib/fonts ; \
  212. cp -dpfr $(STAGING_DIR)/usr/lib/fonts/* $(TARGET_DIR)/usr/lib/fonts ; \
  213. fi
  214. endef
  215. define QT5BASE_INSTALL_TARGET_EXAMPLES
  216. if [ -d $(STAGING_DIR)/usr/lib/qt/examples/ ] ; then \
  217. mkdir -p $(TARGET_DIR)/usr/lib/qt/examples ; \
  218. cp -dpfr $(STAGING_DIR)/usr/lib/qt/examples/* $(TARGET_DIR)/usr/lib/qt/examples ; \
  219. fi
  220. endef
  221. ifeq ($(BR2_STATIC_LIBS),y)
  222. define QT5BASE_INSTALL_TARGET_CMDS
  223. $(QT5BASE_INSTALL_TARGET_FONTS)
  224. $(QT5BASE_INSTALL_TARGET_EXAMPLES)
  225. endef
  226. else
  227. define QT5BASE_INSTALL_TARGET_CMDS
  228. $(QT5BASE_INSTALL_TARGET_LIBS)
  229. $(QT5BASE_INSTALL_TARGET_PLUGINS)
  230. $(QT5BASE_INSTALL_TARGET_FONTS)
  231. $(QT5BASE_INSTALL_TARGET_EXAMPLES)
  232. endef
  233. endif
  234. $(eval $(generic-package))