1################################################################################ 2# QMake package infrastructure 3# 4# This file implements an infrastructure that eases development of package 5# .mk files for QMake packages. It should be used for all packages that use 6# Qmake as their build system. 7# 8# See the Buildroot documentation for details on the usage of this 9# infrastructure 10# 11# In terms of implementation, this QMake infrastructure requires the .mk file 12# to only specify metadata information about the package: name, version, 13# download URL, etc. 14# 15# We still allow the package .mk file to override what the different steps 16# are doing, if needed. For example, if <PKG>_BUILD_CMDS is already defined, 17# it is used as the list of commands to perform to build the package, 18# instead of the default QMake behaviour. The package can also define some 19# post operation hooks. 20# 21################################################################################ 22 23# 24# Hook to sync Qt headers 25# 26define QT_HEADERS_SYNC_HOOK 27 sed -e '/^MODULE_VERSION/s/5\.15\.[3456789]/$(QT5_VERSION)/' -i \ 28 $($(PKG)_BUILDDIR)/.qmake.conf 29 touch $($(PKG)_BUILDDIR)/.git 30endef 31 32################################################################################ 33# inner-qmake-package -- defines how the configuration, compilation and 34# installation of a qmake package should be done, implements a few hooks 35# to tune the build process for qmake specifities and calls the generic 36# package infrastructure to generate the necessary make targets 37# 38# argument 1 is the lowercase package name 39# argument 2 is the uppercase package name, including a HOST_ prefix 40# for host packages 41################################################################################ 42 43define inner-qmake-package 44 45$(2)_INSTALL_STAGING_OPTS ?= install 46$(2)_INSTALL_TARGET_OPTS ?= $$($(2)_INSTALL_STAGING_OPTS) 47 48ifneq ($(1),qt5base) 49$(2)_DEPENDENCIES += qt5base 50endif 51 52ifeq ($$($(2)_SYNC_QT_HEADERS),YES) 53$(2)_PRE_CONFIGURE_HOOKS += QT_HEADERS_SYNC_HOOK 54endif 55 56$(2)_POST_PREPARE_HOOKS += QT5_QT_CONF_FIXUP 57 58# 59# Configure step. Only define it if not already defined by the package 60# .mk file. 61# 62ifndef $(2)_CONFIGURE_CMDS 63define $(2)_CONFIGURE_CMDS 64 cd $$($(2)_BUILDDIR) && \ 65 $$(TARGET_MAKE_ENV) $$($(2)_CONF_ENV) $$(QT5_QMAKE) $$($(2)_CONF_OPTS) 66endef 67endif 68 69# 70# Build step. Only define it if not already defined by the package .mk 71# file. 72# 73ifndef $(2)_BUILD_CMDS 74define $(2)_BUILD_CMDS 75 $$(TARGET_MAKE_ENV) $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_BUILDDIR) $$($(2)_MAKE_OPTS) 76endef 77endif 78 79# 80# Staging installation step. Only define it if not already defined by 81# the package .mk file. 82# 83ifndef $(2)_INSTALL_STAGING_CMDS 84define $(2)_INSTALL_STAGING_CMDS 85 $$(TARGET_MAKE_ENV) $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_BUILDDIR) $$($(2)_INSTALL_STAGING_OPTS) 86endef 87endif 88 89# 90# Target installation step. Only define it if not already defined by 91# the package .mk file. 92# 93# Unfortunately we can't use INSTALL_ROOT to directly install to TARGET_DIR 94# because in a crosscompile setup, the qmake generated install destinations 95# are prefixed with the hardcoded sysroot (=STAGING_DIR) and hostprefix 96# (=HOST_DIR). 97# Instead we set INSTALL_ROOT, which comes before the install path, to a 98# temporary folder inside the build directory and effectively install to 99# $(@D)/tmp-target-install/$(STAGING_DIR) and $(@D)/tmp-target-install/$(HOST_DIR). 100# We subsequently rsync only the files from the temporary staging dir and that 101# way exclude files for the build host from target. 102# 103ifndef $(2)_INSTALL_TARGET_CMDS 104define $(2)_INSTALL_TARGET_CMDS 105 $$(TARGET_MAKE_ENV) $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_BUILDDIR) INSTALL_ROOT=$$($(2)_BUILDDIR)tmp-target-install $$($(2)_INSTALL_TARGET_OPTS) 106 rsync -arv $$($(2)_BUILDDIR)tmp-target-install$$(STAGING_DIR)/ $$(TARGET_DIR)/ 107endef 108endif 109 110# Call the generic package infrastructure to generate the necessary 111# make targets 112$(call inner-generic-package,$(1),$(2),$(3),$(4)) 113 114endef 115 116################################################################################ 117# qmake-package -- the target generator macro for QMake packages 118################################################################################ 119 120qmake-package = $(call inner-qmake-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target) 121