fix: make static build work again

I copied the workaround from here:
a2de0eff59
Properly fixing the issue upstream will be much more difficult.

Closes: #527
Change-Id: I967d53fa9e80510b620df485af448f76bd9aa52a
This commit is contained in:
V. 2024-11-01 16:55:47 +04:00
parent 834450e237
commit 486d1a1437
4 changed files with 24 additions and 6 deletions

View file

@ -265,6 +265,7 @@ brotli = [
] ]
openssl = dependency('libcrypto', 'openssl', required : true, include_type : 'system') openssl = dependency('libcrypto', 'openssl', required : true, include_type : 'system')
ncurses = dependency('ncurses', required : true, include_type : 'system')
# FIXME: confirm we actually support such old versions of aws-sdk-cpp # FIXME: confirm we actually support such old versions of aws-sdk-cpp
aws_sdk = dependency('aws-cpp-sdk-core', required : false, version : '>=1.8', include_type : 'system') aws_sdk = dependency('aws-cpp-sdk-core', required : false, version : '>=1.8', include_type : 'system')

View file

@ -1,5 +1,6 @@
# FIXME: upstream to nixpkgs (do NOT build with gcc due to gcc coroutine bugs) # FIXME: upstream to nixpkgs (do NOT build with gcc due to gcc coroutine bugs)
{ {
binutils,
lib, lib,
stdenv, stdenv,
fetchFromGitHub, fetchFromGitHub,
@ -8,6 +9,20 @@
zlib, zlib,
}: }:
assert stdenv.cc.isClang; assert stdenv.cc.isClang;
let
# HACK: work around https://github.com/NixOS/nixpkgs/issues/177129
# Though this is an issue between Clang and GCC,
# so it may not get fixed anytime soon...
empty-libgcc_eh = stdenv.mkDerivation {
pname = "empty-libgcc_eh";
version = "0";
dontUnpack = true;
installPhase = ''
mkdir -p "$out"/lib
"${binutils}"/bin/ar r "$out"/lib/libgcc_eh.a
'';
};
in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "capnproto"; pname = "capnproto";
version = "1.0.2"; version = "1.0.2";
@ -24,7 +39,7 @@ stdenv.mkDerivation rec {
propagatedBuildInputs = [ propagatedBuildInputs = [
openssl openssl
zlib zlib
]; ] ++ lib.optional (stdenv.cc.isClang && stdenv.targetPlatform.isStatic) empty-libgcc_eh;
# FIXME: separate the binaries from the stuff that user systems actually use # FIXME: separate the binaries from the stuff that user systems actually use
# This runs into a terrible UX issue in Lix and I just don't want to debug it # This runs into a terrible UX issue in Lix and I just don't want to debug it

View file

@ -97,10 +97,10 @@
# Enable ANSI arrow keys. # Enable ANSI arrow keys.
(lib.enableFeature true "arrow-keys") (lib.enableFeature true "arrow-keys")
# Use termcap library to query terminal size. # Use termcap library to query terminal size.
(lib.enableFeature (ncurses != null) "termcap") (lib.enableFeature true "termcap")
]; ];
buildInputs = (prev.buildInputs or [ ]) ++ [ ncurses ]; propagatedBuildInputs = (prev.propagatedBuildInputs or [ ]) ++ [ ncurses ];
}); });
build-release-notes = callPackage ./maintainers/build-release-notes.nix { }; build-release-notes = callPackage ./maintainers/build-release-notes.nix { };
@ -245,9 +245,10 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = nativeBuildInputs =
[ [
python3 (python3.pythonOnBuildForHost.withPackages (p: [
python3.pkgs.pytest p.pytest
python3.pkgs.pytest-xdist p.pytest-xdist
]))
meson meson
ninja ninja
cmake cmake

View file

@ -47,6 +47,7 @@ libcmd = library(
liblixfetchers, liblixfetchers,
liblixmain, liblixmain,
boehm, boehm,
ncurses,
editline, editline,
lowdown, lowdown,
nlohmann_json, nlohmann_json,