1{ lib
2, stdenv
3, callPackage
4, cmake
5, ninja
6, useSwift ? true, swift
7}:
8
9let
10 sources = callPackage ../sources.nix { };
11in stdenv.mkDerivation {
12 pname = "swift-corelibs-libdispatch";
13
14 inherit (sources) version;
15 src = sources.swift-corelibs-libdispatch;
16
17 outputs = [ "out" "dev" "man" ];
18
19 nativeBuildInputs = [ cmake ]
20 ++ lib.optionals useSwift [ ninja swift ];
21
22 patches = [ ./disable-swift-overlay.patch ];
23
24 cmakeFlags = lib.optional useSwift "-DENABLE_SWIFT=ON";
25
26 postInstall = ''
27 # Provide a CMake module. This is primarily used to glue together parts of
28 # the Swift toolchain. Modifying the CMake config to do this for us is
29 # otherwise more trouble.
30 mkdir -p $dev/lib/cmake/dispatch
31 export dylibExt="${stdenv.hostPlatform.extensions.sharedLibrary}"
32 substituteAll ${./glue.cmake} $dev/lib/cmake/dispatch/dispatchConfig.cmake
33 '';
34
35 meta = {
36 description = "Grand Central Dispatch";
37 homepage = "https://github.com/apple/swift-corelibs-libdispatch";
38 platforms = lib.platforms.linux;
39 license = lib.licenses.asl20;
40 maintainers = with lib.maintainers; [ cmm dtzWill trepetti dduan trundle stephank ];
41 };
42}