nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 autoreconfHook,
6 sqlite,
7 xcbuildHook,
8}:
9
10stdenv.mkDerivation (finalAttrs: {
11 pname = "mps";
12 version = "1.118.0";
13
14 src = fetchFromGitHub {
15 owner = "Ravenbrook";
16 repo = "mps";
17 tag = "release-${finalAttrs.version}";
18 hash = "sha256-3ql3jWLccgnQHKf23B1en+nJ9rxqmHcWd7aBr93YER0=";
19 };
20
21 sourceRoot = lib.optionalString stdenv.hostPlatform.isDarwin "${finalAttrs.src.name}/code";
22
23 postPatch = lib.optionalString stdenv.hostPlatform.isLinux ''
24 # Disable -Werror to avoid biuld failure on fresh toolchains like
25 # gcc-13.
26 substituteInPlace code/gc.gmk \
27 --replace-fail "-Werror " " "
28 substituteInPlace code/gp.gmk \
29 --replace-fail "-Werror " " "
30 substituteInPlace code/ll.gmk \
31 --replace-fail "-Werror " " "
32 '';
33
34 nativeBuildInputs =
35 (lib.optionals stdenv.hostPlatform.isLinux [ autoreconfHook ])
36 ++ (lib.optionals stdenv.hostPlatform.isDarwin [ xcbuildHook ]);
37
38 buildInputs = [ sqlite ];
39
40 xcbuildFlags = lib.optionals stdenv.hostPlatform.isDarwin [
41 "-configuration"
42 "Release"
43 "-project"
44 "mps.xcodeproj"
45 # "-scheme"
46 # "mps"
47 "OTHER_CFLAGS='-Wno-error=unused-but-set-variable'"
48 ];
49
50 installPhase = lib.optionalString stdenv.hostPlatform.isDarwin ''
51 runHook preInstall
52
53 install -Dm644 Products/Release/libmps.a $out/lib/libmps.a
54 mkdir $out/include
55 cp mps*.h $out/include/
56
57 runHook postInstall
58 '';
59
60 meta = {
61 description = "Flexible memory management and garbage collection library";
62 homepage = "https://www.ravenbrook.com/project/mps";
63 license = lib.licenses.sleepycat;
64 platforms = lib.platforms.linux ++ lib.platforms.darwin;
65 maintainers = [ lib.maintainers.thoughtpolice ];
66 };
67})