1 ################################################################################
3 # waf.cygclass - functions for building Waf-based packages
5 # Part of cygport - Cygwin packaging application
6 # Copyright (C) 2006-2020 Cygport authors
7 # Provided by the Cygwin project <https://cygwin.com/>
9 # cygport is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
14 # cygport is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with cygport. If not, see <https://www.gnu.org/licenses/>.
22 ################################################################################
24 #****h* Cygclasses/waf.cygclass
28 # Waf is a general-purpose build system written in Python used by XMMS2, a
29 # few GTK+ programs, and some other projects. The build system is provided
30 # by a bundled 'waf' script in the top source directory, and is driven
31 # by a 'wscript' file in the top source directory and 'wscript_build' files
32 # in subdirectories, both of which are also written in Python.
34 # Previous versions uses to allow use of a system installed waf. This is no
35 # longer supported, as waf does not have a stable API and is therefore not
36 # feasibly used in this way. Fortunately, by now most packages do include
37 # a recent enough waf to build properly with at most only patches to 'wscript'
38 # and/or 'wscript_build' files.
43 # cross-compiling is not (yet?) supported
44 __cross_compiling_error
46 #****d* waf.cygclass/WAF
48 # Path to the Waf command.
53 #****C* waf.cygclass/waf_compile
55 # waf_compile [OPTIONS]
57 # Runs 'waf configure' to configure the package, followed by 'waf build' to
58 # compile it. WAF_CONFIGURE_FLAGS and WAF_BUILD_FLAGS can be defined to pass
59 # additional arguments to the configure and build commands, respectively.
60 # Any arguments to waf_compile are passed as configure flags to the 'waf
61 # configure' command. waf_compile must be run from the directory containing
67 error "waf_compile: wscript: file not found"
70 #****v* waf_compile/WAF_CONFIGURE_FLAGS
72 # String containing additional arguments to pass to 'waf configure'.
75 --prefix=$(__host_prefix) \
76 ${WAF_CONFIGURE_FLAGS} ${@} \
77 || error "waf configure failed"
79 #****v* waf_compile/WAF_BUILD_FLAGS
81 # String containing additional arguments to pass to 'waf build'.
83 ${WAF} build ${_nproc} ${WAF_BUILD_FLAGS} || error "waf build failed"
86 #****T* waf.cygclass/waf_test
88 # Runs the package's test suite with 'waf check'. WAF_TEST_FLAGS can be
89 # defined to pass additional arguments to the check command. Any arguments
90 # to waf_test are passed as well. waf_test must be run from the directory
91 # containing 'wscript'.
96 error "waf_install: wscript: file not found"
99 #****v* waf_test/WAF_TEST_FLAGS
101 # String containing additional arguments to pass to 'waf check'.
103 ${WAF} check -k ${WAF_TEST_FLAGS} ${@} || true
106 #****I* waf.cygclass/waf_install
108 # Installs the package into $D with 'waf install'. WAF_INSTALL_FLAGS can be
109 # defined to pass additional arguments to the install command. Any arguments
110 # to waf_install are passed as well. waf_install must be run from the directory
111 # containing 'wscript'.
116 error "waf_install: wscript: file not found"
119 #****v* waf_install/WAF_INSTALL_FLAGS
121 # String containing additional arguments to pass to 'waf install'.
123 ${WAF} install --destdir=${D} ${WAF_INSTALL_FLAGS} ${@} || error "waf install failed"
126 #****o* waf.cygclass/src_compile (waf)
135 #****o* waf.cygclass/src_install (waf)
143 readonly -f waf_compile waf_test waf_install