Reputation: 29066
I have cloned and built the waf
script using:
./waf-light configure
Then to build my project (provided by Gomspace) I need to add waf
and the eclipse.py
to my path. So far I haven't found better than this setenv
script:
WAFROOT=~/git/waf/
export PYTHONPATH=$WAFROOT/waflib/extras/:$PYTHONPATH
export PATH=~/git/waf/:$PATH
Called with:
source setenv
This is somehow a pretty ugly solution. Is there a more elegant way to install waf?
Upvotes: 6
Views: 18685
Reputation: 1968
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.
waf
to /usr/bin/waf
/usr/bin/waf
. Notice that it creates a directory. You'll see something like /usr/bin/.waf-2.0.19-b2f63c807a4215294bf6005410c74c18
.
in the directory name, e.g. mv /usr/bin/.waf-2.0.19-b2f63c807a4215294bf6005410c74c18 /usr/lib/waf-2.0.19-b2f63c807a4215294bf6005410c74c18
/usr/bin/waf
under Python3. Under Python3, the directory names will start with .waf3-
/waf3-
instead instead of .waf-
/waf-
./usr/bin/waf
./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.
Upvotes: 1
Reputation: 20354
You don't install waf. The command you found correctly builds waf: /waf-light configure build
Then for each project you create, you put the built waf
script into that projects root directory. I can't find a reference, but this is the way in which waf:s primary author Thomas Nagy wants the tool to be used. Projects that repackage waf to make the tool installable aren't "officially sanctioned."
There are advantages and disadvantages with non-installation:
Disadvantages:
waf
file to your repository.Advantages:
Upvotes: 5