From 6d7b020aa2443ff77d490660c52bffdb2f8e879c Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Wed, 27 Jul 2016 14:39:31 +0530 Subject: [PATCH 1/3] ninja: Fix static library installation dir Trivially correct typo fix. Didn't actually break anything because the fallback is libdir anyway, and we always install static libraries to libdir. Pointed out by Zhe Wang (0x1997). --- mesonbuild/backend/ninjabackend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index ab5bc4902..15f298b1e 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -516,7 +516,7 @@ int dummy; [], False, ''] d.targets.append(i) outdir = self.environment.get_shared_lib_dir() - elif isinstance(t, build.SharedLibrary): + elif isinstance(t, build.StaticLibrary): outdir = self.environment.get_static_lib_dir() elif isinstance(t, build.Executable): outdir = self.environment.get_bindir() From a2344d5aa6c27d1c5d8a11dd3713e5bd49127c5a Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Wed, 27 Jul 2016 14:46:21 +0530 Subject: [PATCH 2/3] Test that the 'libdir' project() option works --- test cases/common/8 install/installed_files.txt | 2 +- test cases/common/8 install/meson.build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test cases/common/8 install/installed_files.txt b/test cases/common/8 install/installed_files.txt index 3bc66ab87..cbbdc0301 100644 --- a/test cases/common/8 install/installed_files.txt +++ b/test cases/common/8 install/installed_files.txt @@ -1,2 +1,2 @@ usr/bin/prog?exe -usr/lib/libstat.a +usr/libtest/libstat.a diff --git a/test cases/common/8 install/meson.build b/test cases/common/8 install/meson.build index 92ff3a0e2..12ad38948 100644 --- a/test cases/common/8 install/meson.build +++ b/test cases/common/8 install/meson.build @@ -1,4 +1,4 @@ -project('install test', 'c') +project('install test', 'c', default_options : ['libdir=libtest']) stlib = static_library('stat', 'stat.c', install : true) exe = executable('prog', 'prog.c', install : true) From 10ab88710bfcd444a1e0621e007b71d7ddbe3302 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sat, 30 Jul 2016 19:14:27 +0300 Subject: [PATCH 3/3] Determine lib paths on demand rather than up front because they might change during build file parsing. --- mesonbuild/environment.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index a105cb855..637593808 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -128,6 +128,9 @@ class Environment(): self.coredata = coredata.load(cdf) self.first_invocation = False except FileNotFoundError: + # WARNING: Don't use any values from coredata in __init__. It gets + # re-initialized with project options by the interpreter during + # build file parsing. self.coredata = coredata.CoreData(options) self.coredata.meson_script_file = self.meson_script_file self.first_invocation = True @@ -159,14 +162,11 @@ class Environment(): or (cross and self.cross_info.has_host() and self.cross_info.config['host_machine']['system'] == 'windows'): self.exe_suffix = 'exe' self.object_suffix = 'obj' - self.shared_lib_dir = self.get_bindir() + self.win_libdir_layout = True else: self.exe_suffix = '' self.object_suffix = 'o' - self.shared_lib_dir = self.get_libdir() - # Common to all platforms - self.import_lib_dir = self.get_libdir() - self.static_lib_dir = self.get_libdir() + self.win_libdir_layout = False def is_cross_build(self): return self.cross_info is not None @@ -661,15 +661,17 @@ class Environment(): def get_import_lib_dir(self): "Install dir for the import library (library used for linking)" - return self.import_lib_dir + return self.get_libdir() def get_shared_lib_dir(self): "Install dir for the shared library" - return self.shared_lib_dir + if self.win_libdir_layout: + return self.get_bindir() + return self.get_libdir() def get_static_lib_dir(self): "Install dir for the static library" - return self.static_lib_dir + return self.get_libdir() def get_object_suffix(self): return self.object_suffix