1*4882a593Smuzhiyun################################################################################ 2*4882a593Smuzhiyun# WAF package infrastructure 3*4882a593Smuzhiyun# 4*4882a593Smuzhiyun# This file implements an infrastructure that eases development of package 5*4882a593Smuzhiyun# .mk files for WAF packages. It should be used for all packages that use 6*4882a593Smuzhiyun# WAF 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 WAF 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 WAF behaviour. The package can also define some 19*4882a593Smuzhiyun# post operation hooks. 20*4882a593Smuzhiyun# 21*4882a593Smuzhiyun################################################################################ 22*4882a593Smuzhiyun 23*4882a593Smuzhiyun################################################################################ 24*4882a593Smuzhiyun# inner-waf-package -- defines how the configuration, compilation and 25*4882a593Smuzhiyun# installation of a waf package should be done, implements a few hooks 26*4882a593Smuzhiyun# to tune the build process for waf specifities and calls the generic 27*4882a593Smuzhiyun# package infrastructure to generate the necessary make targets 28*4882a593Smuzhiyun# 29*4882a593Smuzhiyun# argument 1 is the lowercase package name 30*4882a593Smuzhiyun# argument 2 is the uppercase package name, including a HOST_ prefix 31*4882a593Smuzhiyun# for host packages 32*4882a593Smuzhiyun# argument 3 is the uppercase package name, without the HOST_ prefix 33*4882a593Smuzhiyun# for host packages 34*4882a593Smuzhiyun# argument 4 is the type (target or host) 35*4882a593Smuzhiyun################################################################################ 36*4882a593Smuzhiyun 37*4882a593Smuzhiyundefine inner-waf-package 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun# We need host-python3 to run waf 40*4882a593Smuzhiyun$(2)_DEPENDENCIES += host-python3 41*4882a593Smuzhiyun 42*4882a593Smuzhiyun$(2)_NEEDS_EXTERNAL_WAF ?= NO 43*4882a593Smuzhiyun 44*4882a593Smuzhiyun# If the package does not have its own waf, use our own. 45*4882a593Smuzhiyunifeq ($$($(2)_NEEDS_EXTERNAL_WAF),YES) 46*4882a593Smuzhiyun$(2)_DEPENDENCIES += host-waf 47*4882a593Smuzhiyun$(2)_WAF = $$(HOST_DIR)/bin/waf 48*4882a593Smuzhiyunelse 49*4882a593Smuzhiyun$(2)_WAF ?= ./waf 50*4882a593Smuzhiyunendif 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun$(2)_BUILD_OPTS ?= 53*4882a593Smuzhiyun$(2)_INSTALL_STAGING_OPTS ?= 54*4882a593Smuzhiyun$(2)_INSTALL_TARGET_OPTS ?= 55*4882a593Smuzhiyun$(2)_WAF_OPTS ?= 56*4882a593Smuzhiyun 57*4882a593Smuzhiyun# 58*4882a593Smuzhiyun# Configure step. Only define it if not already defined by the package 59*4882a593Smuzhiyun# .mk file. 60*4882a593Smuzhiyun# 61*4882a593Smuzhiyunifndef $(2)_CONFIGURE_CMDS 62*4882a593Smuzhiyundefine $(2)_CONFIGURE_CMDS 63*4882a593Smuzhiyun cd $$($$(PKG)_SRCDIR) && \ 64*4882a593Smuzhiyun $$(TARGET_CONFIGURE_OPTS) \ 65*4882a593Smuzhiyun $$($(2)_CONF_ENV) \ 66*4882a593Smuzhiyun $$(HOST_DIR)/bin/python3 $$($(2)_WAF) configure \ 67*4882a593Smuzhiyun --prefix=/usr \ 68*4882a593Smuzhiyun --libdir=/usr/lib \ 69*4882a593Smuzhiyun $$($(2)_CONF_OPTS) \ 70*4882a593Smuzhiyun $$($(2)_WAF_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 cd $$($$(PKG)_SRCDIR) && \ 81*4882a593Smuzhiyun $$(TARGET_MAKE_ENV) $$(HOST_DIR)/bin/python3 $$($(2)_WAF) \ 82*4882a593Smuzhiyun build -j $$(PARALLEL_JOBS) $$($(2)_BUILD_OPTS) \ 83*4882a593Smuzhiyun $$($(2)_WAF_OPTS) 84*4882a593Smuzhiyunendef 85*4882a593Smuzhiyunendif 86*4882a593Smuzhiyun 87*4882a593Smuzhiyun# 88*4882a593Smuzhiyun# Staging installation step. Only define it if not already defined by 89*4882a593Smuzhiyun# the package .mk file. 90*4882a593Smuzhiyun# 91*4882a593Smuzhiyunifndef $(2)_INSTALL_STAGING_CMDS 92*4882a593Smuzhiyundefine $(2)_INSTALL_STAGING_CMDS 93*4882a593Smuzhiyun cd $$($$(PKG)_SRCDIR) && \ 94*4882a593Smuzhiyun $$(TARGET_MAKE_ENV) $$(HOST_DIR)/bin/python3 $$($(2)_WAF) \ 95*4882a593Smuzhiyun install --destdir=$$(STAGING_DIR) \ 96*4882a593Smuzhiyun $$($(2)_INSTALL_STAGING_OPTS) \ 97*4882a593Smuzhiyun $$($(2)_WAF_OPTS) 98*4882a593Smuzhiyunendef 99*4882a593Smuzhiyunendif 100*4882a593Smuzhiyun 101*4882a593Smuzhiyun# 102*4882a593Smuzhiyun# Target installation step. Only define it if not already defined by 103*4882a593Smuzhiyun# the package .mk file. 104*4882a593Smuzhiyun# 105*4882a593Smuzhiyunifndef $(2)_INSTALL_TARGET_CMDS 106*4882a593Smuzhiyundefine $(2)_INSTALL_TARGET_CMDS 107*4882a593Smuzhiyun cd $$($$(PKG)_SRCDIR) && \ 108*4882a593Smuzhiyun $$(TARGET_MAKE_ENV) $$(HOST_DIR)/bin/python3 $$($(2)_WAF) \ 109*4882a593Smuzhiyun install --destdir=$$(TARGET_DIR) \ 110*4882a593Smuzhiyun $$($(2)_INSTALL_TARGET_OPTS) \ 111*4882a593Smuzhiyun $$($(2)_WAF_OPTS) 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# waf-package -- the target generator macro for WAF packages 123*4882a593Smuzhiyun################################################################################ 124*4882a593Smuzhiyun 125*4882a593Smuzhiyunwaf-package = $(call inner-waf-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target) 126