Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 43 additions & 3 deletions pkgs/by-name/ca/capnproto/package.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
{
binutils,
lib,
stdenv,
clangStdenv,
fetchFromGitHub,
cmake,
openssl,
zlib,
}:

stdenv.mkDerivation rec {
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 = clangStdenv.mkDerivation {
pname = "empty-libgcc_eh";
version = "0";
dontUnpack = true;
installPhase = ''
mkdir -p "$out"/lib
"${binutils}"/bin/ar r "$out"/lib/libgcc_eh.a
'';
};
in

# NOTE: This must be `clang` because `gcc` is known to miscompile or ICE while
# compiling `capnproto` coroutines.
#
# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102051
# See: https://gerrit.lix.systems/c/lix/+/1874
clangStdenv.mkDerivation rec {
pname = "capnproto";
version = "1.1.0";

Expand All @@ -23,8 +44,27 @@ stdenv.mkDerivation rec {
propagatedBuildInputs = [
openssl
zlib
] ++ lib.optional (clangStdenv.cc.isClang && clangStdenv.targetPlatform.isStatic) empty-libgcc_eh;

# 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
# right now for the couple MB of closure size:
# https://git.lix.systems/lix-project/lix/issues/551
# outputs = [ "bin" "dev" "out" ];

cmakeFlags = [
(lib.cmakeBool "BUILD_SHARED_LIBS" true)
# Take optimization flags from CXXFLAGS rather than cmake injecting them
(lib.cmakeFeature "CMAKE_BUILD_TYPE" "None")
];

env = {
# Required to build the coroutine library
CXXFLAGS = "-std=c++20";
};

separateDebugInfo = true;

meta = with lib; {
homepage = "https://capnproto.org/";
description = "Cap'n Proto cerealization protocol";
Expand All @@ -35,6 +75,6 @@ stdenv.mkDerivation rec {
'';
license = licenses.mit;
platforms = platforms.all;
maintainers = [ ];
maintainers = lib.teams.lix.members;
};
}