aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2020-04-12 19:40:08 +0300
committerGitHub <noreply@github.com>2020-04-12 19:40:08 +0300
commitf695359e1d487deaada8db61694cc24f10985580 (patch)
tree24945e551de3e9090f32c366f5b0f667d9b233c2
parentfa1bb2a67649ee730387a6b3a4f030933b4573fb (diff)
parentba7b50a1045e6a57710137dd856e031ca5e96566 (diff)
downloadmeson-f695359e1d487deaada8db61694cc24f10985580.zip
meson-f695359e1d487deaada8db61694cc24f10985580.tar.gz
meson-f695359e1d487deaada8db61694cc24f10985580.tar.bz2
Merge pull request #6958 from jon-turney/fix-name-prefix-explicit-default
Fix library(name_prefix: [])
-rw-r--r--docs/markdown/Reference-manual.md8
-rw-r--r--mesonbuild/build.py13
-rw-r--r--test cases/common/206 install name_prefix name_suffix/meson.build3
-rw-r--r--test cases/common/206 install name_prefix name_suffix/test.json5
4 files changed, 18 insertions, 11 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md
index 033c1c5..5156b5b 100644
--- a/docs/markdown/Reference-manual.md
+++ b/docs/markdown/Reference-manual.md
@@ -1191,9 +1191,9 @@ The keyword arguments for this are the same as for
- `name_prefix` the string that will be used as the prefix for the
target output filename by overriding the default (only used for
- libraries). By default this is `lib` on all platforms and compilers
- except with MSVC shared libraries where it is omitted to follow
- convention.
+ libraries). By default this is `lib` on all platforms and compilers,
+ except for MSVC shared libraries where it is omitted to follow
+ convention, and Cygwin shared libraries where it is `cyg`.
- `name_suffix` the string that will be used as the suffix for the
target output filename by overriding the default (see also:
[executable()](#executable)). By default, for shared libraries this
@@ -1201,7 +1201,7 @@ The keyword arguments for this are the same as for
For static libraries, it is `a` everywhere. By convention MSVC
static libraries use the `lib` suffix, but we use `a` to avoid a
potential name clash with shared libraries which also generate
- `xxx.lib` import files.
+ import libraries with a `lib` suffix.
- `rust_crate_type` specifies the crate type for Rust
libraries. Defaults to `dylib` for shared libraries and `rlib` for
static libraries.
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 616a183..b1bf9d4 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -922,16 +922,17 @@ This will become a hard error in a future Meson release.''')
name_prefix = kwargs['name_prefix']
if isinstance(name_prefix, list):
if name_prefix:
- raise InvalidArguments('name_prefix array must be empty to signify null.')
- elif not isinstance(name_prefix, str):
- raise InvalidArguments('name_prefix must be a string.')
- self.prefix = name_prefix
- self.name_prefix_set = True
+ raise InvalidArguments('name_prefix array must be empty to signify default.')
+ else:
+ if not isinstance(name_prefix, str):
+ raise InvalidArguments('name_prefix must be a string.')
+ self.prefix = name_prefix
+ self.name_prefix_set = True
if 'name_suffix' in kwargs:
name_suffix = kwargs['name_suffix']
if isinstance(name_suffix, list):
if name_suffix:
- raise InvalidArguments('name_suffix array must be empty to signify null.')
+ raise InvalidArguments('name_suffix array must be empty to signify default.')
else:
if not isinstance(name_suffix, str):
raise InvalidArguments('name_suffix must be a string.')
diff --git a/test cases/common/206 install name_prefix name_suffix/meson.build b/test cases/common/206 install name_prefix name_suffix/meson.build
index 4539999..044f915 100644
--- a/test cases/common/206 install name_prefix name_suffix/meson.build
+++ b/test cases/common/206 install name_prefix name_suffix/meson.build
@@ -8,3 +8,6 @@ static_library('qux', 'libfile.c', name_suffix: 'cheese', install : true)
shared_library('corge', 'libfile.c', name_prefix: 'bow', name_suffix: 'stern', install : true)
static_library('grault', 'libfile.c', name_prefix: 'bow', name_suffix: 'stern', install : true)
+
+# exercise default name_prefix and name_suffix
+shared_library('garply', 'libfile.c', name_prefix: [], name_suffix: [], install : true)
diff --git a/test cases/common/206 install name_prefix name_suffix/test.json b/test cases/common/206 install name_prefix name_suffix/test.json
index 63032bc..b92a985 100644
--- a/test cases/common/206 install name_prefix name_suffix/test.json
+++ b/test cases/common/206 install name_prefix name_suffix/test.json
@@ -11,6 +11,9 @@
{"type": "implib", "file": "usr/lib/foo"},
{"type": "expr", "file": "usr/lib/foo?so"},
{"type": "implib", "file": "usr/lib/libbaz"},
- {"type": "file", "file": "usr/lib/libqux.cheese"}
+ {"type": "file", "file": "usr/lib/libqux.cheese"},
+ {"type": "expr", "file": "usr/?lib/libgarply?so"},
+ {"type": "implib", "file": "usr/lib/libgarply"},
+ {"type": "pdb", "file": "usr/bin/garply"}
]
}