1 ################################################################################
2 # WAF package infrastructure
4 # This file implements an infrastructure that eases development of package
5 # .mk files for WAF packages. It should be used for all packages that use
6 # WAF as their build system.
8 # See the Buildroot documentation for details on the usage of this
11 # In terms of implementation, this WAF infrastructure requires the .mk file
12 # to only specify metadata information about the package: name, version,
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 WAF behaviour. The package can also define some
19 # post operation hooks.
21 ################################################################################
23 ################################################################################
24 # inner-waf-package -- defines how the configuration, compilation and
25 # installation of a waf package should be done, implements a few hooks
26 # to tune the build process for waf specifities and calls the generic
27 # package infrastructure to generate the necessary make targets
29 # argument 1 is the lowercase package name
30 # argument 2 is the uppercase package name, including a HOST_ prefix
32 # argument 3 is the uppercase package name, without the HOST_ prefix
34 # argument 4 is the type (target or host)
35 ################################################################################
37 define inner-waf-package
39 # We need host-python to run waf
40 $(2)_DEPENDENCIES
+= host-python
42 $(2)_NEEDS_EXTERNAL_WAF ?
= NO
44 # If the package does not have its own waf, use our own.
45 ifeq ($$($(2)_NEEDS_EXTERNAL_WAF
),YES
)
46 $(2)_DEPENDENCIES
+= host-waf
47 $(2)_WAF
= $(HOST_DIR
)/usr
/bin
/waf
53 $(2)_INSTALL_STAGING_OPTS ?
=
54 $(2)_INSTALL_TARGET_OPTS ?
=
58 # Configure step. Only define it if not already defined by the package
61 ifndef $(2)_CONFIGURE_CMDS
62 define $(2)_CONFIGURE_CMDS
64 $$(TARGET_CONFIGURE_OPTS
) \
66 $$(HOST_DIR
)/usr
/bin
/python2
$$($(2)_WAF
) configure \
75 # Build step. Only define it if not already defined by the package .mk
78 ifndef $(2)_BUILD_CMDS
79 define $(2)_BUILD_CMDS
81 $$(TARGET_MAKE_ENV
) $$(HOST_DIR
)/usr
/bin
/python2
$$($(2)_WAF
) \
82 build
-j
$$(PARALLEL_JOBS
) $$($(2)_BUILD_OPTS
) \
88 # Staging installation step. Only define it if not already defined by
89 # the package .mk file.
91 ifndef $(2)_INSTALL_STAGING_CMDS
92 define $(2)_INSTALL_STAGING_CMDS
94 $$(TARGET_MAKE_ENV
) $$(HOST_DIR
)/usr
/bin
/python2
$$($(2)_WAF
) \
95 install --destdir
=$$(STAGING_DIR
) \
96 $$($(2)_INSTALL_STAGING_OPTS
) \
102 # Target installation step. Only define it if not already defined by
103 # the package .mk file.
105 ifndef $(2)_INSTALL_TARGET_CMDS
106 define $(2)_INSTALL_TARGET_CMDS
108 $$(TARGET_MAKE_ENV
) $$(HOST_DIR
)/usr
/bin
/python2
$$($(2)_WAF
) \
109 install --destdir
=$$(TARGET_DIR
) \
110 $$($(2)_INSTALL_TARGET_OPTS
) \
115 # Call the generic package infrastructure to generate the necessary
117 $(call inner-generic-package
,$(1),$(2),$(3),$(4))
121 ################################################################################
122 # waf-package -- the target generator macro for WAF packages
123 ################################################################################
125 waf-package
= $(call inner-waf-package
,$(pkgname
),$(call UPPERCASE
,$(pkgname
)),$(call UPPERCASE
,$(pkgname
)),target
)