From 612d6d7a51988a765cfae29cc573318f6ccca775 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Wed, 24 Jul 2024 21:12:52 +0100 Subject: [PATCH] build openssl without threads to avoid stdatomic --- overlay.nix | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/overlay.nix b/overlay.nix index 80fb0b4..fc69ced 100644 --- a/overlay.nix +++ b/overlay.nix @@ -177,21 +177,33 @@ extraPkgs // { ]; }); - openssl = prev.openssl.overrideAttrs (o: { - # we want to apply - # https://patch-diff.githubusercontent.com/raw/openssl/openssl/pull/20273.patch"; - # which disables overriding the -march cflags to the wrong values, - # but openssl is used for bootstrapping so that's easier said than - # done. Do it the ugly way.. - postPatch = - o.postPatch - + ( - with final; - lib.optionalString ( - stdenv.buildPlatform != stdenv.hostPlatform - ) "\nsed -i.bak 's/linux.*-mips/linux-mops/' Configure\n" - ); - }); + openssl = prev.openssl.overrideAttrs (o: + with final; + let cross = stdenv.buildPlatform != stdenv.hostPlatform; + in + { + # we want to apply + # https://patch-diff.githubusercontent.com/raw/openssl/openssl/pull/20273.patch"; + # which disables overriding the -march cflags to the wrong values, + # but openssl is used for bootstrapping so that's easier said than + # done. Do it the ugly way.. + postPatch = + o.postPatch + + ( + lib.optionalString cross '' + sed -i.bak 's/linux.*-mips/linux-mops/' Configure + '' + ); + # openssl with threads requires stdatomic which drags in libgcc + # as a dependency + configureFlags = [] + ++ (lib.optional cross "no-threads") + ++ o.configureFlags; + + # don't need or want this bash script + postInstall = o.postInstall + + (lib.optionalString cross "rm $bin/bin/c_rehash\n"); + }); pppBuild = prev.ppp;