mirror of
https://github.com/logos-co/logos-package.git
synced 2026-08-27 10:11:10 +00:00
* feat(windows): cross-compile lgx for x86_64-w64-mingw32 Adds the x86_64-windows pseudo-system to `packages` (checks and devShells stay native: ctest cannot execute PE binaries on the Linux build host, and a cross devShell offers no way to run what it produces). Four separate defects, three of which were invisible natively: * The hand-rolled configurePhases in bin/lib/all.nix never passed $cmakeFlags, so CMake was configured WITHOUT -DCMAKE_SYSTEM_NAME=Windows or the cross toolchain file. lib.nix and all.nix additionally did not inherit `cmakeFlags` at all, so the variable was empty even once referenced. * The shared-library install looked for `lgx.dll` + `lgx.lib`, the MSVC spelling. CMake emits `liblgx.dll` + `liblgx.dll.a` on MinGW, and the if/elif chain had no else -- an unmatched name installed an EMPTY $out/lib and the build still succeeded. Now globbed, and fatal when nothing matches. (nullglob only drops patterns containing wildcards, so every entry has to be a real glob to get that error branch.) * `cp build/lgx` had no executable suffix. * keyring.cpp used gmtime_r, which mingw-w64 does not ship. Its gmtime_s takes the same two arguments in the OPPOSITE order, so this is a swap rather than the rename the compiler suggests. cpp-semver is header-only and now declares platforms.windows too. Result: bin/lgx.exe, PE32+ x86-64, with its 7 dependency DLLs staged alongside by nixpkgs' win-dll-link.sh. * fix(windows): stop lgx.exe's import library clobbering liblgx.dll's On Windows the executable target `lgx` and the shared target `lgx_shared` (which carries OUTPUT_NAME "lgx") BOTH generate an import library named liblgx.dll.a, and both installed it into lib/. Whichever install rule ran last won, so consumers received either the real 22,744-byte DLL import library or the 892-byte one belonging to lgx.exe -- at random, varying between otherwise identical builds. When the executable's won, the failure landed nowhere near the cause: lgx itself built and ran perfectly, its DLL exported all 437 symbols, and only downstream repos broke, with 40+ "undefined reference to `__imp_lgx_*'" at link time. Renaming the executable's archive removes the collision. No other platform generates an import library, so this is WIN32-only. Also replaces lib.nix's hand-rolled copy of build/ artifacts with CMake's own install(TARGETS lgx_shared) rule. A Windows shared library is two artifacts that must MATCH -- liblgx.dll and liblgx.dll.a -- and globbing build/ by hand cannot know which pairs with which; CMake does. The CLI the install rules also emit is then pruned, since this output is the library. Both failure modes were silent, so lib.nix now refuses to produce an output whose liblgx.dll.a exports no __imp_lgx_* symbols. Verified: native 297/297 tests pass; the Windows import library goes from 2 members / 0 __imp_lgx_ symbols to 36 / 34. * fix(windows): give the keyring a config directory on Windows Keyring::defaultDirectory and defaultKeysDirectory read XDG_CONFIG_HOME then HOME, neither of which exists on Windows -- so both returned an EMPTY path in the normal Windows case. That is not inert: the trust-key lookup is silently skipped, and the key-management commands hard-error with "Cannot determine keyring directory". APPDATA is the direct analogue of XDG_CONFIG_HOME (per-user roaming config), with USERPROFILE backing it up the way HOME does on POSIX. The rules were duplicated verbatim in both functions; they now share one helper, so the platform logic exists once. POSIX behaviour is unchanged. Native: 297/297 tests pass. * fix(windows): never extract a file the extracting user cannot delete lgx_extract applied the archived mode verbatim. A .lgx built by nix-bundle-lgx carries Nix store modes, and the store is 0444, so payload files could arrive read-only. std::filesystem maps a mode with no write bit to FILE_ATTRIBUTE_READONLY on Windows, and Windows refuses to DELETE such a file -- POSIX consults only the parent directory's write bit, which is why this never showed up anywhere else. The consequence was remote from here and looked nothing like a permissions problem: the package manager's temp-directory cleanup threw an uncaught filesystem_error AFTER a successful install, so the install reply was never sent and the UI showed "Retry" for a package that had installed perfectly. Uninstall and upgrade failed the same way with "Access is denied". The producer side (nix-bundle-lgx a9d8be5) and the consumer side (logos-package-manager 5191972) are both fixed. This is the mechanism itself: it protects every other caller of lgx_extract, and it covers the packages ALREADY PUBLISHED with the bit set, which the producer fix cannot reach. Owner-write is added to the archived mode rather than replacing it, so the execute bit and group/other bits are still honoured. * chore(deps): re-pin logos-nix to the merged Windows overlay The cross overlay landed in logos-nix#2. This branch was locked to a pre-merge rev, which has no `lib.forAllTargets` and no `lib.mkWindowsPkgs`, so it could not evaluate standalone -- only against the unmerged branch. Level 2 of the Windows chain; L1 (logos-nix) is merged.
67 lines
1.6 KiB
JSON
67 lines
1.6 KiB
JSON
{
|
|
"nodes": {
|
|
"logos-nix": {
|
|
"inputs": {
|
|
"nixpkgs": "nixpkgs",
|
|
"nixpkgs-windows": "nixpkgs-windows"
|
|
},
|
|
"locked": {
|
|
"lastModified": 1786399295,
|
|
"narHash": "sha256-Bl1A0UgsIXioZw5uEW8Jl5u7FfZcFMnpYlpsdezFwK0=",
|
|
"owner": "logos-co",
|
|
"repo": "logos-nix",
|
|
"rev": "6e0f4a7120fced10829b0b3a698ff619a11d4605",
|
|
"type": "github"
|
|
},
|
|
"original": {
|
|
"owner": "logos-co",
|
|
"repo": "logos-nix",
|
|
"type": "github"
|
|
}
|
|
},
|
|
"nixpkgs": {
|
|
"locked": {
|
|
"lastModified": 1759036355,
|
|
"narHash": "sha256-0m27AKv6ka+q270dw48KflE0LwQYrO7Fm4/2//KCVWg=",
|
|
"owner": "NixOS",
|
|
"repo": "nixpkgs",
|
|
"rev": "e9f00bd893984bc8ce46c895c3bf7cac95331127",
|
|
"type": "github"
|
|
},
|
|
"original": {
|
|
"owner": "NixOS",
|
|
"ref": "nixos-unstable",
|
|
"repo": "nixpkgs",
|
|
"type": "github"
|
|
}
|
|
},
|
|
"nixpkgs-windows": {
|
|
"locked": {
|
|
"lastModified": 1782723713,
|
|
"narHash": "sha256-oPXCU/SSUokcGaJREHibG1CBX3+s/W7orDWQOZDsEeQ=",
|
|
"owner": "NixOS",
|
|
"repo": "nixpkgs",
|
|
"rev": "b5aa0fbd538984f6e3d201be0005b4463d8b09f8",
|
|
"type": "github"
|
|
},
|
|
"original": {
|
|
"owner": "NixOS",
|
|
"repo": "nixpkgs",
|
|
"rev": "b5aa0fbd538984f6e3d201be0005b4463d8b09f8",
|
|
"type": "github"
|
|
}
|
|
},
|
|
"root": {
|
|
"inputs": {
|
|
"logos-nix": "logos-nix",
|
|
"nixpkgs": [
|
|
"logos-nix",
|
|
"nixpkgs"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"root": "root",
|
|
"version": 7
|
|
}
|