qt5base.mk 12 KB

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