python-cryptography: bump to version 1.7.2
[buildroot-gz.git] / package / pkg-waf.mk
blob2cdd654b1b7283f83815a9cf19775f19434008f0
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
9 # infrastructure
11 # In terms of implementation, this WAF infrastructure requires the .mk file
12 # to only specify metadata information about the package: name, version,
13 # download URL, etc.
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
31 # for host packages
32 # argument 3 is the uppercase package name, without the HOST_ prefix
33 # for host packages
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
48 else
49 $(2)_WAF = ./waf
50 endif
52 $(2)_BUILD_OPTS ?=
53 $(2)_INSTALL_STAGING_OPTS ?=
54 $(2)_INSTALL_TARGET_OPTS ?=
55 $(2)_WAF_OPTS ?=
58 # Configure step. Only define it if not already defined by the package
59 # .mk file.
61 ifndef $(2)_CONFIGURE_CMDS
62 define $(2)_CONFIGURE_CMDS
63 cd $$(@D) && \
64 $$(TARGET_CONFIGURE_OPTS) \
65 $$($(2)_CONF_ENV) \
66 $$(HOST_DIR)/usr/bin/python2 $$($(2)_WAF) configure \
67 --prefix=/usr \
68 --libdir=/usr/lib \
69 $$($(2)_CONF_OPTS) \
70 $$($(2)_WAF_OPTS)
71 endef
72 endif
75 # Build step. Only define it if not already defined by the package .mk
76 # file.
78 ifndef $(2)_BUILD_CMDS
79 define $(2)_BUILD_CMDS
80 cd $$(@D) && \
81 $$(TARGET_MAKE_ENV) $$(HOST_DIR)/usr/bin/python2 $$($(2)_WAF) \
82 build -j $$(PARALLEL_JOBS) $$($(2)_BUILD_OPTS) \
83 $$($(2)_WAF_OPTS)
84 endef
85 endif
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
93 cd $$(@D) && \
94 $$(TARGET_MAKE_ENV) $$(HOST_DIR)/usr/bin/python2 $$($(2)_WAF) \
95 install --destdir=$$(STAGING_DIR) \
96 $$($(2)_INSTALL_STAGING_OPTS) \
97 $$($(2)_WAF_OPTS)
98 endef
99 endif
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
107 cd $$(@D) && \
108 $$(TARGET_MAKE_ENV) $$(HOST_DIR)/usr/bin/python2 $$($(2)_WAF) \
109 install --destdir=$$(TARGET_DIR) \
110 $$($(2)_INSTALL_TARGET_OPTS) \
111 $$($(2)_WAF_OPTS)
112 endef
113 endif
115 # Call the generic package infrastructure to generate the necessary
116 # make targets
117 $(call inner-generic-package,$(1),$(2),$(3),$(4))
119 endef
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)