Fixed libsodium issue for windows build
This commit is contained in:
parent
25f55cf24d
commit
b84a60ba69
51
default.nix
51
default.nix
@ -128,29 +128,32 @@ let
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
in {
|
# For some reason the pkgsCross.pkgsStatic build of libsodium doesn't contain
|
||||||
|
# a `.a` file when compiled to a windows target, but rather contains
|
||||||
|
# a `.dll.a` file which libsodium-sys doesn't pick up on. Copying the one to
|
||||||
|
# the be the other seems to work.
|
||||||
|
libsodium = pkgs.runCommand "libsodium-wrapped" {
|
||||||
|
libsodium = pkgsCross.pkgsStatic.libsodium;
|
||||||
|
} ''
|
||||||
|
cp -rL "$libsodium" "$out"
|
||||||
|
chmod -R +w "$out"
|
||||||
|
if [ ! -e "$out"/lib/libsodium.a ] && [ -f "$out"/lib/libsodium.dll.a ]; then
|
||||||
|
cp "$out"/lib/libsodium.dll.a "$out"/lib/libsodium.a
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
|
||||||
inherit pkgs;
|
buildEnv = rec {
|
||||||
|
nativeBuildInputs = (buildTarget.depsBuildBuild pkgsCross) ++ [
|
||||||
release = naersk.buildPackage rec {
|
toolchain
|
||||||
inherit release;
|
|
||||||
|
|
||||||
src = ./.;
|
|
||||||
strictDeps = true;
|
|
||||||
doCheck = false;
|
|
||||||
|
|
||||||
depsBuildBuild = (buildTarget.depsBuildBuild pkgsCross) ++ [
|
|
||||||
pkgs.protobuf
|
pkgs.protobuf
|
||||||
];
|
];
|
||||||
|
|
||||||
cargoBuildOptions = prev: prev++[
|
|
||||||
"--features=${builtins.concatStringsSep "," builtFeatures}"
|
|
||||||
];
|
|
||||||
|
|
||||||
OPENSSL_STATIC = "1";
|
OPENSSL_STATIC = "1";
|
||||||
OPENSSL_LIB_DIR = "${pkgsCross.pkgsStatic.openssl.out}/lib";
|
OPENSSL_LIB_DIR = "${pkgsCross.pkgsStatic.openssl.out}/lib";
|
||||||
OPENSSL_INCLUDE_DIR = "${pkgsCross.pkgsStatic.openssl.dev}/include";
|
OPENSSL_INCLUDE_DIR = "${pkgsCross.pkgsStatic.openssl.dev}/include";
|
||||||
|
|
||||||
|
SODIUM_LIB_DIR = "${libsodium}/lib";
|
||||||
|
|
||||||
# Required because ring crate is special. This also seems to have
|
# Required because ring crate is special. This also seems to have
|
||||||
# fixed some issues with the x86_64-windows cross-compile :shrug:
|
# fixed some issues with the x86_64-windows cross-compile :shrug:
|
||||||
TARGET_CC = "${pkgsCross.stdenv.cc}/bin/${pkgsCross.stdenv.cc.targetPrefix}cc";
|
TARGET_CC = "${pkgsCross.stdenv.cc}/bin/${pkgsCross.stdenv.cc.targetPrefix}cc";
|
||||||
@ -168,6 +171,24 @@ in {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
in {
|
||||||
|
|
||||||
|
inherit pkgs pkgsCross;
|
||||||
|
|
||||||
|
release = naersk.buildPackage (rec {
|
||||||
|
inherit release;
|
||||||
|
|
||||||
|
src = ./.;
|
||||||
|
strictDeps = true;
|
||||||
|
doCheck = false;
|
||||||
|
|
||||||
|
cargoBuildOptions = prev: prev++[
|
||||||
|
"--features=${builtins.concatStringsSep "," builtFeatures}"
|
||||||
|
];
|
||||||
|
} // buildEnv);
|
||||||
|
|
||||||
|
shell = pkgsCross.mkShell buildEnv;
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
#clippy = {
|
#clippy = {
|
||||||
# amd64 = (compile {
|
# amd64 = (compile {
|
||||||
|
Loading…
Reference in New Issue
Block a user