diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-05-29 22:55:02 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-05-29 22:55:02 +0400 |
commit | 9a79e03752509997e99094763f9183e6e5ce3637 (patch) | |
tree | 2096689cf63cbc352debea29e8d5192910c7e2d5 /build_files/scons | |
parent | 88fd394dba6078b93310658f2f51c2a05594966b (diff) |
Various fixes to scons for linux:
* Better handling of "multiarch" python stuff (libs also need two different paths).
* Fix Opencollada default paths.
Hopefully this won't break anything...
Diffstat (limited to 'build_files/scons')
-rw-r--r-- | build_files/scons/config/Modules/FindPython.py | 27 | ||||
-rw-r--r-- | build_files/scons/config/linux-config.py | 7 | ||||
-rw-r--r-- | build_files/scons/tools/btools.py | 3 |
3 files changed, 25 insertions, 12 deletions
diff --git a/build_files/scons/config/Modules/FindPython.py b/build_files/scons/config/Modules/FindPython.py index 01215753cf7..03e15349da5 100644 --- a/build_files/scons/config/Modules/FindPython.py +++ b/build_files/scons/config/Modules/FindPython.py @@ -7,6 +7,8 @@ def FindPython(): abi_flags = "m" # Most common for linux distros version = "3.3" + _arch = "x86_64-linux-gnu" + # Determine ABI flags used on this system include = os.path.join(python, "include") for cur_flags in all_abi_flags: @@ -16,10 +18,8 @@ def FindPython(): break # Find config.h. In some distros, such as ubuntu 12.10 they are not in standard include dir. - incconf64 = os.path.join(include, "x86_64-linux-gnu", "python" + version + cur_flags, "pyconfig.h") - if os.path.exists(incconf64): - incconf = os.path.join(include, "x86_64-linux-gnu", "python" + version + cur_flags) - else: + incconf = os.path.join(include, _arch, "python" + version + cur_flags) + if not os.path.exists(os.path.join(incconf, "pyconfig.h")): incconf = '' # Determine whether python is in /usr/lib or /usr/lib64 @@ -33,8 +33,19 @@ def FindPython(): # roll back to default value libpath = "${BF_PYTHON}/lib" - return {'PYTHON': python, + libpath_arch = libpath + _libpath_arch = os.path.join(python, "lib", _arch) # No lib64 stuff with recent deb-like distro afaik... + _libs = ["libpython" + version + abi_flags + ext for ext in (".so", ".a")] + for l in _libs: + print os.path.join(libpath, l), os.path.exists(os.path.join(libpath, l)) + print os.path.join(_libpath_arch, l), os.path.exists(os.path.join(_libpath_arch, l)) + if not os.path.exists(os.path.join(libpath, l)) and os.path.exists(os.path.join(_libpath_arch, l)): + libpath_arch = os.path.join(libpath, _arch) + break + + return {"PYTHON": python, "VERSION": version, - 'LIBPATH': libpath, - 'ABI_FLAGS': abi_flags, - 'CONFIG': incconf} + "LIBPATH": libpath, + "LIBPATH_ARCH": libpath_arch, + "ABI_FLAGS": abi_flags, + "CONFIG": incconf} diff --git a/build_files/scons/config/linux-config.py b/build_files/scons/config/linux-config.py index 2aec75edb08..418d2ef41b8 100644 --- a/build_files/scons/config/linux-config.py +++ b/build_files/scons/config/linux-config.py @@ -5,6 +5,7 @@ py = FindPython() BF_PYTHON_ABI_FLAGS = py['ABI_FLAGS'] BF_PYTHON = py['PYTHON'] BF_PYTHON_LIBPATH = py['LIBPATH'] +BF_PYTHON_LIBPATH_ARCH = py['LIBPATH_ARCH'] BF_PYTHON_CONFIG = py['CONFIG'] BF_PYTHON_VERSION = py['VERSION'] WITH_BF_STATICPYTHON = False @@ -12,7 +13,7 @@ BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}${BF_PYTHON_ABI_ BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}' BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}' # BF_PYTHON+'/lib/python'+BF_PYTHON_VERSION+'/config/libpython'+BF_PYTHON_VERSION+'.a' BF_PYTHON_LINKFLAGS = ['-Xlinker', '-export-dynamic'] -BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/libpython${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}.a' +BF_PYTHON_LIB_STATIC = '${BF_PYTHON_LIBPATH_ARCH}/libpython${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}.a' WITH_BF_OPENAL = True WITH_BF_STATICOPENAL = False @@ -160,9 +161,9 @@ BF_COLLADA = '#source/blender/collada' BF_COLLADA_INC = '${BF_COLLADA}' BF_COLLADA_LIB = 'bf_collada' BF_OPENCOLLADA = '/usr' -BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}' +BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include/opencollada' BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver pcre buffer ftoa' -BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib' +BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada' BF_PCRE = '' BF_PCRE_LIB = 'pcre' BF_PCRE_LIBPATH = '/usr/lib' diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py index aeb4a33eea9..b8d036d9a84 100644 --- a/build_files/scons/tools/btools.py +++ b/build_files/scons/tools/btools.py @@ -96,7 +96,7 @@ def print_arguments(args, bc): def validate_arguments(args, bc): opts_list = [ - 'WITH_BF_FREESTYLE', 'WITH_BF_PYTHON', 'WITH_BF_PYTHON_SAFETY', 'BF_PYTHON', 'BF_PYTHON_VERSION', 'BF_PYTHON_INC', 'BF_PYTHON_BINARY', 'BF_PYTHON_LIB', 'BF_PYTHON_LIBPATH', 'WITH_BF_STATICPYTHON', 'WITH_OSX_STATICPYTHON', 'BF_PYTHON_LIB_STATIC', 'BF_PYTHON_DLL', 'BF_PYTHON_ABI_FLAGS', + 'WITH_BF_FREESTYLE', 'WITH_BF_PYTHON', 'WITH_BF_PYTHON_SAFETY', 'BF_PYTHON', 'BF_PYTHON_VERSION', 'BF_PYTHON_INC', 'BF_PYTHON_BINARY', 'BF_PYTHON_LIB', 'BF_PYTHON_LIBPATH', 'BF_PYTHON_LIBPATH_ARCH', 'WITH_BF_STATICPYTHON', 'WITH_OSX_STATICPYTHON', 'BF_PYTHON_LIB_STATIC', 'BF_PYTHON_DLL', 'BF_PYTHON_ABI_FLAGS', 'WITH_BF_OPENAL', 'BF_OPENAL', 'BF_OPENAL_INC', 'BF_OPENAL_LIB', 'BF_OPENAL_LIBPATH', 'WITH_BF_STATICOPENAL', 'BF_OPENAL_LIB_STATIC', 'WITH_BF_SDL', 'BF_SDL', 'BF_SDL_INC', 'BF_SDL_LIB', 'BF_SDL_LIBPATH', 'WITH_BF_JACK', 'BF_JACK', 'BF_JACK_INC', 'BF_JACK_LIB', 'BF_JACK_LIBPATH', 'WITH_BF_JACK_DYNLOAD', @@ -259,6 +259,7 @@ def read_opts(env, cfg, args): ('BF_PYTHON_INC', 'Include path for Python headers', ''), ('BF_PYTHON_BINARY', 'Path to the Python interpreter', ''), ('BF_PYTHON_LIB', 'Python library', ''), + ('BF_PYTHON_LIBPATH_ARCH', 'Additional Python library under some linux flavors (arch-dependent)', ''), ('BF_PYTHON_DLL', 'Python dll - used on Windows only', ''), ('BF_PYTHON_LIB_STATIC', 'Python static libraries', ''), ('BF_PYTHON_LIBPATH', 'Library path', ''), |