qt5base.mk 9.2 KB

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