qt5base.mk 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. #############################################################
  2. #
  3. # qt5base
  4. #
  5. #############################################################
  6. QT5BASE_VERSION = $(QT5_VERSION)
  7. QT5BASE_SITE = http://releases.qt-project.org/qt5/$(QT5BASE_VERSION)/submodules_tar/
  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. # We have to use --enable-linuxfb, otherwise Qt thinks that -linuxfb
  56. # is to add a link against the "inuxfb" library.
  57. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_GUI),-gui,-no-gui)
  58. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_WIDGETS),-widgets,-no-widgets)
  59. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_LINUXFB),--enable-linuxfb,-no-linuxfb)
  60. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_DIRECTFB),-directfb,-no-directfb)
  61. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_DIRECTFB),directfb)
  62. ifeq ($(BR2_PACKAGE_QT5BASE_XCB),y)
  63. QT5BASE_CONFIGURE_OPTS += -xcb
  64. QT5BASE_DEPENDENCIES += \
  65. libxcb \
  66. xcb-util-wm \
  67. xcb-util-image \
  68. xcb-util-keysyms \
  69. xlib_libX11
  70. else
  71. QT5BASE_CONFIGURE_OPTS += -no-xcb
  72. endif
  73. ifeq ($(BR2_PACKAGE_QT5BASE_EGLFS),y)
  74. QT5BASE_CONFIGURE_OPTS += -opengl es2 -eglfs
  75. QT5BASE_DEPENDENCIES += libgles libegl
  76. ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
  77. QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES = \
  78. $(@D)/mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp
  79. endif
  80. else
  81. QT5BASE_CONFIGURE_OPTS += -no-opengl -no-eglfs
  82. endif
  83. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_OPENSSL),-openssl,-no-openssl)
  84. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_OPENSSL),openssl)
  85. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_FONTCONFIG),-fontconfig,-no-fontconfig)
  86. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_FONTCONFIG),fontconfig)
  87. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_GIF),,-no-gif)
  88. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_JPEG),-system-libjpeg,-no-libjpeg)
  89. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_JPEG),jpeg)
  90. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_PNG),-system-libpng,-no-libpng)
  91. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_PNG),libpng)
  92. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_DBUS),-dbus,-no-dbus)
  93. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_DBUS),dbus)
  94. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_LIBGLIB2),-glib,-no-glib)
  95. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBGLIB2),libglib2)
  96. QT5BASE_CONFIGURE_OPTS += $(if $(BR2_PACKAGE_QT5BASE_ICU),-icu,-no-icu)
  97. QT5BASE_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5BASE_ICU),icu)
  98. # Build the list of libraries to be installed on the target
  99. QT5BASE_INSTALL_LIBS_y += Qt5Core
  100. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_NETWORK) += Qt5Network
  101. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_CONCURRENT) += Qt5Concurrent
  102. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_SQL) += Qt5Sql
  103. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_TEST) += Qt5Test
  104. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_XML) += Qt5Xml
  105. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_GUI) += Qt5Gui
  106. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_WIDGETS) += Qt5Widgets
  107. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_PRINTSUPPORT) += Qt5PrintSupport
  108. QT5BASE_INSTALL_LIBS_$(BR2_PACKAGE_QT5BASE_DBUS) += Qt5DBus
  109. # Ideally, we could use -device-option to substitute variable values
  110. # in our linux-buildroot-g++/qmake.config, but this mechanism doesn't
  111. # nicely support variable values that contain spaces. So we use the
  112. # good old sed solution here.
  113. define QT5BASE_CONFIG_SET
  114. $(SED) 's%^$(1).*%$(1) = $(2)%g' $(@D)/mkspecs/devices/linux-buildroot-g++/qmake.conf
  115. endef
  116. define QT5BASE_CONFIGURE_CMDS
  117. $(call QT5BASE_CONFIG_SET,BUILDROOT_CROSS_COMPILE,$(TARGET_CROSS))
  118. $(call QT5BASE_CONFIG_SET,BUILDROOT_COMPILER_CFLAGS,$(TARGET_CFLAGS))
  119. $(call QT5BASE_CONFIG_SET,BUILDROOT_COMPILER_CXXFLAGS,$(TARGET_CXXFLAGS))
  120. $(call QT5BASE_CONFIG_SET,BUILDROOT_INCLUDE_PATH,$(STAGING_DIR)/usr/include)
  121. $(call QT5BASE_CONFIG_SET,EGLFS_PLATFORM_HOOKS_SOURCES, \
  122. $(QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES))
  123. (cd $(@D); \
  124. PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
  125. PKG_CONFIG_LIBDIR="$(STAGING_DIR)/usr/lib/pkgconfig" \
  126. PKG_CONFIG_SYSROOT_DIR="$(STAGING_DIR)" \
  127. MAKEFLAGS="$(MAKEFLAGS) -j$(PARALLEL_JOBS)" \
  128. ./configure \
  129. -v \
  130. -prefix /usr \
  131. -hostprefix $(HOST_DIR)/usr \
  132. -sysroot $(STAGING_DIR) \
  133. -plugindir /usr/lib/qt/plugins \
  134. -no-rpath \
  135. -nomake examples -nomake demos -nomake tests \
  136. -device buildroot \
  137. -no-c++11 \
  138. $(QT5BASE_CONFIGURE_OPTS) \
  139. )
  140. endef
  141. define QT5BASE_BUILD_CMDS
  142. $(MAKE) -C $(@D)
  143. endef
  144. define QT5BASE_INSTALL_STAGING_CMDS
  145. $(MAKE) -C $(@D) install
  146. $(QT5_LA_PRL_FILES_FIXUP)
  147. endef
  148. define QT5BASE_INSTALL_TARGET_LIBS
  149. for lib in $(QT5BASE_INSTALL_LIBS_y); do \
  150. cp -dpf $(STAGING_DIR)/usr/lib/lib$${lib}.so.* $(TARGET_DIR)/usr/lib ; \
  151. done
  152. endef
  153. define QT5BASE_INSTALL_TARGET_PLUGINS
  154. if [ -d $(STAGING_DIR)/usr/lib/qt/plugins/ ] ; then \
  155. mkdir -p $(TARGET_DIR)/usr/lib/qt/plugins ; \
  156. cp -dpfr $(STAGING_DIR)/usr/lib/qt/plugins/* $(TARGET_DIR)/usr/lib/qt/plugins ; \
  157. fi
  158. endef
  159. define QT5BASE_INSTALL_TARGET_FONTS
  160. if [ -d $(STAGING_DIR)/usr/lib/fonts/ ] ; then \
  161. mkdir -p $(TARGET_DIR)/usr/lib/fonts ; \
  162. cp -dpfr $(STAGING_DIR)/usr/lib/fonts/* $(TARGET_DIR)/usr/lib/fonts ; \
  163. fi
  164. endef
  165. ifeq ($(BR2_PREFER_STATIC_LIB),y)
  166. define QT5BASE_INSTALL_TARGET_CMDS
  167. $(QT5BASE_INSTALL_TARGET_FONTS)
  168. endef
  169. else
  170. define QT5BASE_INSTALL_TARGET_CMDS
  171. $(QT5BASE_INSTALL_TARGET_LIBS)
  172. $(QT5BASE_INSTALL_TARGET_PLUGINS)
  173. $(QT5BASE_INSTALL_TARGET_FONTS)
  174. endef
  175. endif
  176. $(eval $(generic-package))