-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwurf_default_prefix.py
51 lines (42 loc) · 1.62 KB
/
wurf_default_prefix.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python
# encoding: utf-8
import os
import waflib
"""
As a default, we would like binaries to be installed in the project folder.
Typically our libraries are not consumed by system package managers, but just
developers who need easy access to the compiled libraries and includes.
"""
def options(opt):
# By default, we install to the "{PROJECT_NAME}_install" folder in
# the local project folder.
#
# The user can change this using the --destdir option, e.g.:
#
# python waf install --destdir=/path/to/target/folder
group = opt.option_groups["Configuration options"]
# First, we override the default destdir value
project_dir = opt.srcnode.abspath()
appname = getattr(waflib.Context.g_module, "APPNAME")
default_destdir = os.path.join(project_dir, appname + "_install")
group.remove_option("--destdir")
group.add_option(
"--destdir",
help="installation root [default: %r]" % default_destdir,
default=default_destdir,
dest="destdir",
)
# Second, we set the default prefix value to ''
# Any non-empty prefix would interfere with the custom destdir, and
# the prefix value can only be changed during the waf configure step,
# since waf determines the installation path as follows:
# target_path = Options.options.destdir + self.env.PREFIX + dest
# Therefore, it is best to use an empty prefix.
default_prefix = ""
group.remove_option("--prefix")
group.add_option(
"--prefix",
dest="prefix",
default=default_prefix,
help="installation prefix [default: %r]" % default_prefix,
)