qt5base.mk 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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
  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.GPLv3 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. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_WIDGETS),-widgets,-no-widgets)
  93. # We have to use --enable-linuxfb, otherwise Qt thinks that -linuxfb
  94. # is to add a link against the "inuxfb" library.
  95. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_LINUXFB),--enable-linuxfb,-no-linuxfb)
  96. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_DIRECTFB),-directfb,-no-directfb)
  97. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_DIRECTFB),directfb)
  98. ifeq ($(BR2_PACKAGE_QT5BASE_XCB),y)
  99. QT5BASE_CONFIGURE_OPTS += -xcb -system-xkbcommon
  100. QT5BASE_DEPENDENCIES += \
  101. libxcb \
  102. xcb-util-wm \
  103. xcb-util-image \
  104. xcb-util-keysyms \
  105. xlib_libX11 \
  106. libxkbcommon
  107. ifeq ($(BR2_PACKAGE_QT5BASE_WIDGETS),y)
  108. QT5BASE_DEPENDENCIES += xlib_libXext
  109. endif
  110. else
  111. QT5BASE_CONFIGURE_OPTS += -no-xcb
  112. endif
  113. ifeq ($(BR2_PACKAGE_QT5BASE_OPENGL_DESKTOP),y)
  114. QT5BASE_CONFIGURE_OPTS += -opengl desktop
  115. QT5BASE_DEPENDENCIES += libgl
  116. else ifeq ($(BR2_PACKAGE_QT5BASE_OPENGL_ES2),y)
  117. QT5BASE_CONFIGURE_OPTS += -opengl es2
  118. QT5BASE_DEPENDENCIES += libgles
  119. else
  120. QT5BASE_CONFIGURE_OPTS += -no-opengl
  121. endif
  122. QT5BASE_DEFAULT_QPA = $(call qstrip,$(BR2_PACKAGE_QT5BASE_DEFAULT_QPA))
  123. QT5BASE_CONFIGURE_OPTS += $(if $(QT5BASE_DEFAULT_QPA),-qpa $(QT5BASE_DEFAULT_QPA))
  124. ifeq ($(BR2_PACKAGE_QT5BASE_EGLFS),y)
  125. QT5BASE_CONFIGURE_OPTS += -eglfs
  126. QT5BASE_DEPENDENCIES += libegl
  127. else
  128. QT5BASE_CONFIGURE_OPTS += -no-eglfs
  129. endif
  130. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_OPENSSL),-openssl,-no-openssl)
  131. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_OPENSSL),openssl)
  132. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_FONTCONFIG),-fontconfig,-no-fontconfig)
  133. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_FONTCONFIG),fontconfig)
  134. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_GIF),,-no-gif)
  135. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_JPEG),-system-libjpeg,-no-libjpeg)
  136. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_JPEG),jpeg)
  137. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_PNG),-system-libpng,-no-libpng)
  138. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_PNG),libpng)
  139. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_DBUS),-dbus,-no-dbus)
  140. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_DBUS),dbus)
  141. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_TSLIB),-tslib,-no-tslib)
  142. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_TSLIB),tslib)
  143. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_LIBGLIB2),-glib,-no-glib)
  144. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBGLIB2),libglib2)
  145. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_ICU),-icu,-no-icu)
  146. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_ICU),icu)
  147. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_EXAMPLES),-make,-nomake) examples
  148. ifeq ($(BR2_PACKAGE_QT5_VERSION_5_6),y)
  149. # gstreamer 0.10 support is broken in qt5multimedia
  150. ifeq ($(BR2_PACKAGE_GST1_PLUGINS_BASE),y)
  151. QT5BASE_CONFIGURE_OPTS += -gstreamer 1.0
  152. QT5BASE_DEPENDENCIES += gst1-plugins-base
  153. else
  154. QT5BASE_CONFIGURE_OPTS += -no-gstreamer
  155. endif
  156. endif
  157. ifeq ($(BR2_PACKAGE_LIBINPUT),y)
  158. QT5BASE_CONFIGURE_OPTS += -libinput
  159. QT5BASE_DEPENDENCIES += libinput
  160. else
  161. QT5BASE_CONFIGURE_OPTS += -no-libinput
  162. endif
  163. # Build the list of libraries to be installed on the target
  164. QT5BASE_INSTALL_LIBS_y += Qt5Core
  165. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_XCB) += Qt5XcbQpa
  166. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_NETWORK) += Qt5Network
  167. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_CONCURRENT) += Qt5Concurrent
  168. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_SQL) += Qt5Sql
  169. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_TEST) += Qt5Test
  170. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_XML) += Qt5Xml
  171. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_OPENGL_LIB) += Qt5OpenGL
  172. ifeq ($(BR2_PACKAGE_QT5_VERSION_LATEST),y)
  173. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_EGLFS) += Qt5EglFSDeviceIntegration
  174. ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_EGL),y)
  175. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_EGLFS) += Qt5EglFsKmsSupport
  176. endif
  177. else
  178. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_EGLFS) += Qt5EglDeviceIntegration
  179. endif
  180. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_GUI) += Qt5Gui
  181. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_WIDGETS) += Qt5Widgets
  182. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_PRINTSUPPORT) += Qt5PrintSupport
  183. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_DBUS) += Qt5DBus
  184. ifneq ($(QT5BASE_CONFIG_FILE),)
  185. define QT5BASE_CONFIGURE_CONFIG_FILE
  186. cp $(QT5BASE_CONFIG_FILE) $(@D)/src/corelib/global/qconfig-buildroot.h
  187. endef
  188. endif
  189. QT5BASE_ARCH_CONFIG_FILE = $(@D)/mkspecs/devices/linux-buildroot-g++/arch.conf
  190. ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC)$(BR2_PACKAGE_QT5_VERSION_LATEST),yy)
  191. # Qt 5.8 needs atomics, which on various architectures are in -latomic
  192. define QT5BASE_CONFIGURE_ARCH_CONFIG
  193. printf 'LIBS += -latomic\n' >$(QT5BASE_ARCH_CONFIG_FILE)
  194. endef
  195. endif
  196. define QT5BASE_CONFIGURE_CMDS
  197. $(INSTALL) -m 0644 -D $(QT5BASE_PKGDIR)/qmake.conf \
  198. $(@D)/mkspecs/devices/linux-buildroot-g++/qmake.conf
  199. $(INSTALL) -m 0644 -D $(QT5BASE_PKGDIR)/qplatformdefs.h \
  200. $(@D)/mkspecs/devices/linux-buildroot-g++/qplatformdefs.h
  201. $(QT5BASE_CONFIGURE_CONFIG_FILE)
  202. touch $(QT5BASE_ARCH_CONFIG_FILE)
  203. $(QT5BASE_CONFIGURE_ARCH_CONFIG)
  204. (cd $(@D); \
  205. $(TARGET_MAKE_ENV) \
  206. PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
  207. PKG_CONFIG_LIBDIR="$(STAGING_DIR)/usr/lib/pkgconfig" \
  208. PKG_CONFIG_SYSROOT_DIR="$(STAGING_DIR)" \
  209. MAKEFLAGS="$(MAKEFLAGS) -j$(PARALLEL_JOBS)" \
  210. ./configure \
  211. -v \
  212. -prefix /usr \
  213. -hostprefix $(HOST_DIR) \
  214. -headerdir /usr/include/qt5 \
  215. -sysroot $(STAGING_DIR) \
  216. -plugindir /usr/lib/qt/plugins \
  217. -examplesdir /usr/lib/qt/examples \
  218. -no-rpath \
  219. -nomake tests \
  220. -device buildroot \
  221. -device-option CROSS_COMPILE="$(TARGET_CROSS)" \
  222. -device-option BR_COMPILER_CFLAGS="$(TARGET_CFLAGS) $(QT5BASE_EXTRA_CFLAGS)" \
  223. -device-option BR_COMPILER_CXXFLAGS="$(TARGET_CXXFLAGS) $(QT5BASE_EXTRA_CFLAGS)" \
  224. $(QT5BASE_CONFIGURE_OPTS) \
  225. )
  226. endef
  227. define QT5BASE_BUILD_CMDS
  228. $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
  229. endef
  230. # The file "qt.conf" can be used to override the hard-coded paths that are
  231. # compiled into the Qt library. We need it to make "qmake" relocatable.
  232. define QT5BASE_INSTALL_QT_CONF
  233. sed -e "s|@@HOST_DIR@@|$(HOST_DIR)|" -e "s|@@STAGING_DIR@@|$(STAGING_DIR)|" \
  234. $(QT5BASE_PKGDIR)/qt.conf.in > $(HOST_DIR)/bin/qt.conf
  235. endef
  236. define QT5BASE_INSTALL_STAGING_CMDS
  237. $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install
  238. $(QT5_LA_PRL_FILES_FIXUP)
  239. $(QT5BASE_INSTALL_QT_CONF)
  240. endef
  241. define QT5BASE_INSTALL_TARGET_LIBS
  242. for lib in $(QT5BASE_INSTALL_LIBS_y); do \
  243. cp -dpf $(STAGING_DIR)/usr/lib/lib$${lib}.so.* $(TARGET_DIR)/usr/lib || exit 1 ; \
  244. done
  245. endef
  246. define QT5BASE_INSTALL_TARGET_PLUGINS
  247. if [ -d $(STAGING_DIR)/usr/lib/qt/plugins/ ] ; then \
  248. mkdir -p $(TARGET_DIR)/usr/lib/qt/plugins ; \
  249. cp -dpfr $(STAGING_DIR)/usr/lib/qt/plugins/* $(TARGET_DIR)/usr/lib/qt/plugins ; \
  250. fi
  251. endef
  252. ifeq ($(BR2_PACKAGE_QT5_VERSION_5_6),y)
  253. define QT5BASE_INSTALL_TARGET_FONTS
  254. if [ -d $(STAGING_DIR)/usr/lib/fonts/ ] ; then \
  255. mkdir -p $(TARGET_DIR)/usr/lib/fonts ; \
  256. cp -dpfr $(STAGING_DIR)/usr/lib/fonts/* $(TARGET_DIR)/usr/lib/fonts ; \
  257. fi
  258. endef
  259. endif
  260. define QT5BASE_INSTALL_TARGET_EXAMPLES
  261. if [ -d $(STAGING_DIR)/usr/lib/qt/examples/ ] ; then \
  262. mkdir -p $(TARGET_DIR)/usr/lib/qt/examples ; \
  263. cp -dpfr $(STAGING_DIR)/usr/lib/qt/examples/* $(TARGET_DIR)/usr/lib/qt/examples ; \
  264. fi
  265. endef
  266. ifeq ($(BR2_STATIC_LIBS),y)
  267. define QT5BASE_INSTALL_TARGET_CMDS
  268. $(QT5BASE_INSTALL_TARGET_FONTS)
  269. $(QT5BASE_INSTALL_TARGET_EXAMPLES)
  270. endef
  271. else
  272. define QT5BASE_INSTALL_TARGET_CMDS
  273. $(QT5BASE_INSTALL_TARGET_LIBS)
  274. $(QT5BASE_INSTALL_TARGET_PLUGINS)
  275. $(QT5BASE_INSTALL_TARGET_FONTS)
  276. $(QT5BASE_INSTALL_TARGET_EXAMPLES)
  277. endef
  278. endif
  279. $(eval $(generic-package))