Merge pull request #269326 from obsidiansystems/libgit-windows

libgit2, http-parser: Fix Windows Build
This commit is contained in:
John Ericson 2023-11-24 09:14:37 -05:00 committed by GitHub
commit 281f0e65b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 2 deletions

View File

@ -12,6 +12,7 @@ stdenv.mkDerivation rec {
};
env.NIX_CFLAGS_COMPILE = "-Wno-error";
patches = [
./build-shared.patch
] ++ lib.optionals stdenv.isAarch32 [
@ -21,18 +22,36 @@ stdenv.mkDerivation rec {
sha256 = "sha256-rZZMJeow3V1fTnjadRaRa+xTq3pdhZn/eJ4xjxEDoU4=";
})
];
makeFlags = [ "DESTDIR=" "PREFIX=$(out)" ];
makeFlags = [
"DESTDIR="
"PREFIX=$(out)"
"SOEXT=${lib.strings.removePrefix "." stdenv.hostPlatform.extensions.sharedLibrary}"
"BINEXT=${stdenv.hostPlatform.extensions.executable}"
"Platform=${lib.toLower stdenv.hostPlatform.uname.system}"
] ++ lib.optionals stdenv.hostPlatform.isWindows [
"SONAME=$(SOLIBNAME).$(SOMAJOR).$(SOMINOR).$(SOEXT)"
"LIBNAME=$(SOLIBNAME).$(SOMAJOR).$(SOMINOR).$(SOREV).$(SOEXT)"
"LDFLAGS=-Wl,--out-implib=$(LIBNAME).a"
];
buildFlags = [ "library" ];
doCheck = true;
checkTarget = "test";
enableParallelBuilding = true;
postInstall = lib.optionalString stdenv.hostPlatform.isWindows ''
install -D *.dll.a $out/lib
ln -sf libhttp_parser.${version}.dll.a $out/lib/libhttp_parser.dll.a
'';
meta = with lib; {
description = "An HTTP message parser written in C";
homepage = "https://github.com/nodejs/http-parser";
maintainers = with maintainers; [ matthewbauer ];
license = licenses.mit;
platforms = platforms.unix;
platforms = platforms.all;
};
}

View File

@ -33,6 +33,10 @@ stdenv.mkDerivation rec {
"-DUSE_HTTP_PARSER=system"
"-DUSE_SSH=ON"
"-DBUILD_SHARED_LIBS=${if staticBuild then "OFF" else "ON"}"
] ++ lib.optionals stdenv.hostPlatform.isWindows [
"-DDLLTOOL=${stdenv.cc.bintools.targetPrefix}dlltool"
# For ws2_32, refered to by a `*.pc` file
"-DCMAKE_LIBRARY_PATH=${stdenv.cc.libc}/lib"
];
nativeBuildInputs = [ cmake python3 pkg-config ];