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