mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-09-28 02:40:50 +00:00
Merge pull request #73980 from Ericson2314/mingw-rocksdb-19.09
rocksdb: Build with MinGW for 19.09
This commit is contained in:
@@ -1,19 +1,42 @@
|
||||
{ stdenv, fetchFromGitHub, lib, bzip2, cmake, lz4, snappy, zlib, zstd, enableLite ? false }:
|
||||
{ stdenv, fetchFromGitHub, fetchpatch
|
||||
, cmake
|
||||
, bzip2, lz4, snappy, zlib, zstd
|
||||
, enableLite ? false
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "rocksdb";
|
||||
version = "6.2.2";
|
||||
version = "6.2.4";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "facebook";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = "0wz9rfj8gk6gyabh9anl67fqm5dw2z866y1a0k0j2lmcaag537r2";
|
||||
sha256 = "08077agbimm7738xrknkw6fjw9f8jv6x3igp8b5pmsj9l954ywma";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = [ bzip2 lz4 snappy zlib zstd ];
|
||||
|
||||
patches = [
|
||||
(fetchpatch {
|
||||
url = "https://github.com/facebook/rocksdb/commit/6a376fc709e9d289c1be4a7d479eb460cd27a87f.diff";
|
||||
sha256 = "1rsc1nagwica0krfkvjv21jhgfxpl9359aqqaaxqfnbvfds43ljs";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://github.com/facebook/rocksdb/commit/3b860886c01bd880158e9a63ff970dfe9aa966cb.diff";
|
||||
sha256 = "1b6p2ghmbawcafv4w9m8g4xv1f9xjijdbm4hj4rg3f8mylqcv7i1";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://github.com/facebook/rocksdb/commit/31ac949de35c0e21440f851a6811304de964d22a.diff";
|
||||
sha256 = "1316cw74cdfll51gacr9qshrwdg4j8w9n75bvfxiir8v57xaipzj";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://github.com/facebook/rocksdb/commit/c585211cec1211ad9b977211ba5aa69853a20348.diff";
|
||||
sha256 = "01kwnm0r4msc3b6fwx2j14p68ii7z2d6abig2093izcvbm6hq6p1";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace CMakeLists.txt --replace "find_package(zlib " "find_package(ZLIB "
|
||||
'';
|
||||
@@ -30,13 +53,17 @@ stdenv.mkDerivation rec {
|
||||
"-DWITH_ZLIB=1"
|
||||
"-DWITH_ZSTD=1"
|
||||
"-DWITH_GFLAGS=0"
|
||||
(lib.optional
|
||||
(stdenv.hostPlatform.system == "i686-linux"
|
||||
|| stdenv.hostPlatform.system == "x86_64-linux")
|
||||
"-DROCKSDB_INSTALL_ON_WINDOWS=YES" # harmless elsewhere
|
||||
(stdenv.lib.optional
|
||||
(stdenv.hostPlatform.isx86 && stdenv.hostPlatform.isLinux)
|
||||
"-DFORCE_SSE42=1")
|
||||
(lib.optional enableLite "-DROCKSDB_LITE=1")
|
||||
(stdenv.lib.optional enableLite "-DROCKSDB_LITE=1")
|
||||
"-DFAIL_ON_WARNINGS=${if stdenv.hostPlatform.isMinGW then "NO" else "YES"}"
|
||||
];
|
||||
|
||||
# otherwise "cc1: error: -Wformat-security ignored without -Wformat [-Werror=format-security]"
|
||||
hardeningDisable = stdenv.lib.optional stdenv.hostPlatform.isWindows "format";
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
homepage = https://rocksdb.org;
|
||||
description = "A library that provides an embeddable, persistent key-value store for fast storage";
|
||||
|
||||
@@ -32,6 +32,6 @@ stdenv.mkDerivation rec {
|
||||
homepage = https://google.github.io/snappy/;
|
||||
license = licenses.bsd3;
|
||||
description = "Compression/decompression library for very high speeds";
|
||||
platforms = platforms.unix;
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ stdenv.mkDerivation rec {
|
||||
})
|
||||
];
|
||||
|
||||
# TODO(@Ericson2314): Separate binaries and libraries
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
buildInputs = stdenv.lib.optional doCheck valgrind;
|
||||
@@ -33,17 +34,27 @@ stdenv.mkDerivation rec {
|
||||
# TODO do this instead
|
||||
#"BUILD_STATIC=${if enableStatic then "yes" else "no"}"
|
||||
#"BUILD_SHARED=${if enableShared then "yes" else "no"}"
|
||||
#"WINDRES:=${stdenv.cc.bintools.targetPrefix}windres"
|
||||
]
|
||||
# TODO delete and do above
|
||||
++ stdenv.lib.optional (enableStatic) "BUILD_STATIC=yes"
|
||||
++ stdenv.lib.optional (!enableShared) "BUILD_SHARED=no"
|
||||
++ stdenv.lib.optional stdenv.hostPlatform.isMinGW "WINDRES:=${stdenv.cc.bintools.targetPrefix}windres"
|
||||
# TODO make full dictionary
|
||||
++ stdenv.lib.optional stdenv.hostPlatform.isMinGW "TARGET_OS=MINGW"
|
||||
;
|
||||
|
||||
doCheck = false; # tests take a very long time
|
||||
checkTarget = "test";
|
||||
|
||||
# TODO remove
|
||||
postInstall = stdenv.lib.optionalString (!enableStatic) "rm $out/lib/*.a";
|
||||
# TODO(@Ericson2314): Make resusable setup hook for this issue on Windows.
|
||||
postInstall =
|
||||
stdenv.lib.optionalString stdenv.hostPlatform.isWindows ''
|
||||
mv $out/bin/*.dll $out/lib
|
||||
ln -s $out/lib/*.dll
|
||||
''
|
||||
# TODO remove
|
||||
+ stdenv.lib.optionalString (!enableStatic) "rm $out/lib/*.a";
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Extremely fast compression algorithm";
|
||||
@@ -56,6 +67,6 @@ stdenv.mkDerivation rec {
|
||||
'';
|
||||
homepage = https://lz4.github.io/lz4/;
|
||||
license = with licenses; [ bsd2 gpl2Plus ];
|
||||
platforms = platforms.unix;
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ stdenv, fetchFromGitHub, gnugrep
|
||||
{ stdenv, fetchFromGitHub, fetchpatch, gnugrep
|
||||
, fixDarwinDylibNames
|
||||
, file
|
||||
, legacySupport ? false }:
|
||||
@@ -14,11 +14,33 @@ stdenv.mkDerivation rec {
|
||||
owner = "facebook";
|
||||
};
|
||||
|
||||
buildInputs = stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
||||
patches = [
|
||||
# All 3 from https://github.com/facebook/zstd/pull/1883
|
||||
(fetchpatch {
|
||||
url = "https://github.com/facebook/zstd/commit/106278e7e5fafaea3b7deb4147bdc8071562d2f0.diff";
|
||||
sha256 = "13z7id1qbc05cv1rmak7c8xrchp7jh1i623bq5pwcihg57wzcyr8";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://github.com/facebook/zstd/commit/0ede342acc2c26f87ae962fa88e158904d4198c4.diff";
|
||||
sha256 = "12l5xbvnzkvr76mvl1ls767paqfwbd9q1pzq44ckacfpz4f6iaap";
|
||||
excludes = [
|
||||
# I think line endings are causing problems, or something like that
|
||||
"programs/windres/generate_res.bat"
|
||||
];
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://github.com/facebook/zstd/commit/10552eaffef84c011f67af0e04f0780b50a5ab26.diff";
|
||||
sha256 = "1s27ravar3rn7q8abybp9733jhpsfcaci51k04da94ahahvxwiqw";
|
||||
})
|
||||
] # This I didn't upstream because if you use posix threads with MinGW it will
|
||||
# work find, and I'm not sure how to write the condition.
|
||||
++ stdenv.lib.optional stdenv.hostPlatform.isWindows ./mcfgthreads-no-pthread.patch;
|
||||
|
||||
nativeBuildInputs = stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
||||
|
||||
makeFlags = [
|
||||
"ZSTD_LEGACY_SUPPORT=${if legacySupport then "1" else "0"}"
|
||||
];
|
||||
] ++ stdenv.lib.optional stdenv.hostPlatform.isWindows "OS=Windows";
|
||||
|
||||
checkInputs = [ file ];
|
||||
doCheck = true;
|
||||
@@ -56,7 +78,7 @@ stdenv.mkDerivation rec {
|
||||
homepage = https://facebook.github.io/zstd/;
|
||||
license = with licenses; [ bsd3 ]; # Or, at your opinion, GPL-2.0-only.
|
||||
|
||||
platforms = platforms.unix;
|
||||
platforms = platforms.all;
|
||||
maintainers = with maintainers; [ orivej ];
|
||||
};
|
||||
}
|
||||
|
||||
13
pkgs/tools/compression/zstd/mcfgthreads-no-pthread.patch
Normal file
13
pkgs/tools/compression/zstd/mcfgthreads-no-pthread.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git a/programs/Makefile b/programs/Makefile
|
||||
index 7882fe8c..1e8237bb 100644
|
||||
--- a/programs/Makefile
|
||||
+++ b/programs/Makefile
|
||||
@@ -107,7 +107,7 @@ HAVE_THREAD := $(shell [ "$(HAVE_PTHREAD)" -eq "1" -o -n "$(filter Windows%,$(OS
|
||||
ifeq ($(HAVE_THREAD), 1)
|
||||
THREAD_MSG := ==> building with threading support
|
||||
THREAD_CPP := -DZSTD_MULTITHREAD
|
||||
-THREAD_LD := -pthread
|
||||
+THREAD_LD :=
|
||||
else
|
||||
THREAD_MSG := $(NO_THREAD_MSG)
|
||||
endif
|
||||
Reference in New Issue
Block a user