Fedora (at least Fedora 22) has a yum package for waf, so you could see that it's possible to do a system install of waf, albeit with a hack.
After you run something like python3 ./waf-light configure build
, you'll get a file called waf
that's actually a Python script with some binary data at the end. If you put it into /usr/bin
and run it as non-root, you'll get an error because it fails to create a directory in /usr/bin. If you run it as root, you'll get the new directory and /usr/bin/waf
runs normally.
Here's the trick that I learned from examining the find_lib()
function in the waf Python script.
- Copy the
waf
to /usr/bin/waf
- As root, run
/usr/bin/waf
. Notice that it creates a directory. You'll see something like /usr/bin/.waf-2.0.19-b2f63c807a4215294bf6005410c74c18
- mv that directory to /usr/lib, dropping the
.
in the directory name, e.g. mv /usr/bin/.waf-2.0.19-b2f63c807a4215294bf6005410c74c18 /usr/lib/waf-2.0.19-b2f63c807a4215294bf6005410c74c18
- If you want to use waf with Python3, repeat Steps 2-3 running the Python script
/usr/bin/waf
under Python3. Under Python3, the directory names will start with .waf3-
/waf3-
instead instead of .waf-
/waf-
.
- (Optional) Remove the binary data at the end of
/usr/bin/waf
.
- Now, non-root should be able to just use
/usr/bin/waf
.
That said, here's something to consider, like what another answer said: I believe waf's author intended waf to be embedded in projects so that each project can use its own version of waf without fear that a project will fail to build when there are newer versions of waf. Thus, the one-global-version use case seems to be not officially supported.