From d7d2ce5f51722ea4cc9ccfe67ba286c0a7822de6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 20 Jan 2025 14:52:23 +0100 Subject: [PATCH 1/2] mingw: Check for S_ISSOCK (cherry picked from commit c656725a1521e9bb6f7a1e80e00459ac05a181e4) # Conflicts: # src/libutil/posix-source-accessor.cc --- src/libutil/posix-source-accessor.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libutil/posix-source-accessor.cc b/src/libutil/posix-source-accessor.cc index 50b43689353..1dc1b23b9ec 100644 --- a/src/libutil/posix-source-accessor.cc +++ b/src/libutil/posix-source-accessor.cc @@ -122,7 +122,17 @@ std::optional PosixSourceAccessor::maybeLstat(const CanonP S_ISREG(st->st_mode) ? tRegular : S_ISDIR(st->st_mode) ? tDirectory : S_ISLNK(st->st_mode) ? tSymlink : +<<<<<<< HEAD tMisc, +======= + S_ISCHR(st->st_mode) ? tChar : + S_ISBLK(st->st_mode) ? tBlock : +#ifdef S_ISSOCK + S_ISSOCK(st->st_mode) ? tSocket : +#endif + S_ISFIFO(st->st_mode) ? tFifo : + tUnknown, +>>>>>>> c656725a1 (mingw: Check for S_ISSOCK) .fileSize = S_ISREG(st->st_mode) ? std::optional(st->st_size) : std::nullopt, .isExecutable = S_ISREG(st->st_mode) && st->st_mode & S_IXUSR, }; From 8e82395f09585465f8db05d7ab1e59e83a5c459a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 20 Jan 2025 14:52:50 +0100 Subject: [PATCH 2/2] mingw: Don't do LTO This breaks the build with "symbol wrong type (4 vs 3)". https://stackoverflow.com/questions/28267100/dll-linking-failed-with-lto-using-mingw-w64 (cherry picked from commit d8636843b1d20ec8067281efb8082dfcd3797db5) # Conflicts: # packaging/dependencies.nix --- packaging/dependencies.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packaging/dependencies.nix b/packaging/dependencies.nix index 13766f2c040..d20f9fc1998 100644 --- a/packaging/dependencies.nix +++ b/packaging/dependencies.nix @@ -66,6 +66,24 @@ let mesonLayer = finalAttrs: prevAttrs: { +<<<<<<< HEAD +======= + # NOTE: + # As of https://github.com/NixOS/nixpkgs/blob/8baf8241cea0c7b30e0b8ae73474cb3de83c1a30/pkgs/by-name/me/meson/setup-hook.sh#L26, + # `mesonBuildType` defaults to `plain` if not specified. We want our Nix-built binaries to be optimized by default. + # More on build types here: https://mesonbuild.com/Builtin-options.html#details-for-buildtype. + mesonBuildType = "release"; + # NOTE: + # Users who are debugging Nix builds are expected to set the environment variable `mesonBuildType`, per the + # guidance in https://github.com/NixOS/nix/blob/8a3fc27f1b63a08ac983ee46435a56cf49ebaf4a/doc/manual/source/development/debugging.md?plain=1#L10. + # For this reason, we don't want to refer to `finalAttrs.mesonBuildType` here, but rather use the environment variable. + preConfigure = prevAttrs.preConfigure or "" + lib.optionalString (!stdenv.hostPlatform.isWindows) '' + case "$mesonBuildType" in + release|minsize) appendToVar mesonFlags "-Db_lto=true" ;; + *) appendToVar mesonFlags "-Db_lto=false" ;; + esac + ''; +>>>>>>> d8636843b (mingw: Don't do LTO) nativeBuildInputs = [ pkgs.buildPackages.meson pkgs.buildPackages.ninja