diff --git a/flake.nix b/flake.nix index 65258e7965..cc5ecb3a78 100644 --- a/flake.nix +++ b/flake.nix @@ -116,10 +116,16 @@ then [ ./scripts/nix/direct-sqlcipher-2.3.27-win.patch ] else [ ./scripts/nix/direct-sqlcipher-2.3.27.patch ] ++ pkgs.lib.optional pkgs'.stdenv.hostPlatform.isAndroid - ./scripts/nix/direct-sqlcipher-android-log.patch; + ./scripts/nix/direct-sqlcipher-android-log.patch + ++ pkgs.lib.optional pkgs'.stdenv.hostPlatform.isMusl + ./scripts/nix/direct-sqlcipher-static-libraries.patch; } // pkgs.lib.optionalAttrs pkgs'.stdenv.hostPlatform.isDarwin { "https://github.com/simplex-chat/simplexmq.git" = [ ./scripts/nix/simplexmq-blst-darwin-extern.patch ]; + } // pkgs.lib.optionalAttrs pkgs'.stdenv.hostPlatform.isMusl { + # -fully-static uses each producer's registered static C libraries. + "https://github.com/simplex-chat/simplexmq.git" = + [ ./scripts/nix/simplexmq-static-libraries.patch ]; }; }; modules = [ diff --git a/scripts/nix/direct-sqlcipher-static-libraries.patch b/scripts/nix/direct-sqlcipher-static-libraries.patch new file mode 100644 index 0000000000..3b7e37a3ba --- /dev/null +++ b/scripts/nix/direct-sqlcipher-static-libraries.patch @@ -0,0 +1,44 @@ +diff --git a/direct-sqlcipher.cabal b/direct-sqlcipher.cabal +--- a/direct-sqlcipher.cabal ++++ b/direct-sqlcipher.cabal +@@ -1,9 +1,11 @@ ++cabal-version: 3.8 ++ + name: direct-sqlcipher + version: 2.3.28 + synopsis: Low-level binding to SQLCipher. Includes UTF8 and BLOB support. + description: This package is forked from direct-sqlite by Irene Knapp. + https://github.com/IreneKnapp/direct-sqlite +-license: BSD3 ++license: BSD-3-Clause + license-file: LICENSE + copyright: Copyright (c) 2012 - 2014 Irene Knapp, + 2014 - 2018 Janne Hellsten, +@@ -20,7 +22,6 @@ + cbits/sqlite3.h + cbits/sqlite3ext.h + changelog +-cabal-version: >= 1.10 + + source-repository head + type: git +@@ -90,9 +91,11 @@ + -DSQLITE_HAS_CODEC + + extra-libraries: dl ++ extra-libraries-static: dl + + if !os(windows) && !os(android) + extra-libraries: pthread ++ extra-libraries-static: pthread + + if flag(fulltextsearch) + cc-options: -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS +@@ -115,6 +118,7 @@ + if flag(openssl) + cc-options: -DSQLCIPHER_CRYPTO_OPENSSL + extra-libraries: crypto ++ extra-libraries-static: crypto + + if flag(tomcrypt) + cc-options: -DSQLCIPHER_CRYPTO_LIBTOMCRYPT diff --git a/scripts/nix/simplexmq-static-libraries.patch b/scripts/nix/simplexmq-static-libraries.patch new file mode 100644 index 0000000000..3274920236 --- /dev/null +++ b/scripts/nix/simplexmq-static-libraries.patch @@ -0,0 +1,18 @@ +diff --git a/simplexmq.cabal b/simplexmq.cabal +--- a/simplexmq.cabal ++++ b/simplexmq.cabal +@@ -1,4 +1,4 @@ +-cabal-version: 3.0 ++cabal-version: 3.8 + + name: simplexmq + version: 7.1.0.11 +@@ -351,6 +351,8 @@ + cbits/blst/build/assembly.S + extra-libraries: + crypto ++ extra-libraries-static: ++ crypto + if os(windows) + c-sources: + cbits/getentropy_win.c