qt5base.mk 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. ################################################################################
  2. #
  3. # qt5base
  4. #
  5. ################################################################################
  6. QT5BASE_VERSION = $(QT5_VERSION)
  7. QT5BASE_SITE = $(QT5_SITE)
  8. QT5BASE_SOURCE = qtbase-$(QT5_SOURCE_TARBALL_PREFIX)-$(QT5BASE_VERSION).tar.xz
  9. QT5BASE_DEPENDENCIES = host-pkgconf zlib
  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. ifeq ($(BR2_PACKAGE_QT5_VERSION_5_6),y)
  27. QT5BASE_DEPENDENCIES += pcre
  28. else
  29. QT5BASE_DEPENDENCIES += pcre2
  30. endif
  31. QT5BASE_CONFIGURE_OPTS += $(call qstrip,$(BR2_PACKAGE_QT5BASE_CUSTOM_CONF_OPTS))
  32. # Uses libgbm from mesa3d
  33. ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_EGL),y)
  34. QT5BASE_CONFIGURE_OPTS += -kms -gbm
  35. QT5BASE_DEPENDENCIES += mesa3d
  36. else
  37. QT5BASE_CONFIGURE_OPTS += -no-kms
  38. endif
  39. ifeq ($(BR2_ENABLE_DEBUG),y)
  40. QT5BASE_CONFIGURE_OPTS += -debug
  41. else
  42. QT5BASE_CONFIGURE_OPTS += -release
  43. endif
  44. ifeq ($(BR2_PACKAGE_QT5_VERSION_5_6),y)
  45. QT5BASE_CONFIGURE_OPTS += -largefile
  46. endif
  47. QT5BASE_CONFIGURE_OPTS += -opensource -confirm-license
  48. ifeq ($(BR2_PACKAGE_QT5_VERSION_LATEST),y)
  49. QT5BASE_LICENSE = GPL-2.0+ or LGPL-3.0, GPL-3.0 with exception(tools), GFDL-1.3 (docs)
  50. QT5BASE_LICENSE_FILES = LICENSE.GPL2 LICENSE.GPL3 LICENSE.GPL3-EXCEPT LICENSE.LGPLv3 LICENSE.FDL
  51. else
  52. QT5BASE_LICENSE = GPL-3.0 or LGPL-2.1 with exception or LGPL-3.0, GFDL-1.3 (docs)
  53. QT5BASE_LICENSE_FILES = LICENSE.GPLv3 LICENSE.LGPLv21 LGPL_EXCEPTION.txt LICENSE.LGPLv3 LICENSE.FDL
  54. endif
  55. ifeq ($(BR2_PACKAGE_QT5BASE_EXAMPLES),y)
  56. QT5BASE_LICENSE := $(QT5BASE_LICENSE), BSD-3-Clause (examples)
  57. QT5BASE_LICENSE_FILES += header.BSD
  58. endif
  59. QT5BASE_CONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_QT5BASE_CONFIG_FILE))
  60. ifneq ($(QT5BASE_CONFIG_FILE),)
  61. QT5BASE_CONFIGURE_OPTS += -qconfig buildroot
  62. endif
  63. ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
  64. QT5BASE_DEPENDENCIES += udev
  65. endif
  66. # Qt5 SQL Plugins
  67. ifeq ($(BR2_PACKAGE_QT5BASE_SQL),y)
  68. ifeq ($(BR2_PACKAGE_QT5BASE_MYSQL),y)
  69. QT5BASE_CONFIGURE_OPTS += -plugin-sql-mysql -mysql_config $(STAGING_DIR)/usr/bin/mysql_config
  70. QT5BASE_DEPENDENCIES += mysql
  71. else
  72. QT5BASE_CONFIGURE_OPTS += -no-sql-mysql
  73. endif
  74. ifeq ($(BR2_PACKAGE_QT5BASE_PSQL),y)
  75. QT5BASE_CONFIGURE_OPTS += -plugin-sql-psql -psql_config $(STAGING_DIR)/usr/bin/pg_config
  76. QT5BASE_DEPENDENCIES += postgresql
  77. else
  78. QT5BASE_CONFIGURE_OPTS += -no-sql-psql
  79. endif
  80. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_SQLITE_QT),-plugin-sql-sqlite)
  81. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_SQLITE_SYSTEM),-system-sqlite)
  82. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_SQLITE_SYSTEM),sqlite)
  83. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_SQLITE_NONE),-no-sql-sqlite)
  84. endif
  85. ifeq ($(BR2_PACKAGE_QT5BASE_GUI),y)
  86. QT5BASE_CONFIGURE_OPTS += -gui -system-freetype
  87. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5_VERSION_5_6),-I$(STAGING_DIR)/usr/include/freetype2)
  88. QT5BASE_DEPENDENCIES += freetype
  89. else
  90. QT5BASE_CONFIGURE_OPTS += -no-gui -no-freetype
  91. endif
  92. ifeq ($(BR2_PACKAGE_QT5BASE_HARFBUZZ),y)
  93. ifeq ($(BR2_TOOLCHAIN_HAS_SYNC_4),y)
  94. # system harfbuzz in case __sync for 4 bytes is supported
  95. QT5BASE_CONFIGURE_OPTS += -system-harfbuzz
  96. QT5BASE_DEPENDENCIES += harfbuzz
  97. else
  98. # qt harfbuzz otherwise (using QAtomic instead)
  99. QT5BASE_CONFIGURE_OPTS += -qt-harfbuzz
  100. QT5BASE_LICENSE := $(QT5BASE_LICENSE), MIT (harfbuzz)
  101. QT5BASE_LICENSE_FILES += src/3rdparty/harfbuzz-ng/COPYING
  102. endif
  103. else
  104. QT5BASE_CONFIGURE_OPTS += -no-harfbuzz
  105. endif
  106. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_WIDGETS),-widgets,-no-widgets)
  107. # We have to use --enable-linuxfb, otherwise Qt thinks that -linuxfb
  108. # is to add a link against the "inuxfb" library.
  109. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_LINUXFB),--enable-linuxfb,-no-linuxfb)
  110. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_DIRECTFB),-directfb,-no-directfb)
  111. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_DIRECTFB),directfb)
  112. ifeq ($(BR2_PACKAGE_QT5BASE_XCB),y)
  113. QT5BASE_CONFIGURE_OPTS += -xcb -system-xkbcommon
  114. QT5BASE_DEPENDENCIES += \
  115. libxcb \
  116. xcb-util-wm \
  117. xcb-util-image \
  118. xcb-util-keysyms \
  119. xlib_libX11 \
  120. libxkbcommon
  121. ifeq ($(BR2_PACKAGE_QT5BASE_WIDGETS),y)
  122. QT5BASE_DEPENDENCIES += xlib_libXext
  123. endif
  124. else
  125. QT5BASE_CONFIGURE_OPTS += -no-xcb
  126. endif
  127. ifeq ($(BR2_PACKAGE_QT5BASE_OPENGL_DESKTOP),y)
  128. QT5BASE_CONFIGURE_OPTS += -opengl desktop
  129. QT5BASE_DEPENDENCIES += libgl
  130. else ifeq ($(BR2_PACKAGE_QT5BASE_OPENGL_ES2),y)
  131. QT5BASE_CONFIGURE_OPTS += -opengl es2
  132. QT5BASE_DEPENDENCIES += libgles
  133. else
  134. QT5BASE_CONFIGURE_OPTS += -no-opengl
  135. endif
  136. QT5BASE_DEFAULT_QPA = $(call qstrip,$(BR2_PACKAGE_QT5BASE_DEFAULT_QPA))
  137. QT5BASE_CONFIGURE_OPTS += $(if $(QT5BASE_DEFAULT_QPA),-qpa $(QT5BASE_DEFAULT_QPA))
  138. ifeq ($(BR2_PACKAGE_QT5BASE_EGLFS),y)
  139. QT5BASE_CONFIGURE_OPTS += -eglfs
  140. QT5BASE_DEPENDENCIES += libegl
  141. else
  142. QT5BASE_CONFIGURE_OPTS += -no-eglfs
  143. endif
  144. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_OPENSSL),-openssl,-no-openssl)
  145. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_OPENSSL),openssl)
  146. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_FONTCONFIG),-fontconfig,-no-fontconfig)
  147. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_FONTCONFIG),fontconfig)
  148. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_GIF),,-no-gif)
  149. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_JPEG),-system-libjpeg,-no-libjpeg)
  150. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_JPEG),jpeg)
  151. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_PNG),-system-libpng,-no-libpng)
  152. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_PNG),libpng)
  153. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_DBUS),-dbus,-no-dbus)
  154. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_DBUS),dbus)
  155. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_TSLIB),-tslib,-no-tslib)
  156. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_TSLIB),tslib)
  157. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_LIBGLIB2),-glib,-no-glib)
  158. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBGLIB2),libglib2)
  159. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_ICU),-icu,-no-icu)
  160. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_ICU),icu)
  161. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_EXAMPLES),-make,-nomake) examples
  162. ifeq ($(BR2_PACKAGE_QT5_VERSION_5_6),y)
  163. # gstreamer 0.10 support is broken in qt5multimedia
  164. ifeq ($(BR2_PACKAGE_GST1_PLUGINS_BASE),y)
  165. QT5BASE_CONFIGURE_OPTS += -gstreamer 1.0
  166. QT5BASE_DEPENDENCIES += gst1-plugins-base
  167. else
  168. QT5BASE_CONFIGURE_OPTS += -no-gstreamer
  169. endif
  170. endif
  171. ifeq ($(BR2_PACKAGE_LIBINPUT),y)
  172. QT5BASE_CONFIGURE_OPTS += -libinput
  173. QT5BASE_DEPENDENCIES += libinput
  174. else
  175. QT5BASE_CONFIGURE_OPTS += -no-libinput
  176. endif
  177. ifeq ($(BR2_PACKAGE_QT5_VERSION_LATEST),y)
  178. # only enable gtk support if libgtk3 X11 backend is enabled
  179. ifeq ($(BR2_PACKAGE_LIBGTK3)$(BR2_PACKAGE_LIBGTK3_X11),yy)
  180. QT5BASE_CONFIGURE_OPTS += -gtk
  181. QT5BASE_DEPENDENCIES += libgtk3
  182. else
  183. QT5BASE_CONFIGURE_OPTS += -no-gtk
  184. endif
  185. endif
  186. # Build the list of libraries to be installed on the target
  187. QT5BASE_INSTALL_LIBS_y += Qt5Core
  188. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_XCB) += Qt5XcbQpa
  189. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_NETWORK) += Qt5Network
  190. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_CONCURRENT) += Qt5Concurrent
  191. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_SQL) += Qt5Sql
  192. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_TEST) += Qt5Test
  193. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_XML) += Qt5Xml
  194. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_OPENGL_LIB) += Qt5OpenGL
  195. ifeq ($(BR2_PACKAGE_QT5_VERSION_LATEST),y)
  196. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_EGLFS) += Qt5EglFSDeviceIntegration
  197. ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_EGL),y)
  198. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_EGLFS) += Qt5EglFsKmsSupport
  199. endif
  200. else
  201. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_EGLFS) += Qt5EglDeviceIntegration
  202. endif
  203. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_GUI) += Qt5Gui
  204. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_WIDGETS) += Qt5Widgets
  205. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_PRINTSUPPORT) += Qt5PrintSupport
  206. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_DBUS) += Qt5DBus
  207. ifeq ($(BR2_PACKAGE_QT5_VERSION_LATEST),y)
  208. ifeq ($(BR2_PACKAGE_IMX_GPU_VIV),y)
  209. # use vivante backend
  210. QT5BASE_EGLFS_DEVICE = EGLFS_DEVICE_INTEGRATION = eglfs_viv
  211. else ifeq ($(BR2_PACKAGE_SUNXI_MALI)$(BR2_PACKAGE_SUNXI_MALI_MAINLINE),y)
  212. # use mali backend
  213. QT5BASE_EGLFS_DEVICE = EGLFS_DEVICE_INTEGRATION = eglfs_mali
  214. endif
  215. endif
  216. ifneq ($(QT5BASE_CONFIG_FILE),)
  217. define QT5BASE_CONFIGURE_CONFIG_FILE
  218. cp $(QT5BASE_CONFIG_FILE) $(@D)/src/corelib/global/qconfig-buildroot.h
  219. endef
  220. endif
  221. QT5BASE_ARCH_CONFIG_FILE = $(@D)/mkspecs/devices/linux-buildroot-g++/arch.conf
  222. ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC)$(BR2_PACKAGE_QT5_VERSION_LATEST),yy)
  223. # Qt 5.8 needs atomics, which on various architectures are in -latomic
  224. define QT5BASE_CONFIGURE_ARCH_CONFIG
  225. printf 'LIBS += -latomic\n' >$(QT5BASE_ARCH_CONFIG_FILE)
  226. endef
  227. endif
  228. define QT5BASE_CONFIGURE_CMDS
  229. mkdir -p $(@D)/mkspecs/devices/linux-buildroot-g++/
  230. sed 's/@EGLFS_DEVICE@/$(QT5BASE_EGLFS_DEVICE)/g' \
  231. $(QT5BASE_PKGDIR)/qmake.conf.in > \
  232. $(@D)/mkspecs/devices/linux-buildroot-g++/qmake.conf
  233. $(INSTALL) -m 0644 -D $(QT5BASE_PKGDIR)/qplatformdefs.h \
  234. $(@D)/mkspecs/devices/linux-buildroot-g++/qplatformdefs.h
  235. $(QT5BASE_CONFIGURE_CONFIG_FILE)
  236. touch $(QT5BASE_ARCH_CONFIG_FILE)
  237. $(QT5BASE_CONFIGURE_ARCH_CONFIG)
  238. (cd $(@D); \
  239. $(TARGET_MAKE_ENV) \
  240. PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
  241. MAKEFLAGS="$(MAKEFLAGS) -j$(PARALLEL_JOBS)" \
  242. ./configure \
  243. -v \
  244. -prefix /usr \
  245. -hostprefix $(HOST_DIR) \
  246. -headerdir /usr/include/qt5 \
  247. -sysroot $(STAGING_DIR) \
  248. -plugindir /usr/lib/qt/plugins \
  249. -examplesdir /usr/lib/qt/examples \
  250. -no-rpath \
  251. -nomake tests \
  252. -device buildroot \
  253. -device-option CROSS_COMPILE="$(TARGET_CROSS)" \
  254. -device-option BR_COMPILER_CFLAGS="$(TARGET_CFLAGS)" \
  255. -device-option BR_COMPILER_CXXFLAGS="$(TARGET_CXXFLAGS)" \
  256. $(QT5BASE_CONFIGURE_OPTS) \
  257. )
  258. endef
  259. define QT5BASE_BUILD_CMDS
  260. $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
  261. endef
  262. # The file "qt.conf" can be used to override the hard-coded paths that are
  263. # compiled into the Qt library. We need it to make "qmake" relocatable.
  264. define QT5BASE_INSTALL_QT_CONF
  265. sed -e "s|@@HOST_DIR@@|$(HOST_DIR)|" -e "s|@@STAGING_DIR@@|$(STAGING_DIR)|" \
  266. $(QT5BASE_PKGDIR)/qt.conf.in > $(HOST_DIR)/bin/qt.conf
  267. endef
  268. define QT5BASE_INSTALL_STAGING_CMDS
  269. $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install
  270. $(QT5_LA_PRL_FILES_FIXUP)
  271. $(QT5BASE_INSTALL_QT_CONF)
  272. endef
  273. define QT5BASE_INSTALL_TARGET_LIBS
  274. for lib in $(QT5BASE_INSTALL_LIBS_y); do \
  275. cp -dpf $(STAGING_DIR)/usr/lib/lib$${lib}.so.* $(TARGET_DIR)/usr/lib || exit 1 ; \
  276. done
  277. endef
  278. define QT5BASE_INSTALL_TARGET_PLUGINS
  279. if [ -d $(STAGING_DIR)/usr/lib/qt/plugins/ ] ; then \
  280. mkdir -p $(TARGET_DIR)/usr/lib/qt/plugins ; \
  281. cp -dpfr $(STAGING_DIR)/usr/lib/qt/plugins/* $(TARGET_DIR)/usr/lib/qt/plugins ; \
  282. fi
  283. endef
  284. ifeq ($(BR2_PACKAGE_QT5_VERSION_5_6),y)
  285. define QT5BASE_INSTALL_TARGET_FONTS
  286. if [ -d $(STAGING_DIR)/usr/lib/fonts/ ] ; then \
  287. mkdir -p $(TARGET_DIR)/usr/lib/fonts ; \
  288. cp -dpfr $(STAGING_DIR)/usr/lib/fonts/* $(TARGET_DIR)/usr/lib/fonts ; \
  289. fi
  290. endef
  291. endif
  292. define QT5BASE_INSTALL_TARGET_EXAMPLES
  293. if [ -d $(STAGING_DIR)/usr/lib/qt/examples/ ] ; then \
  294. mkdir -p $(TARGET_DIR)/usr/lib/qt/examples ; \
  295. cp -dpfr $(STAGING_DIR)/usr/lib/qt/examples/* $(TARGET_DIR)/usr/lib/qt/examples ; \
  296. fi
  297. endef
  298. ifeq ($(BR2_STATIC_LIBS),y)
  299. define QT5BASE_INSTALL_TARGET_CMDS
  300. $(QT5BASE_INSTALL_TARGET_FONTS)
  301. $(QT5BASE_INSTALL_TARGET_EXAMPLES)
  302. endef
  303. else
  304. define QT5BASE_INSTALL_TARGET_CMDS
  305. $(QT5BASE_INSTALL_TARGET_LIBS)
  306. $(QT5BASE_INSTALL_TARGET_PLUGINS)
  307. $(QT5BASE_INSTALL_TARGET_FONTS)
  308. $(QT5BASE_INSTALL_TARGET_EXAMPLES)
  309. endef
  310. endif
  311. $(eval $(generic-package))