Commit Graph

14425 Commits

Author SHA1 Message Date
Eli Schwartz c166b136a6
Suppress LLVM static test on Arch
It is properly detected as unavailable, ever since commit
d1b783fc69
2024-02-09 13:54:58 -05:00
Sam James 7e8b7454f5
test cases: use C++17 for protobuf because of abseil-cpp
On the openSUSE builder, we got a horrifying CI failure like:
```
FAILED: asubdir/subdir-prog.p/main.cpp.o
c++ -Iasubdir/subdir-prog.p -Iasubdir '-I../test cases/frameworks/5 protocol buffers/asubdir' -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++14 -O0 -g -DPROTOBUF_USE_DLLS -DNOMINMAX -MD -MQ asubdir/subdir-prog.p/main.cpp.o -MF asubdir/subdir-prog.p/main.cpp.o.d -o asubdir/subdir-prog.p/main.cpp.o -c '../test cases/frameworks/5 protocol buffers/asubdir/main.cpp'
In file included from /usr/include/google/protobuf/stubs/common.h:20,
                 from /usr/include/google/protobuf/io/coded_stream.h:107,
                 from asubdir/subdir-prog.p/defs.pb.h:26,
                 from ../test cases/frameworks/5 protocol buffers/asubdir/main.cpp:1:
/usr/include/absl/strings/string_view.h:52:26: error: ‘string_view’ in namespace ‘std’ does not name a type
   52 | using string_view = std::string_view;
      |                          ^~~~~~~~~~~
[...]
```

This turns out to be because of a *huge* mess with abseil-cpp and protobuf. We're
still trying to handle it in Gentoo, even (see bgo#912819) and https://github.com/gentoo/gentoo/pull/32281.

In summary, abseil-cpp started to require C++17 (unless built with a special option
which causes ABI problems). Let's switch the protobuf test case to use C++17
accordingly. There's some precedence for Just Doing This, like in cb54f0d707
recently for Boost, and 792a84199b previously for
protobuf itself.

Bug: https://bugs.gentoo.org/912819
See also: https://github.com/gentoo/gentoo/pull/32281
Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
2024-02-09 13:54:16 -05:00
Sam James 7d8b925144
ci: fedora; add file package
FAILED unittests/linuxliketests.py::LinuxlikeTests::test_install_strip - FileNotFoundError: [Errno 2] No such file or directory: 'file'

Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
2024-02-09 13:54:15 -05:00
Sam James fe8123b484
ci: add Gentoo
We may want to consider our own binpkg cache for future to speed things up,
in addition to the ones provided by Gentoo's own binhost.

Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
2024-02-09 13:54:01 -05:00
Tristan Partin 87ba248404 Mark the bash completion files for bash and zsh as Shell files
This will add highlighting when viewing on GitHub.
2024-02-09 22:26:46 +05:30
Tristan Partin 4ea51e1b25 Continue fleshing out bash completion script
This adds bash completion to everything that I could think of except for
the rewriter.
2024-02-09 22:26:46 +05:30
Tristan Partin b08d531c02 Document that alias_target accepts run_tgts since 0.60.0
This was implemented in dc51740e2c,
but was not added to the documentation or marked as a new feature.
2024-02-09 11:56:13 -05:00
Nirbheek Chauhan 09c0803077 wraps: Ignore whitespace when applying diff_file
Fixes https://github.com/mesonbuild/meson/issues/12092
2024-02-09 21:04:31 +05:30
Nirbheek Chauhan 348c2e93d2 Revert "Wrap: Use git instead of patch by default"
This reverts commit 718c86a7d5.

We can't always use git to apply patches because they might actually
apply to a git submodule inside a git subproject, and git will not be
able to apply the patch in that case.
2024-02-09 21:04:31 +05:30
Ole André Vadla Ravnås e0d83359aa find_tool: fix error message interpolation 2024-02-08 15:28:18 -08:00
Sam James d1b783fc69
cmake: improve heuristics for static LLVM detection
In 89146e84c9, a heuristic was introduced where
if libLLVMSupport is available as a static library, LLVM itself is assumed
to be availble as a static library as a whole.

This is unfortunately not the case at least on Gentoo and Arch Linux, where
a subsequent llvm-config call yields:
```
$ /usr/lib/llvm/17/bin/llvm-config --libfiles --link-static
llvm-config: error: missing: /usr/lib/llvm/17/lib64/libLLVMTargetParser.a
llvm-config: error: missing: /usr/lib/llvm/17/lib64/libLLVMBinaryFormat.a
llvm-config: error: missing: /usr/lib/llvm/17/lib64/libLLVMBitstreamReader.a
llvm-config: error: missing: /usr/lib/llvm/17/lib64/libLLVMRemarks.a
[...]
```

On Gentoo, where LLVM's static libraries are not included, we still have:
```
$ equery f llvm:17 | grep -i lib64/.*.a$
/usr/lib/llvm/17/lib64/libLLVMDemangle.a
/usr/lib/llvm/17/lib64/libLLVMSupport.a
/usr/lib/llvm/17/lib64/libLLVMTableGen.a
/usr/lib/llvm/17/lib64/libLLVMTestingAnnotations.a
/usr/lib/llvm/17/lib64/libLLVMTestingSupport.a
/usr/lib/llvm/17/lib64/libllvm_gtest.a
/usr/lib/llvm/17/lib64/libllvm_gtest_main.a
```

Therefore, testing for libLLVMSupport is insufficient. We now try libLLVMCore
instead, as that appears to only be installed when LLVM truly has static libraries
available. libLLVMCore is handled as a LLVM component which gives us some guarantee
this is supposed to be happening and not a fluke.

(Specifically, LLVM's llvm/lib/Support/CMakeLists.txt pays 0 attention to
-DLLVM_BUILD_LLVM_DYLIB and -DLLVM_LINK_LLVM_DYLIB, and is hence only affected
by -DBUILD_SHARED_LIBS, which LLVM upstream say is only to be used for development.

Therefore, with -DBUILD_SHARED_LIBS=OFF (as is recommended/the default) and
-DLLVM_BUILD_LLVM_DYLIB=ON, you will get a static libLLVMSupport, without it
indicating anything about the rest of your configuration.)

Closes: https://github.com/mesonbuild/meson/issues/12323
Fixes: 89146e84c9
Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
2024-02-07 23:41:37 -05:00
Sam James 369cc28e59
Fix comment typos
Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
2024-02-07 23:41:36 -05:00
Sam James 99ea390af8
cmake: canonicalise -DSTATIC value
CMake really prefers ON/OFF and in some cases, depending on how the condition
is written, ON/OFF vs other "truthy" (as far as CMake's lang supports) values
work differently. Just be safe and use ON/OFF.

Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
2024-02-07 23:41:35 -05:00
Charles Brunet 9659a8e6cf Fix minsize optimization for vs backend
Fixes #12265
2024-02-07 02:40:51 +05:30
Ralf Gommers 80ed1dfa7f Add a numpy dependency with pkg-config and configtool methods
These are being added for NumPy 2.0 The implementation closely follows
the one for the pybind11 dependency.
2024-02-06 12:54:35 -08:00
H. Vetinari 6fcf8632c6 fix UnboundLocalError if guess_win_linker fails in detect_fortran_compiler 2024-02-02 09:24:41 -08:00
Eli Schwartz cb54f0d707
test cases: pass the c++11 std to boost-using code
Apple Clang defaults to C++03 or earlier, and boost 1.84 has started
requiring C++11 as a minimum. Fixes test failures on the macOS builders.

Unneeded for GCC systems since GCC defaults to a more recent std -- but
also semantically correct there too.
2024-02-01 10:25:27 -05:00
Eli Schwartz b50dd0607d
CI: mark hdf5 as inaccessible on macOS with config-tool instead of pkg-config
It is broken with the cmake build. With the previous commit, it now
shows the former as UNEXSKIP instead of ERROR.
2024-01-31 23:12:30 -05:00
Eli Schwartz f5da446bb9
dependencies: hdf5: mark configtool dependency not-found for cmake build
When hdf5 is built with cmake instead of autotools, it makes a number of
weird changes. What we care about in particular is that h5cc exists but
doesn't work -- it happily ignores -show and tries to compile stuff,
then leaves us with a dependency that has no libraries, and fails when
running `ninja`.

See: #12748
2024-01-31 21:40:14 -05:00
Dylan Baker 55d30b61ff rust: Add `--extern proc_macro` in `rust.proc_macro() not in cargo translation
Cargo does this by default, so it's reasonable that we do the same.

Fixes: #12758
2024-01-30 10:58:14 -08:00
Eli Schwartz 708a108cde
python module: correct the embedded path for bytecompiled files
In recursive scanning, a script variable was overwritten that caused the
logic *intended* to make the embedded path be trimmed based on $DESTDIR,
to no longer apply. This resulted in embedding the staging path, but
only when install_subdir() was used instead of specifying each file as
the argument to install_sources.
2024-01-28 01:03:45 -05:00
Dylan Baker 314d9f0c74 Differentiate message between dynamic linker and archiver
Currently both print `Detecting linker via`, which can be confusing.
Clarifying this by printing "archiver" instead of "linker" for the
static linker/archiver
2024-01-26 15:04:58 -05:00
Albert Tang 6e381714c7 xcode: Fix "clean" operation under new build system
Xcode 14 has dropped the legacy build system, forcing us to use the
new one introduced in Xcode 9. The new system requires that we conform
to its "clean build folder" behavior, or clean operations fail.

CMake achieves this by setting other variables instead of SYMROOT, so
we follow that approach while retaining our current behavior as much
as possible.

Ref: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/7730
2024-01-26 00:42:24 -05:00
Albert Tang 02ee167296 xcode: Check custom target input for extracted objects
If there are any specified, the build target that generates them must
be added as a dependency.
2024-01-26 00:42:24 -05:00
Albert Tang df6926250d backends: Make object_filename_from_source() backend-agnostic
Some backends may need to use its own target directories instead of
our default one. For this, introduce an optional argument "targetdir"
that will still use our default one when not specified.
2024-01-26 00:42:24 -05:00
Albert Tang d2740cf0d1 xcode: Autodetect host machine's CPU architecture
Currently, the backend has "x86_64" hardcoded as the architecture,
which breaks cross compiling and compiling normally on arm64. Fix
this by setting it to the host machine's CPU architecture instead.
2024-01-26 00:42:24 -05:00
Charles Brunet d7bf365acd Fix compiler.preprocess compile_args not used
As described in
https://github.com/mesonbuild/meson/issues/12715#issuecomment-1883448780,
the compiler.preprocess function ignores compile_args. This should fix
it in both ninja and visualstudio backends.
2024-01-25 11:06:56 -08:00
Sune Vuorela a9f9f03490
docs: Use common conventions for shared libs
Use common conventions for documentation of shared library version and
soversion. In general, the numeric version part is expected to be first
component of version, so suggest this in the example code.
2024-01-25 13:43:54 -05:00
Dylan Baker adc8d6bae4 interpreter: replace mock keyword argument with unittest.mock
Python provides some nifty tools for mocking, without relying on
altering running code. We should use these to simplify the actual run
paths and move the complicated logic into tests.
2024-01-25 10:01:50 -08:00
Dylan Baker 37883e7d5f modules/fs: use ModuleState object instead of Interpreter when possible 2024-01-25 10:01:50 -08:00
Dylan Baker 6bd4f7c10e modules/sourceset: remove unused attributes from SourceSetImpl 2024-01-25 10:01:50 -08:00
Eli Schwartz 5e76e2a7ff
Add missing FeatureNew for meson.add_dist_script
Per the docs, it is available since 0.48.0. Notify about this at runtime
too.

Fixes #12773
2024-01-25 00:33:40 -05:00
Eli Schwartz b2ddcbad0c
docs: add a technically unneeded "setup" verb to some invocations
`meson <options> -Dxxx=yyy` is technically accurate, but does cause
confusion at least some of the time.
2024-01-24 22:41:18 -05:00
andy5995 2936be7e29 docs: Add NetPanzer to User.md 2024-01-24 07:11:42 -05:00
Eli Schwartz 760d8d50b6
docs: fix another regression in having functional docs
In commit 83a973ca04 a bunch of strange
changes were made, that were not even tested. Make sure people get the
correct command for running coverage targets.
2024-01-20 20:37:05 -05:00
Fabian Groffen 33527630f1
linkers_detect: detect xtools (Apple ld64 derivative)
xtools is in use on Gentoo Prefix x86_64 and ppc based Darwin installs.
Pick it up as a valid linker.

Since xtools is answering with a version to --version, as opposed to
ld64, detection of xtools in the ld64 handling block is not possible,
since --version already succeeded.

Bug: https://bugs.gentoo.org/868516
Bug: https://github.com/mesonbuild/meson/issues/10805
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
2024-01-18 14:22:36 -05:00
Sam James 85cfc1fafc
Compilers: pass -Werror to the linker with b_lto
With LTO, the linker will re-execute the compiler and various warnings may
be emitted. We must therefore pass -Werror to the linker as well when -Werror
is enabled to capture these. This is only required / useful with LTO.

Closes: https://github.com/mesonbuild/meson/issues/7360
Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
2024-01-18 02:19:26 -05:00
Stas Sergeev 92f638e1f9 compiler.preprocess: add depends kwarg
This patch adds 'depends' keyword to compiler.preprocess().
It allows to execute other targets before doing the preprocessing.
Test-case is added to demonstrate that functionality: it
generates the header before preprocessing the C source that
uses that generated header.

Thanks to @bruchar1 for getting this patch to work.
2024-01-17 13:37:36 -08:00
Alyssa Ross 1ca2c74d16 rust: fix linking static executables
For the same reason as for static libraries, we have to use -l when
generating static executables.

Fixes: https://github.com/mesonbuild/meson/issues/12585
2024-01-17 13:36:15 -08:00
Peter Urban bd3f1b2e0e fix openmp dependency for clang-cl
- see https://github.com/mesonbuild/meson/issues/5298
2024-01-17 16:35:27 -05:00
Roger Sanders 95cc34b342 Improve project naming and build configuration in genvslite projects
This change fixes two usability issues with the genvslite project
generation. Unlike when using the full VS backend, under genvslite the
ProjectName property wasn't being set for generated projects. This means
projects end up being named according to the project files, which
includes suffixes like "@exe" in the solution, which is undesirable.
This change adds the ProjectName field in for genvslite projects, to
keep the naming consistent with projects under the VS backend.

Additionally, previously under genvslite, no projects were set to build
under any solution configuration by default. This is inconvenient, as
the user has to manually edit the build settings for each solution
configuration before they can compile at the solution level. There was a
note in the code to do something about this. This change enables
compilation at the solution level for the default startup project in the
solution, so the user can now just press F5 to build the solution and
run the default startup project, as they would typically expect.
2024-01-17 16:27:18 -05:00
Jonathon Anderson 3a846ff409 tests: Also test implicit rpaths from dependencies
Meson will implicit rpaths when *.so/*.dll/etc. files are injected onto
the link line from pkg-config and (now) cmake dependencies.
Extend the "prebuilt shared" tests to test that these are added.
2024-01-17 08:42:09 -08:00
Jonathon Anderson 76ad5fe8d3 backend: Add rpath for external versioned .so's
On Linux many .so's are augmented with version information,
e.g. libxyz.so.1.2.3. CMake will happily refer to these versioned .so's
in its dependencies instead of libxyz.so (typically a symlink).
Unfortunately these versioned .so's aren't recognized as libraries by
the Backend's logic to produce build rpaths from library paths.

Fix this by recognizing any .so extension as sufficient reason to
produce a build rpath, not just if .so is the last extension.
2024-01-17 08:42:09 -08:00
Jonathon Anderson 57b7fbb29d backend: Add rpaths for external 'cmake' deps
Fixes https://github.com/mesonbuild/meson/issues/12338
2024-01-17 08:42:09 -08:00
L. E. Segovia 9797f7682b cmake: Fix blunt target filtering skipping GENERATED dependencies
GENERATED files can be used as dependencies for other targets, so it's
misguided (at best) to filter them with a blunt whitelist.

However, there does exist an extension that needs to be skipped: on Windows +
MSVC, CMake will by default try to generate a Visual Studio project, and
there dependencies with no inputs are instead tied to a dummy .rule
input file which is created by the generation step. The fileapi will
still report those, so it will cause Meson to bail out when it realises
there's no such file in the build tree.

Fixes #11607
2024-01-16 11:00:26 -08:00
Simon Ser 0bfe98e7e6 compilers: add c23 and gnu23 c_stds
Closes: https://github.com/mesonbuild/meson/issues/12702
2024-01-15 23:31:52 +02:00
izimuth 1c852f0a98 Add a note for Windows users to GuiTutorial.md
When compiling on Windows using MSVC, you also need to link the SDL2main.lib file. 

I've added a note to the GuiTutorial.md file to mention this.
2024-01-15 20:22:04 +02:00
Valeri ae857e841b
Vala: fixes to gresource handling (#12418)
* Vala: depend on gresources

Valac uses gresource at compile time to look up .ui files

* Automatically pass `--gresourcesdir` to valac

* gnome.compile_resources: clean up duplicate paths better

* Add a test for improved gresouce handling
2024-01-11 17:55:02 +02:00
Sam James a5fdd3771f
compilers: cpp: wire up debugstl for Clang
For Clang, we now pass -D_GLIBCXX_DEBUG=1 if debugstl is enabled, and
we also pass -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG.

Per https://discourse.llvm.org/t/building-a-program-with-d-libcpp-debug-1-against-a-libc-that-is-not-itself-built-with-that-define/59176/3,
we can't use _LIBCPP_DEBUG for older Clang versions as it's unreliable unless
libc++ was built with it.

We choose MODE_DEBUG for stldebug while building with assertions will do
MODE_EXTENSIVE.

Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
2024-01-09 20:49:27 -05:00
byteblob ce2db13e94 ninja: Use platform dependent quote instead of shlex.quote() in gcc_rsp_quote() 2024-01-09 10:40:58 -08:00