nlohmann is not a dependency#11
Conversation
Matches current flags: https://github.com/NixOS/nix/blob/9cf991f421b20a2c753df1f93730ddc8ddf7af6c/Makefile#L30-L32 Signed-off-by: Pamplemousse <xav.maso@gmail.com>
* seems to have been fixed by NixOS#4947 * change option name to match current `./configure` option * tested by succesfully running `meson compile nixexpr` Signed-off-by: Pamplemousse <xav.maso@gmail.com>
Co-authored-by: Anderson Torres <torres.anderson.85@protonmail.com>
Compiling without Boehm works
Disable `FORTIFY_SOURCE` when not optimizing
Signed-off-by: Pamplemousse <xav.maso@gmail.com>
auto options are better for allowing autodetect, in addition to on and off.
This helps avoid merge conflicts, since git is line-oriented.
The whole point of the `files` function is that it remembers the current directory. Otherwise we could just use plain lists.
Add `meson` to the flake
Meson improvements
Co-authored-by: Lucas Desgouilles <ldesgoui@ldesgoui.xyz>
Co-authored-by: John Ericson <John.Ericson@Obsidian.Systems> Co-authored-by: Pamplemousse <xav.maso@gmail.com>
Signed-off-by: Pamplemousse <xav.maso@gmail.com>
f8e0ad9 to
3067e14
Compare
* build with `meson` is broken (on NixOS) since NixOS#5016 * not linked to the binary anywhere * not listed in the `doc/manual/src/installation/prerequisites-source.md` Signed-off-by: Pamplemousse <xav.maso@gmail.com>
3067e14 to
50ca01f
Compare
|
is nlohmann still included in the build upstream? |
|
the header is still being referrenced in source upstream, i'd strongly recommend committing there first before changing dependency structures on the fork |
| libcmd_inc = [include_directories('.')] | ||
| libcmd_inc = [include_directories( | ||
| '.', | ||
| join_paths('..'), |
There was a problem hiding this comment.
this will cause problems with file inclusion, you cannot chain directories like this in meson, and then append extra directories to the include_directories target; thats the reason its referenced as an array. you should also not use relative paths, its strongly discouraged when creating buildsystem files. please reference the other meson files and model your commits based on them.
There was a problem hiding this comment.
this will cause problems with file inclusion, you cannot chain directories like this in meson, and then append extra directories to the include_directories target;
I don't see the problem it causes...
This is not chaining directories, this is passing several arguments to include_directories.
And BTW, in the documentation, it is said that the include_directories parameters used in library() MUST be an include_directories object (not an array!): https://mesonbuild.com/Reference-manual.html#executable (note that https://mesonbuild.com/Reference-manual.html#library 's documentation states "The keyword arguments for this are the same as for executable with the following additions").
you should also not use relative paths, its strongly discouraged when creating buildsystem files
This is what I get with absolute paths:
src/libutil/meson.build:4:0: ERROR: Tried to form an absolute path to a source dir. You should not do that but use relative paths instead.
please reference the other meson files and model your commits based on them
What do you mean by that?
There was a problem hiding this comment.
once you create an include_directories() target, you cannot append to it. look through the codebase, youll see directories are appended to it per sub directory, instead of at a top level. they are appended to an array which is then passed to the build object; instead of hardcoding all the directories at the top file for that target. using ../ in any capacity causes massive headaches in any buildsystem, and ive lost many hours of work fixing relative paths in MSVC and CMake buildsystems. there is no need to use them, especially in the nix-meson buildsystem, as the .. directory already has a include_directories() target. just reference the already existing target, theres no need to do any kind of path traversal.
There was a problem hiding this comment.
this also breaks header inclusion for build targets. instead of properly inheriting the headers from the build target, it fetches them from the top level src directory. this can result in installing the same headers multiple times in different locations as instead of sharing the same headers, each library installs a set of the same headers of its own.
| #============================================================================ | ||
|
|
||
| libstore_inc = [include_directories('.')] | ||
| libstore_inc = [include_directories( |
|
|
||
| libutil_inc = [include_directories('.')] | ||
| libutil_inc = [include_directories( | ||
| '.', |
|
If we could do a |
this is more of a regression to how the buildsystem was in 2019, using only the built-in version of nlohmann. nlohmann is a header only dependency Which is not exactly uncommon. nlohmann provides us with pkgconf files for a reason, and we should take advantage of them. the autotools buildsystem has the option to use the system or builtin version of nlohmann, so we must mirror this functionality. if anything, the header's should be moved to the |
|
@p01arst0rm I think you misunderstand me. Everything that uses nlohmann uses
In essence, I am proposing exactly how we should restore that functionality. |
ahh, so check pkgconf with dependency() and then fallback to declare_dependency() to create a dependency object? similar to how the libmain libstore etc is handled. That would be a more "correct" way of doing it according to the meson spec :) |
d41da18 to
994677a
Compare
|
Or just use the nlohmann_json wrap which acts as a dependency() provider and abstracts away everything for you. And you don't even need to check the header into git, just the wrap file. |
03305ad to
5218a3a
Compare
mesonis broken (on NixOS) since nlohmann_json: Update to 3.9.1, fix use of internal copy NixOS/nix#5016doc/manual/src/installation/prerequisites-source.md