nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 cmake,
6 doctest,
7}:
8
9stdenv.mkDerivation (finalAttrs: {
10 pname = "foonathan-memory";
11 version = "0.7-4";
12
13 src = fetchFromGitHub {
14 owner = "foonathan";
15 repo = "memory";
16 rev = "v${finalAttrs.version}";
17 hash = "sha256-qGbI7SL6lDbJzn2hkqaYw35QAyvSPxcZTb0ltDkPUSo=";
18 };
19
20 patches = [
21 # do not download doctest, use the system doctest instead
22 # originally from: https://sources.debian.org/data/main/f/foonathan-memory/0.7.3-2/debian/patches/0001-Use-system-doctest.patch
23 ./0001-Use-system-doctest.patch.patch
24 ];
25
26 outputs = [
27 "out"
28 "dev"
29 ];
30
31 cmakeFlags = [
32 (lib.cmakeBool "FOONATHAN_MEMORY_BUILD_TESTS" finalAttrs.finalPackage.doCheck)
33 (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
34 ];
35
36 nativeBuildInputs = [ cmake ];
37
38 doCheck = true;
39
40 checkInputs = [ doctest ];
41
42 # fix a circular dependency between "out" and "dev" outputs
43 postInstall = ''
44 mkdir -p $out/lib/cmake
45 mv $out/lib/foonathan_memory/cmake $out/lib/cmake/foonathan_memory
46 rmdir $out/lib/foonathan_memory
47 '';
48
49 meta = {
50 homepage = "https://memory.foonathan.net/";
51 changelog = "https://github.com/foonathan/memory/releases/tag/${finalAttrs.src.rev}";
52 description = "STL compatible C++ memory allocator library";
53 mainProgram = "nodesize_dbg";
54
55 longDescription = ''
56 The C++ STL allocator model has various flaws. For example, they are
57 fixed to a certain type, because they are almost necessarily required to
58 be templates. So you can't easily share a single allocator for multiple
59 types. In addition, you can only get a copy from the containers and not
60 the original allocator object. At least with C++11 they are allowed to be
61 stateful and so can be made object not instance based. But still, the
62 model has many flaws. Over the course of the years many solutions have
63 been proposed, for example EASTL. This library is another. But instead of
64 trying to change the STL, it works with the current implementation.
65 '';
66
67 license = lib.licenses.zlib;
68 maintainers = with lib.maintainers; [ panicgh ];
69 platforms = with lib.platforms; unix ++ windows;
70 };
71})