qt5base.mk 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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-kms \
  21. -no-cups \
  22. -no-nis \
  23. -no-libudev \
  24. -no-iconv \
  25. -no-gstreamer \
  26. -no-gtkstyle \
  27. -system-zlib \
  28. -system-pcre \
  29. -no-pch
  30. ifeq ($(BR2_ENABLE_DEBUG),y)
  31. QT5BASE_CONFIGURE_OPTS += -debug
  32. else
  33. QT5BASE_CONFIGURE_OPTS += -release
  34. endif
  35. ifeq ($(BR2_PREFER_STATIC_LIB),y)
  36. QT5BASE_CONFIGURE_OPTS += -static
  37. else
  38. # We apparently can't build both the shared and static variants of the
  39. # library.
  40. QT5BASE_CONFIGURE_OPTS += -shared
  41. endif
  42. ifeq ($(BR2_LARGEFILE),y)
  43. QT5BASE_CONFIGURE_OPTS += -largefile
  44. else
  45. QT5BASE_CONFIGURE_OPTS += -no-largefile
  46. endif
  47. ifeq ($(BR2_PACKAGE_QT5BASE_LICENSE_APPROVED),y)
  48. QT5BASE_CONFIGURE_OPTS += -opensource -confirm-license
  49. QT5BASE_LICENSE = LGPLv2.1 or GPLv3.0
  50. QT5BASE_LICENSE_FILES = LICENSE.GPL LICENSE.LGPL LGPL_EXCEPTION.txt
  51. else
  52. QT5BASE_LICENSE = Commercial license
  53. QT5BASE_REDISTRIBUTE = NO
  54. endif
  55. # Qt5 SQL Plugins
  56. ifeq ($(BR2_PACKAGE_QT5BASE_SQL),y)
  57. ifeq ($(BR2_PACKAGE_QT5BASE_MYSQL),y)
  58. QT5BASE_CONFIGURE_OPTS += -plugin-sql-mysql -mysql_config $(STAGING_DIR)/usr/bin/mysql_config
  59. QT5BASE_DEPENDENCIES += mysql_client
  60. else
  61. QT5BASE_CONFIGURE_OPTS += -no-sql-mysql
  62. endif
  63. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_SQLITE_QT),-plugin-sql-sqlite)
  64. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_SQLITE_SYSTEM),-system-sqlite)
  65. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_SQLITE_SYSTEM),sqlite)
  66. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_SQLITE_NONE),-no-sql-sqlite)
  67. endif
  68. # We have to use --enable-linuxfb, otherwise Qt thinks that -linuxfb
  69. # is to add a link against the "inuxfb" library.
  70. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_GUI),-gui,-no-gui)
  71. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_WIDGETS),-widgets,-no-widgets)
  72. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_LINUXFB),--enable-linuxfb,-no-linuxfb)
  73. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_DIRECTFB),-directfb,-no-directfb)
  74. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_DIRECTFB),directfb)
  75. ifeq ($(BR2_PACKAGE_QT5BASE_XCB),y)
  76. QT5BASE_CONFIGURE_OPTS += -xcb
  77. QT5BASE_DEPENDENCIES += \
  78. libxcb \
  79. xcb-util-wm \
  80. xcb-util-image \
  81. xcb-util-keysyms \
  82. xlib_libX11
  83. else
  84. QT5BASE_CONFIGURE_OPTS += -no-xcb
  85. endif
  86. ifeq ($(BR2_PACKAGE_QT5BASE_EGLFS),y)
  87. QT5BASE_CONFIGURE_OPTS += -opengl es2 -eglfs
  88. QT5BASE_DEPENDENCIES += libgles libegl
  89. ifeq ($(BR2_PACKAGE_GPU_VIV_BIN_MX6Q),y)
  90. QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES = \
  91. $(@D)/mkspecs/devices/linux-imx6-g++/qeglfshooks_imx6.cpp
  92. endif
  93. ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
  94. QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES = \
  95. $(@D)/mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp
  96. endif
  97. else
  98. QT5BASE_CONFIGURE_OPTS += -no-opengl -no-eglfs
  99. endif
  100. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_OPENSSL),-openssl,-no-openssl)
  101. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_OPENSSL),openssl)
  102. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_FONTCONFIG),-fontconfig,-no-fontconfig)
  103. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_FONTCONFIG),fontconfig)
  104. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_GIF),,-no-gif)
  105. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_JPEG),-system-libjpeg,-no-libjpeg)
  106. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_JPEG),jpeg)
  107. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_PNG),-system-libpng,-no-libpng)
  108. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_PNG),libpng)
  109. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_DBUS),-dbus,-no-dbus)
  110. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_DBUS),dbus)
  111. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_LIBGLIB2),-glib,-no-glib)
  112. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBGLIB2),libglib2)
  113. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_ICU),-icu,-no-icu)
  114. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_ICU),icu)
  115. # Build the list of libraries to be installed on the target
  116. QT5BASE_INSTALL_LIBS_y += Qt5Core
  117. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_NETWORK) += Qt5Network
  118. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_CONCURRENT) += Qt5Concurrent
  119. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_SQL) += Qt5Sql
  120. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_TEST) += Qt5Test
  121. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_XML) += Qt5Xml
  122. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_EGLFS) += Qt5OpenGL
  123. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_GUI) += Qt5Gui
  124. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_WIDGETS) += Qt5Widgets
  125. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_PRINTSUPPORT) += Qt5PrintSupport
  126. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_DBUS) += Qt5DBus
  127. # Ideally, we could use -device-option to substitute variable values
  128. # in our linux-buildroot-g++/qmake.config, but this mechanism doesn't
  129. # nicely support variable values that contain spaces. So we use the
  130. # good old sed solution here.
  131. define QT5BASE_CONFIG_SET
  132. $(SED) 's%^$(1).*%$(1) = $(2)%g' $(@D)/mkspecs/devices/linux-buildroot-g++/qmake.conf
  133. endef
  134. define QT5BASE_CONFIGURE_CMDS
  135. $(call QT5BASE_CONFIG_SET,BUILDROOT_CROSS_COMPILE,$(TARGET_CROSS))
  136. $(call QT5BASE_CONFIG_SET,BUILDROOT_COMPILER_CFLAGS,$(TARGET_CFLAGS))
  137. $(call QT5BASE_CONFIG_SET,BUILDROOT_COMPILER_CXXFLAGS,$(TARGET_CXXFLAGS))
  138. $(call QT5BASE_CONFIG_SET,BUILDROOT_INCLUDE_PATH,$(STAGING_DIR)/usr/include)
  139. $(call QT5BASE_CONFIG_SET,EGLFS_PLATFORM_HOOKS_SOURCES, \
  140. $(QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES))
  141. (cd $(@D); \
  142. PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
  143. PKG_CONFIG_LIBDIR="$(STAGING_DIR)/usr/lib/pkgconfig" \
  144. PKG_CONFIG_SYSROOT_DIR="$(STAGING_DIR)" \
  145. MAKEFLAGS="$(MAKEFLAGS) -j$(PARALLEL_JOBS)" \
  146. ./configure \
  147. -v \
  148. -prefix /usr \
  149. -hostprefix $(HOST_DIR)/usr \
  150. -sysroot $(STAGING_DIR) \
  151. -plugindir /usr/lib/qt/plugins \
  152. -no-rpath \
  153. -nomake examples -nomake demos -nomake tests \
  154. -device buildroot \
  155. -no-c++11 \
  156. $(QT5BASE_CONFIGURE_OPTS) \
  157. )
  158. endef
  159. define QT5BASE_BUILD_CMDS
  160. $(MAKE) -C $(@D)
  161. endef
  162. define QT5BASE_INSTALL_STAGING_CMDS
  163. $(MAKE) -C $(@D) install
  164. $(QT5_LA_PRL_FILES_FIXUP)
  165. endef
  166. define QT5BASE_INSTALL_TARGET_LIBS
  167. for lib in $(QT5BASE_INSTALL_LIBS_y); do \
  168. cp -dpf $(STAGING_DIR)/usr/lib/lib$${lib}.so.* $(TARGET_DIR)/usr/lib ; \
  169. done
  170. endef
  171. define QT5BASE_INSTALL_TARGET_PLUGINS
  172. if [ -d $(STAGING_DIR)/usr/lib/qt/plugins/ ] ; then \
  173. mkdir -p $(TARGET_DIR)/usr/lib/qt/plugins ; \
  174. cp -dpfr $(STAGING_DIR)/usr/lib/qt/plugins/* $(TARGET_DIR)/usr/lib/qt/plugins ; \
  175. fi
  176. endef
  177. define QT5BASE_INSTALL_TARGET_FONTS
  178. if [ -d $(STAGING_DIR)/usr/lib/fonts/ ] ; then \
  179. mkdir -p $(TARGET_DIR)/usr/lib/fonts ; \
  180. cp -dpfr $(STAGING_DIR)/usr/lib/fonts/* $(TARGET_DIR)/usr/lib/fonts ; \
  181. fi
  182. endef
  183. ifeq ($(BR2_PREFER_STATIC_LIB),y)
  184. define QT5BASE_INSTALL_TARGET_CMDS
  185. $(QT5BASE_INSTALL_TARGET_FONTS)
  186. endef
  187. else
  188. define QT5BASE_INSTALL_TARGET_CMDS
  189. $(QT5BASE_INSTALL_TARGET_LIBS)
  190. $(QT5BASE_INSTALL_TARGET_PLUGINS)
  191. $(QT5BASE_INSTALL_TARGET_FONTS)
  192. endef
  193. endif
  194. $(eval $(generic-package))