wscript: make prefix vs destdir installing more safe and predictable
This commit is contained in:
parent
b72033eb74
commit
cf557d191a
1 changed files with 9 additions and 2 deletions
11
wscript
11
wscript
|
@ -10,6 +10,7 @@ import os
|
||||||
VERSION = '0.99'
|
VERSION = '0.99'
|
||||||
APPNAME = 'xash3d-fwgs'
|
APPNAME = 'xash3d-fwgs'
|
||||||
top = '.'
|
top = '.'
|
||||||
|
default_prefix = '/' # Waf uses it to set default prefix
|
||||||
|
|
||||||
Context.Context.line_just = 55 # should fit for everything on 80x26
|
Context.Context.line_just = 55 # should fit for everything on 80x26
|
||||||
|
|
||||||
|
@ -427,12 +428,14 @@ int main(int argc, char **argv) { strchrnul(argv[1], 'x'); return 0; }'''
|
||||||
check_gnu_function(strchrnul_frag, 'Checking for strchrnul', 'HAVE_STRCHRNUL')
|
check_gnu_function(strchrnul_frag, 'Checking for strchrnul', 'HAVE_STRCHRNUL')
|
||||||
|
|
||||||
# indicate if we are packaging for Linux/BSD
|
# indicate if we are packaging for Linux/BSD
|
||||||
|
conf.env.PACKAGING = conf.options.PACKAGING
|
||||||
if conf.options.PACKAGING:
|
if conf.options.PACKAGING:
|
||||||
|
conf.env.PREFIX = conf.options.prefix
|
||||||
conf.env.LIBDIR = conf.env.BINDIR = conf.env.LIBDIR + '/xash3d'
|
conf.env.LIBDIR = conf.env.BINDIR = conf.env.LIBDIR + '/xash3d'
|
||||||
conf.env.SHAREDIR = '${PREFIX}/share/xash3d'
|
conf.env.SHAREDIR = '${PREFIX}/share/xash3d'
|
||||||
else:
|
else:
|
||||||
if sys.platform != 'win32' and conf.env.DEST_OS != 'android':
|
if conf.options.prefix != default_prefix:
|
||||||
conf.env.PREFIX = '/'
|
conf.fatal('--prefix option makes no sense without --enable-packaging!')
|
||||||
|
|
||||||
conf.env.SHAREDIR = conf.env.LIBDIR = conf.env.BINDIR = conf.env.PREFIX
|
conf.env.SHAREDIR = conf.env.LIBDIR = conf.env.BINDIR = conf.env.PREFIX
|
||||||
|
|
||||||
|
@ -457,6 +460,10 @@ int main(void){ return !opus_custom_encoder_init(0, 0, 0); }''', fatal = False):
|
||||||
conf.add_subproject(i.name)
|
conf.add_subproject(i.name)
|
||||||
|
|
||||||
def build(bld):
|
def build(bld):
|
||||||
|
# guard rails to not let install to root
|
||||||
|
if bld.is_install and not bld.options.PACKAGING and not bld.options.destdir:
|
||||||
|
bld.fatal('Set the install destination directory using --destdir option')
|
||||||
|
|
||||||
# don't clean QtCreator files and reconfigure saved options
|
# don't clean QtCreator files and reconfigure saved options
|
||||||
bld.clean_files = bld.bldnode.ant_glob('**',
|
bld.clean_files = bld.bldnode.ant_glob('**',
|
||||||
excl='*.user configuration.py .lock* *conf_check_*/** config.log %s/*' % Build.CACHE_DIR,
|
excl='*.user configuration.py .lock* *conf_check_*/** config.log %s/*' % Build.CACHE_DIR,
|
||||||
|
|
Loading…
Add table
Reference in a new issue