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 ++ lib.optionals useSwift [
29 ninja
30 swift
31 ];
32
33 patches = [ ./disable-swift-overlay.patch ];
34
35 cmakeFlags = lib.optional useSwift "-DENABLE_SWIFT=ON";
36
37 postInstall = ''
38 # Provide a CMake module. This is primarily used to glue together parts of
39 # the Swift toolchain. Modifying the CMake config to do this for us is
40 # otherwise more trouble.
41 mkdir -p $dev/lib/cmake/dispatch
42 export dylibExt="${stdenv.hostPlatform.extensions.sharedLibrary}"
43 substituteAll ${./glue.cmake} $dev/lib/cmake/dispatch/dispatchConfig.cmake
44 '';
45
46 meta = {
47 description = "Grand Central Dispatch";
48 homepage = "https://github.com/apple/swift-corelibs-libdispatch";
49 platforms = lib.platforms.linux;
50 license = lib.licenses.asl20;
51 maintainers = with lib.maintainers; [ cmm ];
52 teams = [ lib.teams.swift ];
53 };
54}