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