From 1404f404f804ddd9d892e813ed23ca222c16ad39 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 8 Jan 2019 11:31:58 -0800 Subject: [PATCH 1/5] docs: document that using environment variables is discouraged [skip ci] --- docs/markdown/Reference-tables.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/markdown/Reference-tables.md b/docs/markdown/Reference-tables.md index fa913f598..fd251112a 100644 --- a/docs/markdown/Reference-tables.md +++ b/docs/markdown/Reference-tables.md @@ -117,6 +117,12 @@ These are the parameter names for passing language specific arguments to your bu These environment variables will be used to modify the compiler and linker flags. +It is recommended that you **do not use these**. They are provided purely to +for backwards compatibility with other build systems. There are many caveats to +their use, especially when rebuilding the project. It is **highly** recommended +that you use [the command line arguments](#language-arguments-parameters-names) +instead. + | Name | Comment | | ----- | ------- | | CFLAGS | Flags for the C compiler | From c1b01d54c2418d9dc29fa1c3779be04ea74c2834 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 8 Jan 2019 11:35:34 -0800 Subject: [PATCH 2/5] docs: Add link args to the table of language args [skip ci] --- docs/markdown/Reference-tables.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/markdown/Reference-tables.md b/docs/markdown/Reference-tables.md index fd251112a..9688bf8d0 100644 --- a/docs/markdown/Reference-tables.md +++ b/docs/markdown/Reference-tables.md @@ -99,18 +99,18 @@ future releases. These are the parameter names for passing language specific arguments to your build target. -| Language | Parameter name | -| ----- | ----- | -| C | c_args | -| C++ | cpp_args | -| C# | cs_args | -| D | d_args | -| Fortran | fortran_args | -| Java | java_args | -| Objective C | objc_args | -| Objective C++ | objcpp_args | -| Rust | rust_args | -| Vala | vala_args | +| Language | compiler name | linker name | +| ------------- | ------------- | ----------------- | +| C | c_args | c_link_args | +| C++ | cpp_args | cpp_link_args | +| C# | cs_args | cs_link_args | +| D | d_args | d_link_args | +| Fortran | fortran_args | fortran_link_args | +| Java | java_args | java_link_args | +| Objective C | objc_args | objc_link_args | +| Objective C++ | objcpp_args | objcpp_link_args | +| Rust | rust_args | rust_link_args | +| Vala | vala_args | vala_link_args | ## Compiler and linker flag environment variables From 4a8e8b710385a221bffd2e0b081ca98f4abb9c07 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 8 Jan 2019 11:38:14 -0800 Subject: [PATCH 3/5] docs: further specify that CFLAGS and friends are only for distro packagers [skip ci] --- docs/markdown/howtox.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/markdown/howtox.md b/docs/markdown/howtox.md index adcec7c33..3d8515ff8 100644 --- a/docs/markdown/howtox.md +++ b/docs/markdown/howtox.md @@ -52,7 +52,9 @@ executable(..., dependencies : thread_dep) ## Set extra compiler and linker flags from the outside (when e.g. building distro packages) -The behavior is the same as with other build systems, with environment variables during first invocation. +The behavior is the same as with other build systems, with environment +variables during first invocation. Do not use these when you need to rebuild +the source ```console $ CFLAGS=-fsomething LDFLAGS=-Wl,--linker-flag meson From bc0bcc37f60793f210eac1d70c27adf81230a73c Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 8 Jan 2019 11:38:40 -0800 Subject: [PATCH 4/5] docs: don't recommend using CFLAGS [skip ci] --- docs/markdown/Quick-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/markdown/Quick-guide.md b/docs/markdown/Quick-guide.md index 549dcfca3..8c6da69b8 100644 --- a/docs/markdown/Quick-guide.md +++ b/docs/markdown/Quick-guide.md @@ -82,7 +82,7 @@ build and install Meson projects are the following. ```console $ cd /path/to/source/root -$ CFLAGS=... CXXFLAGS=... LDFLAGS=.. meson --prefix /usr --buildtype=plain builddir +$ meson --prefix /usr --buildtype=plain builddir -Dc_args=... -Dcpp_args=... -Dc_link_args=... -Dcpp_link_args=... $ ninja -v -C builddir $ ninja -C builddir test $ DESTDIR=/path/to/staging/root ninja -C builddir install From 724c97ef4e8b921dfa7dd76f86efd1d0305723c5 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 8 Jan 2019 11:39:06 -0800 Subject: [PATCH 5/5] docs: recommend add_project_arguments instead of add_global_arguments [skip ci] As autotools doesn't have anything like wraps so it doesn't need to differentiate, but meson does so it should. --- docs/markdown/Porting-from-autotools.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/markdown/Porting-from-autotools.md b/docs/markdown/Porting-from-autotools.md index 5c4c35dc8..b60ecfe59 100644 --- a/docs/markdown/Porting-from-autotools.md +++ b/docs/markdown/Porting-from-autotools.md @@ -450,9 +450,9 @@ AM_CPPFLAGS = \ `meson.build`: ```meson -add_global_arguments('-DG_LOG_DOMAIN="As"', language : 'c') -add_global_arguments('-DAS_COMPILATION', language : 'c') -add_global_arguments('-DLOCALSTATEDIR="/var"', language : 'c') +add_project_arguments('-DG_LOG_DOMAIN="As"', language : 'c') +add_project_arguments('-DAS_COMPILATION', language : 'c') +add_project_arguments('-DLOCALSTATEDIR="/var"', language : 'c') ``` ### Tests